Skip to contentSkip to conversation

Is it time for remove (crap) ALSA from kernel tree ?

DISCUSSION Andreas Hartmetz 6 participants 6 messages Jun 26, 2007 – Jun 28, 2007

lore
Share & tools
lore
#0 lore raw
Quoted 4 lines
Quoted 3 lines

We dropped OSS for ALSA for technical reasons. Those being that ALSA
- has a better audio API

Quoted 8 lines

You mean the undocumented, 100% ioctl one? With one ioctl to write interleaved sound, one for non-interleaved sound, in addition to setting interleaved or not in the configuration? I should check one day which one wins.

Or the "library"? Don't get me started on this one.

I take your word about the fact that the kernel side is better.

Okay, here's a rant.

As an interested kernel outsider and KDE developer(*), it looks to me like most kernel people are too focused on the history and feature lists of the particular technologies here.

The real matter with ALSA is that you get a strong "ALSA hates me" feeling when dealing with it. There is bad documentation, bad API, and a config file syntax that is much harder to understand than necessary.

Then there is the kernel/library split that seems to have no convincing reason at all in its current form.
Why not put the whole sound system in userland? It has been done before. Sound is just not performance critical at all and it's almost never mission critical.
Plus you wouldn't have to cross the userland/kernel gap to implement new and exciting things that way. Audio is kinda simple on the IO level (I hope I'm right there :) ) and, ideally, on the userland API level. These places are exactly where well-defined interfaces should be. An appropriate IO interface and userland API should be set in stone, not something arbitrary in between. Hell, there could even be a source compatible sound driver standard for all Unix-like free OS kernels.

The track record of ALSA for me goes like this:

- dmix finally started working automatically (at least on my Kubuntu system) about one year ago, about five years after everybody could see that this was badly needed. I couldn't get it to work before. The howtos somehow didn't work and ALSA's documentation isn't all that helpful.

- Different desktop environments have different sound daemons to paper over the weaknesses of ALSA (no dmix by default / unfriendly API), which creates new problems. Yes there are other reasons for sound daemons, but I doubt anybody would have come up with the idea if it wasn't for ALSA.

- I have an Envy24HT based soundcard in my desktop PC, which also goes to show that I'm really interested in sound issues. I have to run alsamixer after every bootup to unmute the left channel because restoring volume only works for the right channel. The left channel starts working after changing its volume.

- On my IBM/Lenovo R50e notebook with Intel chipset sound didn't work before I "muted" the "headphone jack sense" control in alsamixer. That took two hours or so. When both the master volume and the PCM volume control are set to 100% I get really bad clipping problems.

- Some time ago ALSA reported that my soundcard supports sampling rates it doesn't in fact support. This was fixed by Takashi Iwai after a week and two mails or so. Thumbs up.

Regards,
Andreas

(*) I am not representing KDE in an official way at all, but I can say that KDE developers generally put *much* effort into making APIs as logical and friendly as they possibly can.

#1 lore raw
Quoted 6 lines · Andreas Hartmetz

The track record of ALSA for me goes like this:

- dmix finally started working automatically (at least on my Kubuntu system) about one year ago, about five years after everybody could see that this was badly needed. I couldn't get it to work before. The howtos somehow didn't work and ALSA's documentation isn't all that helpful.

I don't remember when it happened, but I do remember that I suddenly had to manually disable dmix to stop it messing around with my sound. I don't need it, and I certainly don't like libraries doing random IPC behind my back.

Quoted 5 lines

- Different desktop environments have different sound daemons to paper over the weaknesses of ALSA (no dmix by default / unfriendly API), which creates new problems. Yes there are other reasons for sound daemons, but I doubt anybody would have come up with the idea if it wasn't for ALSA.

Those sound daemons were around long before ALSA was even conceived.

Quoted 5 lines

- I have an Envy24HT based soundcard in my desktop PC, which also goes to show that I'm really interested in sound issues. I have to run alsamixer after every bootup to unmute the left channel because restoring volume only works for the right channel. The left channel starts working after changing its volume.

