Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ALSA Configuration How To Combine MMAP Emulation and Ladspa Plugin in asound.conf

I have a working PCM output with good sounding audio on a Raspberry Pi compute module ( Linux ) using the rpi dac. The 'aplay -l' command output shows the following:

>> aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: sndrpirpidac [snd_rpi_rpi_dac], device 0: RPi-DAC HiFi pcm1794a-hifi-0 []
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA]
Subdevices: 8/8
Subdevice #0: subdevice #0
Subdevice #1: subdevice #1
Subdevice #2: subdevice #2
Subdevice #3: subdevice #3
Subdevice #4: subdevice #4
Subdevice #5: subdevice #5
Subdevice #6: subdevice #6
Subdevice #7: subdevice #7
card 1: ALSA [bcm2835 ALSA], device 1: bcm2835 ALSA [bcm2835 IEC958/HDMI]
Subdevices: 1/1
Subdevice #0: subdevice #0

To get the audio to work at all, I had to change my /etc/asound.conf file to look like the following:

pcm.mmap0 {
  type mmap_emul
  slave {
    pcm "hw:0,0"
  }
}

pcm.!default {
  type plug
  slave {
    pcm mmap0
  }
}

The output sounds great when I play .wav files but it is a bit quiet and alsamixer does not allow audio volume control with this driver.

I'd like to get a little more volume and so I researched the Ladspa project software amplifier plugin. The following example code boosts the volume on the 3.5 mm jack on normal Pi:

pcm.radio {
    type plug
    slave.pcm "ladspa"
    hint {
        show on
        description "in -> equal -> declip -> compressor -> limiter -> dmix -> out"
    }
}

#  LADSPA plugins:
#    "listplugins" to see the list of installed plugins
#    "analyseplugin <filename>" to see plugin controls
#    Use "ardour2" to experiment with plugin settings
pcm.ladspa {
    type ladspa
    slave.pcm "plughw:0,0"
    path "/usr/lib/ladspa"
    plugins {
        0 {
        # Limiter
            label amp
            input {
                controls [ 10 ]
            }
          }
    }
}

I've been reading the documentation here: http://alsa.opensrc.org/Asoundrc, but I'm struggling with understanding how to combine the 2 - I want the MMAP emulation as well as the amplification. How can I accomplish this? Thank you.

like image 934
PhilBot Avatar asked Sep 10 '15 16:09

PhilBot


1 Answers

Try next setting please,it can work under my x86 linux:

pcm.mmap0 {
    type mmap_emul
    slave {
        pcm "hw:0,0"
        #    pcm ladspa
    }
}

pcm.ladspa {
type ladspa
#slave.pcm "plughw:0,0"
slave.pcm mmap0
path "/usr/lib/ladspa"
plugins {
    0 {
    # Limiter
        label amp
        input {
            controls [ 100 ]
        }
      }
}
}

pcm.!default{
type plug
slave {
    pcm mmap0
    #pcm ladspa
    }
}
like image 192
shuaiwen Avatar answered Oct 14 '22 14:10

shuaiwen