Yanone - 2020-04-24

Hi everyone,

I'm working on a Raspberry Pi home cinema setup that has an equalizer and a compressor already running successfully.
Now I want to add some sort of VU meter (this is all on a headless Pi) to assess the compression levels, both reduction as well as makeup.

I'm a beginner to ALSA. I thought it should be possible, since devices in ALSA can be freely chained together, to add two separate loopback devices into the chain, one before the compressor, and one after. Then record sound levels between them and calculate volume differences. Negative means compression, positive means makeup etc.

But I can't get it to work because ALSA is not easy to use by foot.
Below you find my current asound.conf. The two loopback devices are defined, but all wrong, so they're being bypassed at the moment.

How can I make it work?
Thank you!

pcm.!default {
  type plug
  #link:
  slave.pcm plugequal;
}

ctl.!default {
  type hw card 0
}

### Equalizer

ctl.equal {
type equal;
controls "/home/pi/.alsaequal.bin"
}

pcm.plugequal {
  type equal;
  #link:
  # currently bypassing loop1
  slave.pcm "plugcompressor";
  controls "/home/pi/.alsaequal.bin"
}

pcm.equal {
  type plug;
  slave.pcm plugequal;
}

### Loopback 1

pcm.loopout1 {
    type dmix
    ipc_key 328211
    #link:
    slave.pcm "plugcompressor"
}

pcm.loopin1 {
    type dsnoop
    ipc_key 686592
    slave.pcm "hw:1,1,0"
}

pcm.loop1 {
    type plug
    slave {
      pcm {
         type asym
         playback.pcm "loopout1"
         capture.pcm "loopin1"
      }
    }
}

### Compressor

ctl.compressor {
  type equal;
  library "/usr/lib/ladspa/sc4m_1916.so";
  module "sc4m";
}

pcm.plugcompressor {
  type equal;
  #link:
  # currently bypassing loop2
  slave.pcm "plug:softvol";
  library "/usr/lib/ladspa/sc4m_1916.so";
  module "sc4m";
}

pcm.compressor {
  type plug;
  slave.pcm plugcompressor;
}


### Loopback 2

pcm.loopout2 {
    type dmix
    ipc_key 219345
    slave.pcm "hw:Loopback,0,0"
}

pcm.loopin2 {
    type dsnoop
    ipc_key 219346
    slave.pcm "hw:Loopback,0,1"
}

pcm.loop2 {
    type plug
    slave {
      pcm {
         type asym
         playback.pcm "loopout2"
         capture.pcm "loopin2"
      }
    }
}

### Soft Volume

pcm.softvol {
    type            softvol
    slave {
        pcm         "dmix"      #redirect the output to dmix (instead of "hw:0,0")
    }
    control {
        name        "PCM"       #override the PCM slider to set the softvol volume level globa$
        card        0
    }
}