That sounds like a minor glitch that should be easily remedied if you file a proper bug report. Have you tried?

Quoted 5 lines

- On my IBM/Lenovo R50e notebook with Intel chipset sound didn't work before I "muted" the "headphone jack sense" control in alsamixer. That took two hours or so. When both the master volume and the PCM volume control are set to 100% I get really bad clipping problems.

Shoddy hardware. Don't blame the drivers for that.

Quoted 3 lines

- Some time ago ALSA reported that my soundcard supports sampling rates it doesn't in fact support. This was fixed by Takashi Iwai after a week and two mails or so. Thumbs up.

Yes, API and configuration file syntax aside, the ALSA developers are always friendly and responsive.

Quoted 3 lines

(*) I am not representing KDE in an official way at all, but I can say that KDE developers generally put *much* effort into making APIs as logical and friendly as they possibly can.

I've still not, after all these years, managed to figure out what KDE (or Gnome) is supposed to be good for. I'm not missing anything from my window manager, xterm and xemacs setup.

Signature · 2 lines
Måns Rullgård
[email protected]
#2 lore raw
In reply to Andreas Hartmetz
Quoted 9 lines · Andreas Hartmetz

Okay, here's a rant.

As an interested kernel outsider and KDE developer(*), it looks to me like most kernel people are too focused on the history and feature lists of the particular technologies here.

The real matter with ALSA is that you get a strong "ALSA hates me" feeling when dealing with it. There is bad documentation, bad API, and a config file syntax that is much harder to understand than necessary.

I'll agree to the documentation bit; the funny thing is that it's partly caused by documentation actually being, or once having been, _better_ than it is for the average subsystem. ALSA for example has the useful "Writing an ALSA Driver" document from Takashi Iwai:

http://www.alsa-project.org/~iwai/writing-an-alsa-driver/index.html

Documentation becomes obsolete as code progresses though and yes, especially on the userside of things the documentation is slow to follow. And then the usual problem of noone ever removing obsolete junk from the web exacerbates matters. Google will find you tons of useless, outdated crap but if you need the information in the first place, you don't know that it _is_ obsolete.

And yes, this unfortunately includes www.alsa-project.org. For the longest time it was advocating writing ~/.asoundrc files for example through generic driver boilerplate texts while that was actually at that point mostly counter productive in getting ALSA functional.

As to the config file -- well, sure. The best thing about is that normally you don't need it...

The "bad API" I find interesting since you are a KDE developer. I'm not an audio application developer myself so I don't have (m)any well thought out opinions on it, but isn't the only thing in KDE4 that talks to ALSA the Phonon ALSA backend? If you are talking in that context, I'm quite sure the alsa-user and/or alsa-devel lists (@alsa-project.org) would like to hear about any specific comments/problems. Getting the Phonon backend right from the start is something that seems important.

Quoted 4 lines

Then there is the kernel/library split that seems to have no convincing reason at all in its current form. Why not put the whole sound system in userland? It has been done before. Sound is just not performance critical at all and it's almost never mission critical

Heh. Sound may not be, but audio is. For the longest time, audio users stuck with 2.4 kernels and the low-latency patches that were availabe for it due to latency issues. Large parts of ALSA already are in userland in the form of libasound and I expect moving over everything would not so much help.

[ ... ]

Quoted 6 lines

The track record of ALSA for me goes like this:

- dmix finally started working automatically (at least on my Kubuntu system) about one year ago, about five years after everybody could see that this was badly needed. I couldn't get it to work before. The howtos somehow didn't work and ALSA's documentation isn't all that helpful.

dmix was really only implemented (or at least, made default) for casual users. Hope it'll not come across as elitist but people who are serious about music or audio don't actually need or want it. It's a consumer thing. To have software mixing work you have to resample to a common rate and this an absolute unthinkable horror to a serious user. It's a good thing it's now default, but only because a majority of sound users is not serious (simply because it's mostly all computer users).

Quoted 4 lines

- Different desktop environments have different sound daemons to paper over the weaknesses of ALSA (no dmix by default / unfriendly API), which creates new problems. Yes there are other reasons for sound daemons, but I doubt anybody would have come up with the idea if it wasn't for ALSA.

Given that they existed before ALSA did this seems to be a somewhat odd doubt.

Quoted 2 lines

- I have an Envy24HT based soundcard in my desktop PC, which also goes to show that I'm really interested in sound issues.

Nice chip. I don't have one, and am not too sure about its native supported rates but if you are mostly playing 44100 through it (ie, CD source audio) I'd consider doing without dmix. A nice sounding chip like that shouldn't be subjected to resampling really. Someone recently informed me on the ALSA list that Envy24 indeed doesn't do hardware mixing though, so I guess you may need it if you really do want the also have the card available for desktop sounds.

Quoted 3 lines

I have to run alsamixer after every bootup to unmute the left channel because restoring volume only works for the right channel. The left channel starts working after changing its volume.

Sounds like a rather debugable problem. I'm (almost) sure someone will try to get you a useful answer if you post to the [email protected] list :)

Quoted 4 lines

- On my IBM/Lenovo R50e notebook with Intel chipset sound didn't work before I "muted" the "headphone jack sense" control in alsamixer. That took two hours or so. When both the master volume and the PCM volume control are set to 100% I get really bad clipping problems.

First problem I don't know about but is no doubt related to alsa developers not having proper documentation. On lots of hardware, there's many bits to flip, with no information from the manufacturer forthcoming. You can't hold that against ALSA so much.

As to the second bit -- most cards mame any audio that passes through them when you set a volume to above 0 dB. dB scales were recently implemented for many drivers. If also for yours, I expect 100% is more than 0 dB?

Quoted 3 lines

- Some time ago ALSA reported that my soundcard supports sampling rates it doesn't in fact support. This was fixed by Takashi Iwai after a week and two mails or so. Thumbs up.

Yes, Takashi Iwai is very responsive.

Quoted 3 lines

(*) I am not representing KDE in an official way at all, but I can say that KDE developers generally put *much* effort into making APIs as logical and friendly as they possibly can.

Not so much that I'm likely to be of great help myself, not being an audio application developer, but if there's any problem's with the new KDE4 stuff in relation to ALSA, I hope you or someone else will bring them up on the alsa list(s)...

Rene.

#3 lore raw
In reply to Andreas Hartmetz
Quoted 3 lines · Andreas Hartmetz

Why not put the whole sound system in userland? It has been done before. Sound is just not performance critical at all and it's almost never mission critical.

There are dozens of companies selling Linux powered professional audio gear, multiple pro audio centric distros, and hundreds of serious free software audio apps. I suspect these developers and their users would disagree.

I agree with you about userland drivers but at minimum this would require merging the -rt kernel patches, otherwise the latency/jitter will be too high to do anything but toy desktop sounds, then you need a mergeable mechanism for doing DMA and interrupt handling in userspace. It has been attempted before but never evolved to the point where you could drive a complex device like the emu10k1.

Lee

#4 lore raw
Quoted 9 lines · Lee Revell
Quoted 3 lines · Andreas Hartmetz

Why not put the whole sound system in userland? It has been done before. Sound is just not performance critical at all and it's almost never mission critical.

There are dozens of companies selling Linux powered professional audio gear, multiple pro audio centric distros, and hundreds of serious free software audio apps. I suspect these developers and their users would disagree.

OK .. hundreds.
Can you list ten ?
Can you point to oppinions of this people about ALSA ?

kloczek

Signature · 4 lines
-----------------------------------------------------------
*Ludzie nie mają problemów, tylko sobie sami je stwarzają*
-----------------------------------------------------------
Tomasz Kłoczko, sys adm @zie.pg.gda.pl|*e-mail: [email protected]*
#5 lore raw

Our developers chose ALSA over OSS as the sound API for a VOIP-like fullduplex application and one of the reasons was API - OSS mixer API was not flexible enough (something to do with separating muting and volume control IIRC).

Signature · 1 line
Meelis Roos