3

A while I have abandoned all sound daemons and lived happily ever since with just the dmix plugin. However, recently I got annoyed by the different volume levels of youtube videos and decided to plug in a compressor and a limiter. IMHO this is an extremely desirable setup.

But alas, I had no luck. I got playback to work or capture, but never both. I suppose the underlying problem is my lack of understanding, so my fundamental questions are:

  • Where can I find a good documentation of alsa and .asoundrc, which goes beyond mere examples and which would e.g. explain the error messages (see below) I got.
  • Has anyobody succeeded in a daemonless sound setup which included ladspa plugins?
  • Does anybody know the reasons, or even a solution for my particular problems (described below)?

For those of you who have the patience to follow my woes here they are. I got as far as being able to play sound like this

aplay -D ladspaChain /usr/share/skype/sounds/CallBusy.wav

but I cannot play via the default device.

 pcm.!default {
    type plug
    slave.pcm {
    type asym
    playback.pcm "ladspaChain"
    capture.pcm "dsnooper"
   }
}

Without -D ladspaChain, I get

aplay: pcm_params.c:170: snd1_pcm_hw_param_get_min: Assertion `!snd_interval_empty(i)' failed.**

Alternatively I tried

 pcm.!default {
    type route
    slave.pcm {
    type asym
    playback.pcm "ladspaChain"
    capture.pcm "dsnooper"
   }
    ttable {
        0.0     1       # left channel
        1.1     1       # right channel
    } 
} 

In this case playback works, but arecord gives me

arecord: set_params:1081: Sample format non available
Available formats:
- S32_LE

2 Answers2

1

Use plug (which also accepts table) not route as type, meaning you can skip one level of nesting.

Ramesh
  • 39,297
Permat
  • 11
  • I don't quite understand. Repacing route by plug doesn't change anything (and does not skip a level of nesting). Can you be more specific? – Martin Drautzburg May 25 '14 at 14:38
0

I found a complete answer (which is well in line with the answer by Permat and Ramesh) on https://forums.gentoo.org/viewtopic-t-733367-start-0.html:

ciaranhearne: "Basically I had to define Dmix as a plugin before I could use it"

While this worked great with just alsa, I couldn't get pulsaudio/apulse to work (for skype). When I set pulse to use dmix directly it worked, but it seized the device exclusively and alsa no longer worked. Letting pulse use the pcms further away from the card didn't work at all.

The solution was to create two dmixes. Now I have

  • A way to insert ladspa plugins permanently (a limiter in my case)
  • default device works (firefox is happy)
  • no pulseaudio
  • skype still works through apulse

export APULSE_PLAYBACK_DEVICE=plug:duplexPulse

apulse skype

Here is my .asoundrc as it is now

#--------------------------------------------------
# Cards
#--------------------------------------------------
pcm.audiophile {
    type hw
    card 0
}

ctl.audiophile { type hw card 0 }

#--------------------------------------------------

Normal alsa

#-------------------------------------------------- pcm.!default { type plug slave.pcm "duplex" }

pcm.duplex { type asym playback.pcm "ladspa" capture.pcm "dsnooper" }

--- ladspa chain ---

pcm.ladspa { type ladspa slave.pcm "dmixplug" path "/usr/lib/ladspa"; plugins [ { label fastLookaheadLimiter input { #InputGain(Db) Limit (db) Release time (s) controls [ 9 -3 10] }

}]

}

pcm.dmixplug { type plug slave.pcm "dmixer" }

pcm.dmixer { type dmix ipc_key 1234 slave { pcm "audiophile" period_size 1024 buffer_size 4096 rate 44100 } }

pcm.dsnooper { type dsnoop ipc_key 2048 ipc_perm 0666 slave.pcm "audiophile" slave { period_time 0 period_size 1024 buffer_size 4096 rate 44100 } bindings { 0 0 1 1 } }

#--------------------------------------------------

special entries for pulseaudio/apulse

#--------------------------------------------------

pcm.duplexPulse { type asym playback.pcm "dmixerPulse" capture.pcm "dsnooper" }

pcm.dmixerPulse { type dmix ipc_key 1234 slave { pcm "audiophile" period_size 1024 buffer_size 4096 rate 44100 } }