LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 07-31-2010, 11:11 AM   #1
knobby67
Member
 
Registered: Mar 2006
Posts: 536

Rep: Reputation: 42
play multiple sound streams on ALSA dmix


Hi all,
I'm having trouble getting ALSA to play multiple sound streams (multiple sounds at once). My code is running on an embedded ARM board using a AC97 sound. It will only play one without any mixing, I have to use pure ALSA as higher sound mixers are a nightmare to cross compile for ARM.

I've tested my system with aplay for example

aplay -D plughw:0,1 bang.wav

works fine. So I tried dmix with

aplay -D plug:dmix Win.wav

That gave the following error

ALSA lib pcm_direct.c:1587snd_pcm_direct_parse_open_conf) The field ipc_gid must be a valid group (create group audio)

aplay: main:550: audio open error: Invalid argument


I checked asound with
/etc # cat asound.conf


pcm.EP93XX {

type hw

card 0

device 0

mmap_emulation on

}

pcm_slave.multi2 {

pcm EP93XX

channels 2

}



pcm_slave.multi4 {

pcm EP93XX

channels 4

}



pcm_slave.multi6 {

pcm EP93XX

channels 6

}



pcm.channels2 {

type plug

slave multi2

route_policy "duplicate"

}





pcm.channels4 {

type plug

slave multi4

route_policy "duplicate"

}



pcm.channels6 {

type plug

slave multi6

route_policy "duplicate"

}



no sign of dmix, when I check my version ect I can see

/proc/asound # cat pcm version


Advanced Linux Sound Architecture Driver Version 1.0.14rc1 (Tue Jan 09 09:56:17 2007 UTC).



/proc/asound # cat default cards


0 [default ]: CS4271 - Cirrus Logic I2S Audio

Cirrus Logic I2S Audio with CS4271




Does this mean dmix will not work? Is there someway with the above setup I can play multiple sounds?
I have to use the vendor ALSA build (so can't update ALSA), I can change the .confs however. Also because I'm cross compiling things like pulseaudio SDL are very difficult to get working, so I basically need to use the above ALSA. Is there anyway I can find if dmix exists on the system?

Should add aplay -L does show dmix ?
iec958 'cards.pcm.iec958'

spdif 'cards.pcm.iec958'

modem 'cards.pcm.modem'

phoneline 'cards.pcm.phoneline'

default 'cards.pcm.default'

dmix 'cards.pcm.dmix'

dsnoop 'cards.pcm.dsnoop'



Thanks!

Last edited by knobby67; 07-31-2010 at 11:30 AM.
 
Old 07-31-2010, 01:11 PM   #2
jlinkels
Senior Member
 
Registered: Oct 2003
Location: Bonaire
Distribution: Debian Lenny/Squeeze/Wheezy/Sid
Posts: 4,067

Rep: Reputation: 491Reputation: 491Reputation: 491Reputation: 491Reputation: 491
Quote:
Originally Posted by knobby67 View Post
aplay -D plughw:0,1 bang.wav
The nature of ALSA is that it is a server, and that you can send multiple streams at the same time. ALSA takes care of mixing. What happens if you start two processes at the same time, both addressing the same device? I.e.:
Code:
aplay -D plughw:0,1 bang.wav &
aplay -D plughw:0,1 harderbang.wav
I am not surprised that the device dmix is not accepted, it does not exist. Check that with aplay -L and aplay -l

jlinkels
 
Old 07-31-2010, 06:51 PM   #3
knobby67
Member
 
Registered: Mar 2006
Posts: 536

Original Poster
Rep: Reputation: 42
Hi yep did aplay -L (bottom of my post) it seems to show dmix, but I have no idea how to access it? Or even if it is accessible or it's indicatiing dmix is present? I've tried to check all ALSA mans but can't fully find an explination.




Should add aplay -L does show dmix ?
iec958 'cards.pcm.iec958'

spdif 'cards.pcm.iec958'

modem 'cards.pcm.modem'

phoneline 'cards.pcm.phoneline'

default 'cards.pcm.default'

dmix 'cards.pcm.dmix'

dsnoop 'cards.pcm.dsnoop'



I've tried to access 2 processes at once with the ampersand switch on aplay, however I can't access command prompt until sound has stopped.
 
Old 07-31-2010, 07:14 PM   #4
jlinkels
Senior Member
 
Registered: Oct 2003
Location: Bonaire
Distribution: Debian Lenny/Squeeze/Wheezy/Sid
Posts: 4,067

Rep: Reputation: 491Reputation: 491Reputation: 491Reputation: 491Reputation: 491
You are right, missed that one.

But then again, this is not exactly the standard output for aplay -L. Check that on your regular desktop and you see a lot of difference. Also, dmix is not usually one of them.

I can't imagine why you cannot access the command line again after you backgrounded your job.

I am beginning to think that you have a heavily modified Linux system which does not behave as a standard system. That renders me incapable of giving some useful advice, sorry.

jlinkels
 
Old 10-06-2011, 12:37 PM   #5
matthewpiatt
LQ Newbie
 
Registered: Oct 2011
Posts: 1

Rep: Reputation: Disabled
if you look closely at the program output, you will see at the end, it tells you exactly what to do:

ALSA lib pcm_direct.c:1587snd_pcm_direct_parse_open_conf) The field ipc_gid must be a valid group (create group audio)

check the output of ls -al /dev/snd/. who is the group owner? in the end, it needs to match a line in your /usr/share/alsa/alsa.conf. if the owner is root, go into /usr/share/alsa/alsa.conf - change defaults.pcm.ipc_gid audio to defaults.pcm.ipc_gid root

you will notice if you run ls -al /dev/snd the group owner is audio, so i didn't have to change mine.

Code:
$ ls -al /dev/snd/                      
total 0
drwxr-xr-x   2 root root      220 2011-09-27 10:30 .
drwxr-xr-x  16 root root    13980 2011-10-05 17:51 ..
crw-rw----+  1 root audio 116,  5 2011-09-27 10:30 controlC0
crw-rw----+  1 root audio 116,  8 2011-09-27 10:30 controlC1
crw-rw----+  1 root audio 116,  4 2011-09-27 10:30 hwC0D0
crw-rw----+  1 root audio 116,  7 2011-09-27 10:30 hwC1D0
crw-rw----+  1 root audio 116,  3 2011-10-04 14:44 pcmC0D0c
crw-rw----+  1 root audio 116,  2 2011-10-05 17:32 pcmC0D0p
crw-rw----+  1 root audio 116,  6 2011-09-27 10:30 pcmC1D3p
crw-rw----+  1 root audio 116,  1 2011-09-27 10:30 seq
crw-rw----+  1 root audio 116, 33 2011-09-27 10:30 timer

Last edited by matthewpiatt; 10-06-2011 at 12:40 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Multiple Sound Streams in Debian Etch richinsc Debian 1 09-29-2008 11:19 AM
Can not play multiple audio streams Waqas Ahsan Mandriva 0 10-10-2006 02:17 PM
Sound Issues (Crackle) with Enemy Territory, Alsa-OSS and DMIX hitman_et Linux - Software 13 04-15-2006 07:07 AM
Are sound chips capable of multiple sound streams? SGFHK321 Linux - Hardware 1 07-29-2004 04:26 PM
alsa not letting me play multiple sounds. e1000 Linux - Hardware 5 05-01-2004 08:02 PM


All times are GMT -5. The time now is 02:09 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration