* Re: software mixing in alsa
2005-05-17 20:27 ` Valdis.Kletnieks
@ 2005-05-17 20:36 ` Lee Revell
2005-05-18 13:32 ` Karel Kulhavy
2005-05-18 6:30 ` ross
2005-05-18 13:48 ` Takashi Iwai
2 siblings, 1 reply; 25+ messages in thread
From: Lee Revell @ 2005-05-17 20:36 UTC (permalink / raw)
To: Valdis.Kletnieks; +Cc: Karel Kulhavy, linux-kernel
On Tue, 2005-05-17 at 16:27 -0400, Valdis.Kletnieks@vt.edu wrote:
> On Tue, 17 May 2005 21:24:12 +0200, Karel Kulhavy said:
> > Lee Revell wrote:
> >
> > > Finally, these questions are all OT for LKML. Try alsa-user at
> > > lists.sf.net and alsa-devel at lists.sf.net. Also there's a bug
> >
> > ALSA is a part of Linux kernel, right? This is linux-kernel. Why
> > is it OT here? Doesn't make sense for me.
>
> I was hoping somebody would explain how to get 'dmix' plugin working in the
> kernel - then I could get rid of esd ;) (Note that running something in
> userspace that accepts connections, runs dmix on them, and then creates one
> thing spewing to /dev/pcm isn't a solution - I've already *got* esd, warts and all)
I don't understand your message very well. The dmix plugin is part of
alsa-lib, which is part of userspace. From the application's point of
view, it does not matter whether the mixing happens in kernel or not.
ALSA follows the philosophy of doing as little as possible in the
kernel, and since mixing and volume control work fine in userspace,
that's where they live.
Lee
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: software mixing in alsa
2005-05-17 20:36 ` Lee Revell
@ 2005-05-18 13:32 ` Karel Kulhavy
2005-05-18 13:53 ` Jaroslav Kysela
0 siblings, 1 reply; 25+ messages in thread
From: Karel Kulhavy @ 2005-05-18 13:32 UTC (permalink / raw)
To: Lee Revell; +Cc: linux-kernel
On Tue, May 17, 2005 at 04:36:30PM -0400, Lee Revell wrote:
[...]
> alsa-lib, which is part of userspace. From the application's point of
> view, it does not matter whether the mixing happens in kernel or not.
> ALSA follows the philosophy of doing as little as possible in the
> kernel, and since mixing and volume control work fine in userspace,
> that's where they live.
Mixing is IMHO action that should be in kernel because
1) needs realtime scheduling to keep latency down
2) needs tight cooperation with the hardware to prevent dropouts
on underruns
3) Is a trivial linear algorithm involving memory blocks and linear
arithmetic, no complicated computations that are difficult to
check for BugFree(TM) so shouldn't present a great risk on kernel
stability
4) Fits into the kernel philosophy. Kernel is a program meant to provide
time-sharing access to limited hardware resource. Sound card is a
limited hardware resource.
5) From the knowledge of the exact hardware, the mixing routine in
kernel can know maximum allowable levels etc. to prevent clipping.
CL<
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: software mixing in alsa
2005-05-18 13:32 ` Karel Kulhavy
@ 2005-05-18 13:53 ` Jaroslav Kysela
2005-05-18 17:47 ` Lee Revell
0 siblings, 1 reply; 25+ messages in thread
From: Jaroslav Kysela @ 2005-05-18 13:53 UTC (permalink / raw)
To: Karel Kulhavy; +Cc: Lee Revell, linux-kernel
On Wed, 18 May 2005, Karel Kulhavy wrote:
> On Tue, May 17, 2005 at 04:36:30PM -0400, Lee Revell wrote:
>
> [...]
>
> > alsa-lib, which is part of userspace. From the application's point of
> > view, it does not matter whether the mixing happens in kernel or not.
> > ALSA follows the philosophy of doing as little as possible in the
> > kernel, and since mixing and volume control work fine in userspace,
> > that's where they live.
>
> Mixing is IMHO action that should be in kernel because
>
> 1) needs realtime scheduling to keep latency down
With a realtime scheduler and properly written drivers (no "schedule"
gaps) you'll reach same results. For x86 we use special instructions like
xchg and locking-free algorithm in dmix, so the latency is SAME for all
concurent apps with minimal overhead..
> 2) needs tight cooperation with the hardware to prevent dropouts
> on underruns
Yes, but having the code which computes something in interrupt is not
sane.
> 3) Is a trivial linear algorithm involving memory blocks and linear
> arithmetic, no complicated computations that are difficult to
> check for BugFree(TM) so shouldn't present a great risk on kernel
> stability
You need to write complete new virtual layer or use a new special driver
which connect to real soundcard. Thats a lot of new code - it's better to
do it safely in the user space.
> 4) Fits into the kernel philosophy. Kernel is a program meant to provide
> time-sharing access to limited hardware resource. Sound card is a
> limited hardware resource.
Why X drivers aren't in kernel, too? Because they're big and kernel should
drive the real bottom of hardware (interrupts, DMA, memory mapping), but
abstraction (which sound mixing _IS_) should be implemented in the user
space. Otherwise we will end up with a huge kernel implementing nearly
everything...
> 5) From the knowledge of the exact hardware, the mixing routine in
> kernel can know maximum allowable levels etc. to prevent clipping.
You can obtain all necessary info in the userspace as well.
We should definitely fix the dmix bugs. Or, if you want, you might buy
an accelerated soundcard which supports multiple streams in hardware.
Jaroslav
-----
Jaroslav Kysela <perex@suse.cz>
Linux Kernel Sound Maintainer
ALSA Project, SUSE Labs
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: software mixing in alsa
2005-05-18 13:53 ` Jaroslav Kysela
@ 2005-05-18 17:47 ` Lee Revell
0 siblings, 0 replies; 25+ messages in thread
From: Lee Revell @ 2005-05-18 17:47 UTC (permalink / raw)
To: Jaroslav Kysela; +Cc: Karel Kulhavy, linux-kernel
On Wed, 2005-05-18 at 15:53 +0200, Jaroslav Kysela wrote:
> On Wed, 18 May 2005, Karel Kulhavy wrote:
>
> > On Tue, May 17, 2005 at 04:36:30PM -0400, Lee Revell wrote:
> >
> > [...]
> >
> > > alsa-lib, which is part of userspace. From the application's point of
> > > view, it does not matter whether the mixing happens in kernel or not.
> > > ALSA follows the philosophy of doing as little as possible in the
> > > kernel, and since mixing and volume control work fine in userspace,
> > > that's where they live.
> >
> > Mixing is IMHO action that should be in kernel because
> >
> > 1) needs realtime scheduling to keep latency down
>
> With a realtime scheduler and properly written drivers (no "schedule"
> gaps) you'll reach same results. For x86 we use special instructions like
> xchg and locking-free algorithm in dmix, so the latency is SAME for all
> concurent apps with minimal overhead..
Also doing it in userspace lets us use SSE/MMX.
Lee
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: software mixing in alsa
2005-05-17 20:27 ` Valdis.Kletnieks
2005-05-17 20:36 ` Lee Revell
@ 2005-05-18 6:30 ` ross
2005-05-18 8:42 ` Lee Revell
` (2 more replies)
2005-05-18 13:48 ` Takashi Iwai
2 siblings, 3 replies; 25+ messages in thread
From: ross @ 2005-05-18 6:30 UTC (permalink / raw)
To: Valdis.Kletnieks; +Cc: Karel Kulhavy, Lee Revell, linux-kernel
On Tue, May 17, 2005 at 04:27:44PM -0400, Valdis.Kletnieks@vt.edu wrote:
> I was hoping somebody would explain how to get 'dmix' plugin working in the
> kernel - then I could get rid of esd ;) (Note that running something in
> userspace that accepts connections, runs dmix on them, and then creates one
> thing spewing to /dev/pcm isn't a solution - I've already *got* esd, warts and all)
In all honesty - don't bother. esd does the job better, faster, more
flexibly, and without the hassle.
I have spent many hours attempting to get a usable dmix setup working
and I just don't think its possible (at least not with my hardware).
I use esd for all "consumer" level audio apps, and jackd for all
professional audio apps. This is by far the simplest way to manage
audio - I wouldn't waste your time with dmix. After all, what could
you do with dmix that you can't do with esd??
--
Ross Vandegrift
ross@lug.udel.edu
"The good Christian should beware of mathematicians, and all those who
make empty prophecies. The danger already exists that the mathematicians
have made a covenant with the devil to darken the spirit and to confine
man in the bonds of Hell."
--St. Augustine, De Genesi ad Litteram, Book II, xviii, 37
^ permalink raw reply [flat|nested] 25+ messages in thread* Re: software mixing in alsa
2005-05-18 6:30 ` ross
@ 2005-05-18 8:42 ` Lee Revell
2005-05-18 13:21 ` Karel Kulhavy
2005-05-18 13:50 ` Nix
2 siblings, 0 replies; 25+ messages in thread
From: Lee Revell @ 2005-05-18 8:42 UTC (permalink / raw)
To: ross; +Cc: Valdis.Kletnieks, Karel Kulhavy, linux-kernel
On Wed, 2005-05-18 at 02:30 -0400, ross@lug.udel.edu wrote:
> On Tue, May 17, 2005 at 04:27:44PM -0400, Valdis.Kletnieks@vt.edu wrote:
> > I was hoping somebody would explain how to get 'dmix' plugin working in the
> > kernel - then I could get rid of esd ;) (Note that running something in
> > userspace that accepts connections, runs dmix on them, and then creates one
> > thing spewing to /dev/pcm isn't a solution - I've already *got* esd, warts and all)
>
>
> In all honesty - don't bother. esd does the job better, faster, more
> flexibly, and without the hassle.
>
This problem is fixed with the upcoming ALSA 1.0.9 release - dmix will
"just work". It's been a big area of development lately.
Lee
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: software mixing in alsa
2005-05-18 6:30 ` ross
2005-05-18 8:42 ` Lee Revell
@ 2005-05-18 13:21 ` Karel Kulhavy
2005-05-18 13:50 ` Nix
2 siblings, 0 replies; 25+ messages in thread
From: Karel Kulhavy @ 2005-05-18 13:21 UTC (permalink / raw)
To: ross; +Cc: linux-kernel
On Wed, May 18, 2005 at 02:30:14AM -0400, ross@jose.lug.udel.edu wrote:
> On Tue, May 17, 2005 at 04:27:44PM -0400, Valdis.Kletnieks@vt.edu wrote:
> > I was hoping somebody would explain how to get 'dmix' plugin working in the
> > kernel - then I could get rid of esd ;) (Note that running something in
> > userspace that accepts connections, runs dmix on them, and then creates one
> > thing spewing to /dev/pcm isn't a solution - I've already *got* esd, warts and all)
>
>
> In all honesty - don't bother. esd does the job better, faster, more
> flexibly, and without the hassle.
Is there some generic in-kernel support for mixing? I couldn't make
any of the userspace programs work.
I tried esd and it does the same as without esd - only one app gets to
the sound and the other waits. The only difference was only (horrible)
increase in sound latency.
Installed esd in gentoo by emerge, then added into the startiup scripts,
/etc/init.d/esd start, switched xmms over to esd and skype on start said
"using esd".
I would like to just run two sound programs concurrently. (Linux is a
time-sharing operating system, right?) I am not interested in a delay
line sound effect.
I also tried artsd and jack, but didn't succeed too.
CL<
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: software mixing in alsa
2005-05-18 6:30 ` ross
2005-05-18 8:42 ` Lee Revell
2005-05-18 13:21 ` Karel Kulhavy
@ 2005-05-18 13:50 ` Nix
2 siblings, 0 replies; 25+ messages in thread
From: Nix @ 2005-05-18 13:50 UTC (permalink / raw)
To: ross; +Cc: linux-kernel
On 18 May 2005, ross@lug.udel.edu uttered the following:
> I use esd for all "consumer" level audio apps, and jackd for all
> professional audio apps. This is by far the simplest way to manage
> audio
In my experience, polypaudio replaces esd with something both simpler
and more powerful. (Oh, and without esd's *horrible* stutter,
interruption, mis-authentication, and code cleanliness problems.)
(For the professional stuff there is no replacement for JACK, I agree.)
--
`End users are just test loads for verifying that the system works, kind of
like resistors in an electrical circuit.' - Kaz Kylheku in c.o.l.d.s
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: software mixing in alsa
2005-05-17 20:27 ` Valdis.Kletnieks
2005-05-17 20:36 ` Lee Revell
2005-05-18 6:30 ` ross
@ 2005-05-18 13:48 ` Takashi Iwai
2005-05-18 14:38 ` Pierre Ossman
2 siblings, 1 reply; 25+ messages in thread
From: Takashi Iwai @ 2005-05-18 13:48 UTC (permalink / raw)
To: Valdis.Kletnieks; +Cc: Karel Kulhavy, Lee Revell, linux-kernel
At Tue, 17 May 2005 16:27:44 -0400,
Valdis.Kletnieks@vt.edu wrote:
>
> On Tue, 17 May 2005 21:24:12 +0200, Karel Kulhavy said:
> > Lee Revell wrote:
> >
> > > Finally, these questions are all OT for LKML. Try alsa-user at
> > > lists.sf.net and alsa-devel at lists.sf.net. Also there's a bug
> >
> > ALSA is a part of Linux kernel, right? This is linux-kernel. Why
> > is it OT here? Doesn't make sense for me.
>
> I was hoping somebody would explain how to get 'dmix' plugin working in the
> kernel - then I could get rid of esd ;)
esd is working fine together with dmix. You should try the latest
versions (of esd and alsa-lib). The old version of esd might have a
bug.
arts had a problem, but got fixed in the recent version of alsa-lib.
Takashi
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: software mixing in alsa
2005-05-18 13:48 ` Takashi Iwai
@ 2005-05-18 14:38 ` Pierre Ossman
2005-05-18 18:25 ` Lee Revell
2005-05-19 15:10 ` Valdis.Kletnieks
0 siblings, 2 replies; 25+ messages in thread
From: Pierre Ossman @ 2005-05-18 14:38 UTC (permalink / raw)
To: Takashi Iwai; +Cc: Valdis.Kletnieks, Karel Kulhavy, Lee Revell, linux-kernel
Takashi Iwai wrote:
>
> esd is working fine together with dmix. You should try the latest
> versions (of esd and alsa-lib). The old version of esd might have a
> bug.
>
I'd beg to differ. I have to apply the patch made by you to avoid
getting a lot of distortions with esound and dmix:
http://bugzilla.gnome.org/show_bug.cgi?id=140803
Checking in the cvs, this still hasn't been commited.
Rgds
Pierre
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: software mixing in alsa
2005-05-18 14:38 ` Pierre Ossman
@ 2005-05-18 18:25 ` Lee Revell
2005-05-19 15:10 ` Valdis.Kletnieks
1 sibling, 0 replies; 25+ messages in thread
From: Lee Revell @ 2005-05-18 18:25 UTC (permalink / raw)
To: Pierre Ossman; +Cc: Takashi Iwai, Valdis.Kletnieks, Karel Kulhavy, linux-kernel
On Wed, 2005-05-18 at 16:38 +0200, Pierre Ossman wrote:
> Takashi Iwai wrote:
> >
> > esd is working fine together with dmix. You should try the latest
> > versions (of esd and alsa-lib). The old version of esd might have a
> > bug.
> >
>
> I'd beg to differ. I have to apply the patch made by you to avoid
> getting a lot of distortions with esound and dmix:
>
> http://bugzilla.gnome.org/show_bug.cgi?id=140803
>
> Checking in the cvs, this still hasn't been commited.
You really need to bug the Gnome developers about it. Takashi-san
posted the patch in January, and the bug is still listed as NEW.
Lee
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: software mixing in alsa
2005-05-18 14:38 ` Pierre Ossman
2005-05-18 18:25 ` Lee Revell
@ 2005-05-19 15:10 ` Valdis.Kletnieks
1 sibling, 0 replies; 25+ messages in thread
From: Valdis.Kletnieks @ 2005-05-19 15:10 UTC (permalink / raw)
To: Pierre Ossman; +Cc: Takashi Iwai, Karel Kulhavy, Lee Revell, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 469 bytes --]
On Wed, 18 May 2005 16:38:01 +0200, Pierre Ossman said:
> I'd beg to differ. I have to apply the patch made by you to avoid
> getting a lot of distortions with esound and dmix:
>
> http://bugzilla.gnome.org/show_bug.cgi?id=140803
>
> Checking in the cvs, this still hasn't been commited.
I owe Takashi a beer for creating the patch, and Pierre for bringing it
to my attention - it solves the issue I was seeing on Fedora Core where
alsa 1.0.9rc2 was hosing up esd.
[-- Attachment #2: Type: application/pgp-signature, Size: 226 bytes --]
^ permalink raw reply [flat|nested] 25+ messages in thread