[DRC] Brutefir & Alsa Loopback
#1
Hi & sorry for my english!

I'm trying to use drc with xbmc... and I've found that it's really complicated.

My last effort is to use alsa loopback to route audio to brutefir.
This is my .asoundrc config:
Code:
# hardware 0,0 : definizione pcm per ALSA playback - l'output dei player
pcm.loophw00 {
    type hw
    card Loopback
    device 0
    subdevice 0
    format S32_LE # viene influenzato dalla card fisica finale di uscita?
    rate 96000 # viene influenzato dalla card fisica finale di uscita?
    channels 2
}

# playback PCM device: using loopback subdevice loophw00
pcm.amix {
    type dmix
    ipc_key 219345
    slave {
        pcm loophw00
    period_size 4096 # meglio abbassarlo?
    periods 2
    }
}

# capture PCM device: using loopback subdevice 0,1
pcm.asnoop {
  type dsnoop
  ipc_key 219346
  slave.pcm "hw:Loopback,0,1"
}

# duplex device combining our PCM devices defined above
pcm.aduplex {
  type asym
  playback.pcm "amix"
  capture.pcm "asnoop"
}

# ------------------------------------------------------
# default device

pcm.!default {
  type plug
  slave.pcm "aduplex"
}

Brutefir_config:
Code:
float_bits: 64; # internal floating point precision
sampling_rate: 96000; # sampling rate in Hz of audio interfaces
filter_length: 2048,32; # length of filters
#config_file: "~/bf/.bfcfg"; # standard location of main config file
overflow_warnings: false; # echo warnings to stderr if overflow occurs
show_progress: false; # echo filtering progress to stderr
max_dither_table_size: 0; # maximum size in bytes of precalculated dither
allow_poll_mode: true; # allow use of input poll mode
modules_path: "."; # extra path where to find BruteFIR modules
monitor_rate: false; # monitor sample rate
powersave: true; # pause filtering when input is zero
lock_memory: true; # try to lock memory if realtime prio is set
convolver_config: "~/.brutefir_convolver"; # location of convolver config file

## INPUT DEFAULTS ##

input "l_in", "r_in" {
device: "alsa" { device: "hw:Loopback,1,0"; };
sample: "S32_LE";
channels: 2;
};

output "l_out", "r_out" {
device: "alsa" { device: "hw:M1010LT,0"; };
sample: "S32_LE";
channels: 10/0,1;
delay: 0,0;
dither: true;
};

## FILTER DEFAULTS ##

filter "l_filter" {
      from_inputs: "l_in"/8.0;
      to_outputs: "l_out"/0.0;
      process: 0;        # process index to run in (-1 means auto)
      coeff: -1;          # -1 means "copy"
      delay: 0;           # predelay, in blocks
      crossfade: false;   # crossfade when coefficient is changed
};

filter "r_filter" {
      from_inputs: "r_in"/8.0;
      to_outputs: "r_out"/0.0;
      process: 0;        # process index to run in (-1 means auto)
      coeff: -1;
      delay: 7;           # predelay, in blocks
      crossfade: false;   # crossfade when coefficient is changed
};

In this case brutefir does nothing, it send audio from loopback device to phisical device.
If I use aply something.wav or speaker-test or vlc that is more or less ok. I've some trouble with file at different sample rate but that not my fault.

With xbmc, before starting brutefir, i can see in the audio device the default (loopback pcm) but when brutefir start the loopback device is not available. Any ideas?
Reply
#2
I am successfully using brutefir with anything, including xbmc.

Alsa loopback sucks, because it uses stupid amounts of cpu and also I found it to dynamically adjust the samplerate for a number of reasons. For me a total no-go! I use jackplug. It's disadvantage is that it disconnects everything from jack when your application goes silent and you have to connect all the outputs from xbmc to jack's inputs again. To work around that xbmc can hold the stream open even when there is no audio playing when you add <streamsilence>1</streamsilence> to .xbmc/user/advancedsetting.xml.

Here's my /etc/asound.conf

Code:
pcm.!default     {
        type plug;
        slave     {
            pcm surroun40
            }
        }


pcm.jackplug40     {
        type plug
        slave { pcm "surroun40" }
        }    


pcm.surroun40    {
        type jack
        playback_ports     {
                0 system:playback_1
                1 system:playback_2
                }

        capture_ports     {
                0 system:capture_1
                1 system:capture_2
                }
        }

pcm.surrounxbmc    {
        type jack
        playback_ports     {
                0 system:playback_1
                1 system:playback_2
                2 system:playback_3
                3 system:playback_4
                4 system:playback_5
                }

        capture_ports     {
                0 system:capture_1
                1 system:capture_2
                2 system:capture_3
                3 system:capture_4
                4 system:capture_5
                }
        }

This gives me two audio-devices, one for stereo music and one for xbmc. Once xbmc is started you can use any tool like patchage to figure the right connections to make.
I first disconnect everything with a shellscript and then connect xbmc's outputs to the according brutefir-inputs. Took me a while to figure but now it works like a charm.
Reply
 
Thread Rating:
  • 0 Vote(s) - 0 Average



Logout Mark Read Team Forum Stats Members Help
[DRC] Brutefir & Alsa Loopback00