Another Simple Brutefir Config

From DRC

Jump to: navigation, search

Contents


Trivial configuration file

Here's another simple 2 channel configuration file with just S/PDIF input and DAC output. The commented parts are used to switch to any combination of ADC or S/PDIF input to DAC or S/PDIF output. The card used is a TerraTec EWX 24/96, no longer in production but much similar to any other card using the Envy24/ICE1712 mixer chip.

 # Basic settings
 float_bits: 32;
 sampling_rate: 44100;
 filter_length: 8192,8;
 overflow_warnings: false;
 show_progress: false;
 max_dither_table_size: 0;
 modules_path: "/root/bf";
 monitor_rate: false;
 powersave: false;
 allow_poll_mode: true;
 lock_memory: false;
 debug: false;
 convolver_config: "/root/bf/fftw-plan";
 
 # Left channel filter coefficients
 coeff "sxdrc"
   {
     filename: "/root/bffilters/sxf.pcm";
     # filename: "dirac pulse";
     format: "FLOAT_LE";
     attenuation: 0.0;
     blocks: -1;
     shared_mem: false;
   };
   
 # Right channel filter coefficients
 coeff "dxdrc"
   {
     filename: "/root/bffilters/dxf.pcm";
     # filename: "dirac pulse";
     format: "FLOAT_LE";
     attenuation: 0.0;
     blocks: -1;
     shared_mem: false;
   };
 
 # S/PDIF input module
 input "sxin", "dxin"
   {
     device: "alsa" { param: "hw:0,0"; };
     sample: "S24_4LE";
     channels: 12/8,9;
   };
 
 # ADC input module
 # input "sxin", "dxin"
 #  {
 #    device: "alsa" { param: "hw:0,0"; };
 #    sample: "S24_4LE";
 #    channels: 12/0,1;
 #  };
 
 # DAC output module
 output "sxout", "dxout"
   {
     device: "alsa" { param: "hw:0,0"; };
     sample: "S24_4LE";
     channels: 10/0,1;
   };
 
 # S/PDIF output module
 # output "sxout", "dxout"
 #  {
 #    device: "alsa" { param: "hw:0,0"; };
 #    sample: "S24_4LE";
 #    channels: 10/8,9;
 #  };
 
 # Left channel filtering definition
 filter "sxfilter"
   {
     from_inputs: "sxin"/0.0;
     to_outputs: "sxout"/0.0;
     process: 0;
     coeff: "sxdrc";
     delay: 0;
   };
 
 # Right channel filtering definition
 filter "dxfilter"
   {
     from_inputs: "dxin"/0.0;
     to_outputs: "dxout"/0.0;
     process: 0;
     coeff: "dxdrc";
     delay: 0;
   };

Serial line controlled configuration

