ALSA: RME Digi96 ADAT as separate stereo outputs

Step-by-Step descriptions of how to do things.

ALSA: RME Digi96 ADAT as separate stereo outputs

Postby ^rooker » Thu Jul 23, 2009 11:42 am

Whoever owns an RME Digi96 soundcard and wants to use its multiple output channels not for multitrack recording/mixing, but as separate stereo outputs in regular applications like mplayer, amarok or any other audio app that handles ALSA, might have stumbled over 2 questions:
1) Where the f**k are these multiple outputs? Don't see anything in my mixer application (e.g. alsamixer)

2) qjackctl shows 8 outputs alright, but how can I use them with a non-jack-aware, plain-alsa application with regular stereo output?



Well, here's how I've handled that situation:

The 8 input/output channels are available as ADAT only. Alsa registers them as hw 0, device 1. The other output "hw0,device0" is the single stereo in/out on the card itself, which is the one that shows up in mixer apps.

If you want to have analog outputs, you require additional hardware to translate the digital ADAT signal into analog. So you can either get an AEB 4/8 extension board from RME (alternative link: thomann product page), or an ADAT converter device from any manufacturer. I'd prefer the 2nd option, since it's compatible to any ADAT capable device.

Now, beautiful but difficult alsa config, makes it possible to provide software mixing controls for those ADAT channels, since the RME card does not provide hardware mixing for ADAT (which makes sense for its intended usage).

The following /etc/asound.conf (or ~/.asoundrc) groups the 8 mono ADAT channels into 4 stereo outputs with software mixing (using alsa's "softvol"). The great thing is, that they actually register as soundcard controls and are therefore listed in any application like regular outputs and volume controls.
Awesome!

This is a copy of our configuration file:
Code: Select all
pcm.snd-card {
         type hw
         card 0
         device 1
}

ctl.snd-card {
         type hw
         card 0
         device 1
}

pcm.dmixer {
    type dmix
    ipc_key 1024
    ipc_perm 0666
    slave.pcm "snd-card"
    slave {
        period_time 1000
        period_size 64
        buffer_size 4096
        rate 44100
        channels 8
    }
    bindings {
        0 0
        1 1
        2 2
        3 3
        4 4
        5 5
        6 6
        7 7
    }
}

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

pcm.stereo1 {
    type plug
    slave {
        pcm "dmixer"
        channels 8
    }
    ttable.0.0 1
    ttable.1.1 1
}

pcm.stereo2 {
    type plug
    slave {
        pcm "dmixer"
        channels 8
    }
    ttable.0.2 1
    ttable.1.3 1
}

pcm.stereo3 {
    type plug
    slave {
        pcm "dmixer"
        channels 8
    }
    ttable.0.4 1
    ttable.1.5 1
}

pcm.stereo4 {
    type plug
    slave {
        pcm "dmixer"
        channels 8
    }
    ttable.0.6 1
    ttable.1.7 1
}

pcm.softvol1 {
    type softvol
    slave {
        pcm         "stereo1"
    }
    control {
        name        "Stereo_1"
        card        0
    }
}

pcm.softvol2 {
    type softvol
    slave {
        pcm         "stereo2"
    }
    control {
        name        "Stereo_2"
        card        0
    }
}


Using the virtual "softvol" channels:
With the above configuration, ALSA is aware of the following new device names:
stereo1
stereo2
stereo3
stereo4
softvol1
softvol2

In order to test the output, you can use the "speaker-test" command:
(Caution: Do not confuse the virtual devices "softvol1" with "stereo1", because using "stereo1" directly will ignore the volume settings adjusted using e.g. alsamixer)
Code: Select all
speaker-test -c 2 -D softvol1


Additional information:
  • If you want to use all 8 ADAT channels as analog outputs, simply copy/paste the "pcm.softvol" blocks and rename them to "stereo3"/"stereo4" respectively. Note: For an "AEB 4-O" expansion board, only 2 stereo channels are physically available.
  • If you have multiple soundcards in your PC and the RME is not the first one, change all lines with "card 0" to the correct value (e.g. "card 1" if it's the 2nd card).
  • Important: it seems that the settings take effect (possibly after calling "/etc/init.d/alsa-utils restart" and the virtual softvol-channels are available - even (!) if they don't show up in alsamixer.
  • 0

Last edited by ^rooker on Fri Feb 05, 2010 2:11 pm, edited 2 times in total.
Reason: Updated link to AEB4-O board and added information for variating setups.
Jumping out of an airplane is not a basic instinct. Neither is breathing underwater. But put the two together and you're traveling through space!
User avatar
^rooker
Site Admin
 
Posts: 1170
Joined: Fri Aug 29, 2003 8:39 pm
Reputation: 0

Re: ALSA: RME Digi96 ADAT as separate stereo outputs

Postby ^rooker » Fri Feb 05, 2010 1:20 pm

During the playing around with asoundrc / alsa.conf (mentioned in the above post), I've encountered the problem that my intermediate test-setup settings produced leftover, zombified channels in alsamixer that kept being restored - even after a reboot. WTF?

It was driving me crazy. Finally I guess I've figured it out, so here's what I've done to reset my settings and get a clean, nice and tidy state:

1) Remove any asoundrc from the user used for testing the setup:
Code: Select all
rm ~/.asoundrc


2) Stop the alsa-utils initialization script:
Code: Select all
/etc/init.d/alsa-utils stop

This calls "alsactl store", which updates the config file "/var/lib/alsa/asound.state" and unfortunately also stores the old, unwanted zombie channels.

3) Remove the kernel module of the affected soundcard.
In our case, it was an "RME DIGI 96/8 PAD", so the module is "snd_rme96":
Code: Select all
modprobe -r snd_rme96


4) Modify the alsactl settings in "/var/lib/alsa/asound.state" and remove the zombie channels.
For each virtual "softvol" channel added in order to use the ADAT 8-channel outputs as individual stereo channels (see above posting), you will find an entry like this:
Code: Select all
control.11 {
           comment.access 'read write user'
           comment.type INTEGER
           comment.count 2
           comment.range '0 - 255'
           comment.tlv '0000000100000008ffffec1400000014'
           comment.dbmin -5100
           comment.dbmax 0
           iface MIXER
           name Stereo_1
           value.0 255
           value.1 255
}

Note: In our setup, all values except "name" and "value.[0|1]" (=volume left/right) were exactly the same for each virtual channel.

Now, reload the kernel module and start the alsa-utils script again in order to reset the system to a valid state:
Code: Select all
modprobe snd_rme96
/etc/init.d/alsa-utils start


If you open "alsamixer" now, you should only see the virtual "softvol"-Channels and no more leftovers. Voila!
  • 0

Jumping out of an airplane is not a basic instinct. Neither is breathing underwater. But put the two together and you're traveling through space!
User avatar
^rooker
Site Admin
 
Posts: 1170
Joined: Fri Aug 29, 2003 8:39 pm
Reputation: 0


Return to HowTo's

Who is online

Users browsing this forum: No registered users and 1 guest

Who is online over last 24 hours

Users browsed this forum in the last 24 hours: No registered users and 3 guests

cron
Reputation System ©'