[lang]

Present Perfect

Personal
Projects
Packages
Patches
Presents
Linux

Picture Gallery
Present Perfect

SAlsa

Filed under: Elisa,Hacking — Thomas @ 10:35

2008-08-02
10:35

I'm sure the ALSA guys aren't doing this deliberately, but boy, is it ever not a painful exercise to set your mixer levels and controls correctly ?

Ok, arguably I have a quite complex onboard soundcard, but it's still an onboard soundcard. When you open up alsamixer and see all those labels that don't give you much information, you just get lost. Would it have been that hard for the ALSA guys to make it easier for driver developers to document their stuff ?

My particular onboard card is a VIA 8237 Realtek ALC850, and has coax and SPDIF output. It has controls like Center/LFE (but do they control analog or digital output ? who knows), IEC958 (how many people know that this is SPDIF ?) and IEC958 Output (though it is the former that controls SPDIF output, not the latter, go figure), there's Duplicate Front (I enabled it but strangely enough my computer did not pop out another computer front plate as I expected), and then there is VIA DXS, VIA DXS1, VIA DXS2, and VIA DXS3. And I left out at least two times more controls.

Today I finally figured out how to get my digital output to directly take the PCM data (the actual digital samples) instead of having the digital output take in the Analog Output. But it probably was the most non-obvious ALSA thing I've ever had the non-pleasure of having to do.

There is one control labeled IEC958 Playback AC97-SPSA, which is a level control with only 4 steps (0, 33, 66, 100%). Much like the Mic Input on some webcams I have. Strangely enough, that setting didn't ever seem to affect any volume in my experimentation, but hey, so don't most of the other level controls anyway, so I never looked into it further.

Today, upgrading my media machine from F8 to F9, my obtained-through-careful-random-experimentation asound.state didn't work on F9. So I set out to experiment again and this time, document my settings. Which is when I, completely by accident, tweaked this level control.

And, apparently, setting it to 0% makes the PCM setting on the following switch (IEC958 Playback Source) work and give me completely digital PCM output. Completely puzzled, I started Googling for this card and this setting, and found a close-enough wiki page documenting a previous model and saying this about the setting I tweaked:

f the playback device indicates a link is present, but makes no sound, check the mixer 'IEC958 Playback AC97-SPSA'. The S/PDIF always outputs at full volume - even muting the master or PCM mixers does not affect the S/PDIF volume. The meanings of the settings for 'IEC958 Playback AC97-SPSA' are

0. PCM1
1. PCM2,PCM1 (rear)
2. Centre and LFE
3. PCM3,Modem,Dedicated S/PDIF

Most users will want it set to 0 (PCM1). Some of the 82xx chips have a dedicated S/PDIF port, which is (I assume) accessed by setting it to 3 (Dedicated S/PDIF). The default appears to be 3.

I don't claim to understand much of that explanation, apart from the fact that this is obviously a switch between inputs or outputs and thus affects internal routing.

If I lost you by now, here's the one-line summary: this driver implements a four-state switch with a slider control. And it's not because he wasn't able to figure out switches either - the driver has 6 or more switches for other settings.

This is a control that is labeled such that you can't understand it, with a control that hides what it actually does and suggest it does something else, and controls whether your card works at all. Well done, driver developer guy.

I wish it were me, but hey, I'm an audio engineer, and I set up technical infrastructure for two actual radio stations. That complex 75k euro mixing desk was easier to figure out and program than this simple onboard sound card - and the mixing desk was only programmable in assembler!

I filed this bug - yet another notch on my totem of bugtracker accounts.

4 Comments »

  1. It’s of course easier to understand a professional mixing console. Mixing desks tend to follow a proven layout and signal flow (input, inserts, dynamics, eq, effect/aux, master, busses) and most often have a consistent and agreed-upon nomenclature.

    My onboard audio (intel ich5, it has the same strange 4-state slider as yours) has *30* mixer controls most of which you never want to change (“route LFE/Center to LineOut” or “Swap rear anc LFE/C”), my other soundcard has not only “Record enable” but also “Playback enable” buttons on most channels which strangely most mixer-applications don’t even show (gamix does) but one has to press at least once, default is to *not* *playback* the channels… The new computers we bought at work have “Master”, “Front” and “Headphone” outputs where “Front” controls the frontpanel output where you normally plug in your headphone. “Headphone” controls the read output where the monitor (with built in speakers) is connected. “Master” sends audio to a built in speaker which does not automatically turn off when something is connected to the other jacks…. I probably could go on for hours.

    On one hand, if configured correctly, linux-audio is very stable and technologically advanced, but usability is so incredibly abysmal…

    Comment by Christian Vogel — 2008-08-02 @ 13:54

  2. It’s not just you. ALSA has been like this for years.

    My favourite is when they rename controls between releases for no apparent reason and with no warning. This would be fine if the new names were more sensible, but they’re frequently not.

    I really don’t know what the solution is, though. :\ I think ALSA needs a Consistent and Readable Channel Naming Overlord.

    Comment by Adam Williamson — 2008-08-02 @ 17:47

  3. ‘IEC958 Playback AC97-SPSA’ sets AC97 slot which will be routed to spdif output. I think, default is PCM1 (0), but I think, mixers like kmix or gnome mixer sets (I know only one good working mixer for alsa – alsamixer – console application) some level to all controls they can. If you use spdif alsa device it will set it to 3 automatically and return it back after close.

    Comment by pzad — 2008-08-02 @ 18:16

  4. Adam: I guess part of the problem is that the same sound chipsets get deployed in different ways by different models of motherboards, and conceivable, even, the same motherboard gets deployed in slightly different ways by OEMs (witness Christian’s Headphone/Front confusion above).

    I guess the answer is to take the purportedly “human readable” labels out of the driver and put them into user-space. Then the admin of a machine (or, better, the distro – based on DMI information, where possible, falling back to something that’s likely to be vaguely accurate, but which the user can tweak) can create a file which creates the mapping between the internal ALSA labels and *really* human-readable labels which all compliant audio applications can use.

    Thomas, how does that proposal sound?

    Comment by cowbutt — 2008-08-04 @ 11:22

RSS feed for comments on this post. TrackBack URL

Leave a comment

picture