Recently I switched to a slightly more complicated configuration file. This file loads two sets of filters and the Brutefir command line interface, also known as the CLI:

 # Basic settings
 float_bits: 32;
 sampling_rate: 44100;
 filter_length: 8192,8;
 overflow_warnings: false;
 show_progress: false;
 max_dither_table_size: 0;
 modules_path: "/root/bf";
 monitor_rate: false;
 powersave: false;
 allow_poll_mode: true;
 lock_memory: false;
 debug: false;
 convolver_config: "/root/bf/fftw-plan";
 
 # Loads the command line interface (CLI)
 logic: "cli" { port: 3000; };
 
 # Left channel filter coefficients, set 1
 coeff "lf1"
   {
     filename: "/root/bffilters/lf1.pcm";
     # filename: "dirac pulse";
     format: "FLOAT_LE";
     attenuation: 7.50000;
     blocks: -1;
     shared_mem: false;
   };
   
 # Right channel filter coefficients, set 1
 coeff "rf1"
   {
     filename: "/root/bffilters/rf1.pcm";
     # filename: "dirac pulse";
     format: "FLOAT_LE";
     attenuation: 7.50000;
     blocks: -1;
     shared_mem: false;
   };
 
 # Left channel filter coefficients, set 2
 coeff "lf2"
   {
     filename: "/root/bffilters/lf2.pcm";
     # filename: "dirac pulse";
     format: "FLOAT_LE";
     attenuation: 7.50000;
     blocks: -1;
     shared_mem: false;
   };
   
 # Right channel filter coefficients, set 2
 coeff "rf2"
   {
     filename: "/root/bffilters/rf2.pcm";
     # filename: "dirac pulse";
     format: "FLOAT_LE";
     attenuation: 7.50000;
     blocks: -1;
     shared_mem: false;
   };
 
 # S/PDIF input module
 input "lin", "rin"
   {
     device: "alsa" { param: "hw:0,0"; };
     sample: "S24_4LE";
     channels: 12/8,9;
   };
 
 # ADC input module
 #input "lin", "rin"
 #  {
 #    device: "alsa" { param: "hw:0,0"; };
 #    sample: "S24_4LE";
 #    channels: 12/0,1;
 #  };
 
 # DAC output module
 output "lout", "rout"
   {
     device: "alsa" { param: "hw:0,0"; };
     sample: "S24_4LE";
     channels: 10/0,1;
   };
 
 # S/PDIF output module
 # output "lout", "rout"
 #  {
 #    device: "alsa" { param: "hw:0,0"; };
 #    sample: "S24_4LE";
 #    channels: 10/8,9;
 #  };
 
 # Left channel filtering definition
 filter "lfilter"
   {
     from_inputs: "lin"/0.0;
     to_outputs: "lout"/0.0;
     process: 0;
     coeff: "lf1";
     delay: 0;
   };
 
 # Right channel filtering definition
 filter "rfilter"
   {
     from_inputs: "rin"/0.0;
     to_outputs: "rout"/0.0;
     process: 0;
     coeff: "rf1";
     delay: 0;
   };

This configuration, coupled with a simple shell script that monitors some serial control lines, let me switch between two different filters just using a switch connected to the proper serial line pins. With a long enough cable I'm now able to compare two filters without moving from the listening position and without the need of a keyboard, a screen or a network connection to the convolver PC. The serial line monitor script is pretty simple:

 #!/bin/sh
 
 # Set the serial line to monitor
 BFTTY="/dev/ttyS1"
 
 # Check interval in seconds
 BFDelay="0.25"
 
 # Filter load CLI commands
 BF1Load='cfc "lfilter" "lf1"; cfc "rfilter" "rf1"; quit;'
 BF2Load='cfc "lfilter" "lf2"; cfc "rfilter" "rf2"; quit;'
 
 # CLI interface address
 BFCLIAddress="127.0.0.1 3000"
 
 # Filter 2 status
 BF2Status="4026"
 
 # Last status
 BFLStatus=""
 
 # Monitor loop
 while /bin/true; do
   # Get the serial line status
   BFTTTYStatus=`/usr/bin/statserial -x $BFTTY`
   BFTTTYStatus=`/bin/echo -ne $BFTTTYStatus`
 
   # Check if the status has changed
   if [ "$BFTTTYStatus" != "$BFLStatus" ]; then
     # Check the filter to load
     if [ "$BFTTTYStatus" == "$BF2Status" ]; then
       /bin/echo $BF2Load | /usr/sbin/nc $BFCLIAddress > /dev/null
     else
       /bin/echo $BF1Load | /usr/sbin/nc $BFCLIAddress > /dev/null
     fi
 
     # Reset the last status
     BFLStatus="$BFTTTYStatus"
   fi
 
   # Check delay
   /bin/sleep $BFDelay
 done

The script is created so that if the serial line plug with the switch is missing the first set of filters is automatically selected. Of course it would be pretty easy to change this script to allow for more complex filter selection. The serial line has a total of four usable control lines, so up to 16 different configurations could be switched with this method and a proper, non trivial, external switchbox.

Personal tools