View Full Version : ALSA software mixing (one program sound only bug)
Jman
30th June 2004, 01:22 PM
Try playing multiple sounds at once. Chances are it won't work, and you will only hear one. One program gets exclusive access to the sound device.
The solution is software mixing. ALSA sound makes this possible, but you have to enable it. Put this in your /etc/asound.conf file:
pcm.!default {
type plug
slave.pcm "swmixer"
}
pcm.swmixer {
type dmix
ipc_key 1234
slave {
pcm "hw:0,0"
period_time 0
period_size 1024
buffer_size 4096
rate 44100
}
}
This should enable software mixing on the default device. (You can also just test this out on your user by putting it in your ~/.asoundrc file.) Now just get your programs to use the default ALSA device. (This isn't as easy as it sounds.) In XMMS just edit the configuration of the ALSA output plugin.
Or you could install and configure a sound mixing server like esd or KDE's arts. The goal is to mix the sound before outputting it.
Edit: If I recall correctly, I got this from this ALSA howto (http://fedoranews.org/contributors/andre_costa/alsa/). It's just here for your convenience.
foolish
30th June 2004, 01:36 PM
Excelent, thank you. This works great on my computer.
djf_jeff
30th June 2004, 02:18 PM
Work fine here, here is my asound.conf :
#
# DMIX input device
#
pcm.!output {
type dmix
ipc_key 1234
slave {
pcm "hw:0,0"
period_time 0
period_size 1024
buffer_size 8192
rate 48000
}
}
#
# DSNOOP output device
#
pcm.!input {
type dsnoop
ipc_key 1234
slave {
pcm "hw:0,0"
period_time 0
period_size 1024
rate 48000
}
}
#
# ASYM duplex device
#
pcm.!duplex {
type asym
playback.pcm "output"
capture.pcm "input"
}
#
# Make the duplex device default
#
pcm.!default {
type plug
slave.pcm "duplex"
}
#
# OSS Compability
#
pcm.!dsp0 {
type plug
slave.pcm "duplex"
}
ctl.!mixer0 {
type hw
card 0
}
One guy at job found this and it work fine. If you have trouble after that with gstreamer, just run this as your user :
gconftool-2 -s /system/gstreamer/0.8/default/audiosink -t string "alsasink device=output"
Bana
14th July 2004, 09:57 AM
Works for me, although does anyone know how to make Helixplayer (alsa realplayer) use the default alsa device?
Jman
15th July 2004, 04:37 PM
Helixplayer alsa drivers are still being worked on as of a week ago (http://lists.helixcommunity.org/pipermail/audio-dev/2004-July/000281.html), unfortunately.
jzke
15th July 2004, 08:30 PM
Doesn't work for me, for some reason I don't have a asound.conf file in /etc/... I have asound.state anyone no why?
Jman
16th July 2004, 02:27 AM
You may have to create the file:
touch /etc/asound.conf
pigpen
20th August 2004, 11:59 AM
Just a note: Jman's .asoundrc worked on my VIA KT133 sound hardware at home.
The box at my office has
Card: Intel 82801BA-ICH2
Analog Devices AD1885
hardware, which has a fixed sampling rate of 48kHz (i guess ;)), so I just commented out the
"rate"-line like this:
#rate 44100 and it works perfectly now.
kennykongkl
2nd November 2004, 08:30 PM
Hi Jman,
I tried your steps. It worked well with xmms playing and when I play a wav file using aplay.
However, if I have xmms playing music and yahoo messenger running, it doesn't work very well. Only when I stop playing music on xmms, will the yahoo sounds appear after that. Yahoo seems to wait for xmms to stop playing, then yahoo will play its backlog of sounds. It's like they can't share the same output channel.
My asound.conf file is the same as what you have here.
My settings in the xmms player for the ALSA output plugin is as follows :
ALSA 1.2.10 output plugin [libALSA.so]
Device Settings - Audio device = default, Mixer = Mixer Card 0, Mixer Device = PCM
Advanced Settings - Buffer time = 500 ms, Period time = 50 ms, Mmap mode = checked
Truly appreciate your help, thanks in advance.
jgionet
6th December 2004, 03:03 PM
I think this is the "#1 thing" that annoys me the most about using Linux as a Multimedia workstation. I'm trying "very hard" to switch permantly from XP to FC3 however all these multimedia issues are forcing me to boot up my XP PC all the time. I do alot of Sound Mixing, CD/DVD burning/creations, Video playing/editing and MiniDV encoding with my Digital Camcorder. You would think having the ability to play multiple sounds/wavs/mp3/anything would be simpler than this. Even Windows has had this for years. (sorry.. just venting a little.. it's Monday)
brymaster
10th December 2004, 07:05 AM
This problem in Fedora with ALSA has bugged me for quite a while. I really do hope they can put some effort into fixing this.
rega451
14th February 2005, 06:56 AM
Try playing multiple sounds at once. Chances are it won't work, and you will only hear one. One program gets exclusive access to the sound device.
The solution is software mixing. ALSA sound makes this possible, but you have to enable it. Put this in your /etc/asound.conf file: -----------
Big problem for me here! I also wanted to do this but for some reason I don't have an asound.conf :confused: I have asound.state, but that's it. Since I haven't had any reason (or so I thought) to look for it before this, I didn't know it wasn't there, or even should be there for that matter.
gohanman
15th February 2005, 02:54 AM
Edit: If I recall correctly, I got this from this ALSA howto (http://fedoranews.org/contributors/andre_costa/alsa/). It's just here for your convenience.
Apologies for bumping an ancient thread, but I'm having some trouble getting this working.
With the given additions to /etc/asound.conf, I can play two different files at once using asound, which is good.
Unforntantely, I still can't get sound from real applications (e.g., xmms, xine) at the same time. Worse, the configuration dialogs don't have the settings that the linked guide CLAIMS they have.
Specifically, xmms (v. 1.2.10) does not have a check box labeled "user defined".
Xine (v. 0.99.2) does not have a field called "device used for mono output" nor does it have a field called "device used for stereo output" in the "audio" tab.
Any advice on how to *actually* configure these programs to use swmixer would be great.
Jman
15th February 2005, 04:32 AM
Apologies for bumping an ancient thread, but I'm having some trouble getting this working.
With the given additions to /etc/asound.conf, I can play two different files at once using asound, which is good.
Unforntantely, I still can't get sound from real applications (e.g., xmms, xine) at the same time. Worse, the configuration dialogs don't have the settings that the linked guide CLAIMS they have.
Specifically, xmms (v. 1.2.10) does not have a check box labeled "user defined".
Xine (v. 0.99.2) does not have a field called "device used for mono output" nor does it have a field called "device used for stereo output" in the "audio" tab.
Any advice on how to *actually* configure these programs to use swmixer would be great.
This guide was based on FC2, if I recall correctly. XMMS should have an alsa output option, be sure that is selected. If there is a box for the device enter swmixer, if not it might work anyway.
Try editing the xine config file like it suggests.
gohanman
15th February 2005, 05:19 AM
1. I'm running FC2, so that really shouldn't be the problem.
2. xmms does have an alsa output option, which is selected. If I change "Audio Device" to swmixer, it gives me an error along the lines of "device is busy or misconfigured" when I try to play. The way it is right now, xmms and aplay won't run at the same time, so I don't think xmms is using the software mixer.
3. I did look at the xine config file, it doesn't have the keys for mono device and stereo device either.
commadore
5th May 2005, 04:42 PM
at last got sound with my ac97 onbourd asound card :)
but why dont have stereo output could not understand it have any1 have stereo ?
tejas
5th May 2005, 05:24 PM
I got it to work, by creating an asound.conf with the above data.
If It is that simple, why isn't it just automatic in Fedora
commadore
5th May 2005, 08:39 PM
:( start to hate that it was working just restarted system and again dont have any sound ... also with same asound.conf file :(
m4ci3j
28th August 2005, 05:19 PM
Maybe you should type this in /usr/share/alsa/alsa.conf xD I have other problem. Everything works correctly but i don't know how to configure TeamSpeak 2 and Enemy Terrtory to work w with swmixer =-( If anyone have some ideas how to solve it i would be very happy xD
Thanks in advance
PS : Sorry for my english :/
smfinley
28th August 2005, 05:28 PM
For a Soundblaster Live card edit or create an .asoundrc file in your home directory and include the following:
pcm.emu10k1 {
type hw
card 0
}
ctl.emu10k1 {
type hw
card 0
}
lukasszz
8th September 2005, 05:31 PM
there is no /etc/asound.conf file on my FC3 :(. any idea?
Do I need install something?
I've got sound integrated into my nforce2 mainboard.
--
lukasszz
Alerander
11th September 2005, 05:33 PM
well, I must confess, it doesn't work for me. Maybe i forget some configurations here, I'm using FC4 with GNOME, and have this with the command "rpm -qa | grep alsa"
alsa-utils-1.0.9rc2-2
alsa-lib-devel-1.0.9rc4-2
alsa-lib-1.0.9rc4-2
I can only find libOSS.so on xmms output plugins, any idea?
Thanks!
Alerander
11th September 2005, 05:41 PM
Now just get your programs to use the default ALSA device. (This isn't as easy as it sounds.) In XMMS just edit the configuration of the ALSA output plugin.
I'm sorry, Not very clearly with here....................
bhikumhatre007
5th November 2005, 05:30 AM
@alerander:
you have to install the alsa plugin for xmms. its very easy.
RahulSundaram
5th November 2005, 08:22 AM
I got it to work, by creating an asound.conf with the above data.
If It is that simple, why isn't it just automatic in Fedora
Alsa Software sound mixing is enabled by default for FC4 . Getting it work properly for all sound cards and particular to disable this feature when hardware mixing is available etc is not so simple
bhikumhatre007
5th November 2005, 08:42 AM
i am using FC4 but unfortunately its not working. whenever i try to play mplayer and xmms together one of them does not produce sound. also, i installed alsaplaeyer and edited asound.conf and all...now alsaplayer and mplayer work simulataneously if i tell mplayer to use alsa but otherwise they don't. how to get both of the working properly? i know that its a problem with dmix but i don't know the exact procedure of fixing it up.....some help please! :)
Alerander
5th November 2005, 11:53 AM
Okay, my problem have been solved several days ago. Nothing i had done, just installed xmms for FC4 from Fedora Project download server. Then even you don't need to set asound.conf you can have sounds mixed.
bhikumhatre007
5th November 2005, 01:09 PM
k, but then what about mplayer?
bhikumhatre007
5th November 2005, 01:12 PM
and xine? also, could you please post the following 3 things here.
1) asound.config
2) .asounrd in your ~/
3) the result of
rpm -qa | grep alsa
and also the link from where u got xmms for fc4.
RahulSundaram
5th November 2005, 01:12 PM
k, but then what about mplayer?
Fedora Core and Extras dont include it. If it uses ALSA sound system instead of OSS it should do software sound mixing. Else complain to the packagers or developers about it
bhikumhatre007
5th November 2005, 01:13 PM
also, could you please post your yum.conf here? :D
Alerander
5th November 2005, 02:22 PM
and xine? also, could you please post the following 3 things here.
1) asound.config
2) .asounrd in your ~/
3) the result of
rpm -qa | grep alsa
and also the link from where u got xmms for fc4.
Okay, here you are:
asound.conf
# Generated by system-config-soundcard, do not edit by hand
defaults.pcm.card 0
defaults.pcm.card 0
And i have no .asoundrc in home folder, i had one before but i deleted it. Info about ALSA is:
[leeyee@workstation:~]$rpm -qa | grep alsa
alsa-utils-1.0.9rc2-2
alsa-lib-devel-1.0.9rc4-2
alsa-lib-1.0.9rc4-2
Alerander
5th November 2005, 02:29 PM
hmm.....I never used yum before, so you can just see your default yum.conf instead. Here is where i got xmms:
http://download.fedora.redhat.com/pub/fedora/linux/extras/4/i386/xmms-1.2.10-16.i386.rpm
And refer to mplayer install, just see this site: www.mjmwired.net
Hope these will be help!
bhikumhatre007
5th November 2005, 04:57 PM
the problem which i am facing i feel is KDE is trying to use aRts while most others are peacefully using alsa. e.g. i can play xmms and gmplayer simultaneously.(although xmms gets kinda stuck in between)
now i have following 2 options:
1) to use alsa and get rid of aRts completely
2) make everything go through aRts
my final aim is to have multiple sounds coming out....the way doesn't really matter. :)
so how do i go about it now?
r1348
5th November 2005, 05:25 PM
Once I issued this command:
gconftool-2 -s /system/gstreamer/0.8/default/audiosink -t string "alsasink device=output"
my sound doesn't work anymore. I get this error: "ALSA device "output" doesn't exist"
How can I go back to the previous working sound device?
I have a SiS7012 sound card using the intel8x0 driver, this problem affects only gstreamer programs.
faustoandrade
7th November 2005, 11:58 AM
Greetings from Brazil
Here's how i managed to solve my problems with sound in fedora core 4 ...
first edit the /etc/asound.conf ... it sould look something like this:
#beginnig of asound.conf
pcm.asymed {
type asym
playback.pcm "dmix"
capture.pcm "dsnoop"
}
pcm.!default {
type plug
slave.pcm "asymed"
}
#ctl.!mixer0 {
# type hw
# card 0
#}
pcm.!dmix {
type dmix
ipc_key 5678293
ipc_key_add_uid yes
slave {
pcm "hw:0,0"
period_time 0
period_size 128
buffer_size 2048
format S16_LE
rate 48000
}
}
pcm.!dsnoop {
type dsnoop
ipc_key 5778293
ipc_key_add_uid yes
slave {
pcm "hw:0,0"
period_time 0
period_size 128
buffer_size 2048
format S16_LE
rate 48000
}
}
#end of asound.conf
now, i have skype, xmms, xine player, gaim, and some other programs all working perfectly with sound ....
skype demmands that the buffer size be 2048, i 've tried other settings but it wouldn't work ... so if you use skype i suggets you leave the buffer size at 2048 and the Period size at 128 .... You should start skype with alsa like this: "aoss skype"
With xmms you'll need the xmms-alsa plugin and configure it to use the same settings in the asound.conf ... Buffer time = 2048 and Perido time = 128 and disable Mmap, this is done in the advanced tab in the alsa-plugins configuration.
Like skype all others applications that require sound sould be started trhough alsa: "aoss <app>".
Well, i hope this helps ....
See ya !!!
prosen
7th November 2005, 05:53 PM
The alsa ver provided with fc4 comes with dmix support prebuilt .. I do not understand why you guys needed to specify it separately ..
faustoandrade
7th November 2005, 09:04 PM
The alsa ver provided with fc4 comes with dmix support prebuilt .. I do not understand why you guys needed to specify it separately ..
At first that's what thought too, but i couldn't get more than one app to use the sound at the same time, only after extensive research i managed to get it working..
But yes ....... FC4 come with dmix support prebuilt .. i really don't understand why it wasn't working ....
Jman
9th November 2005, 06:59 AM
The alsa ver provided with fc4 comes with dmix support prebuilt .. I do not understand why you guys needed to specify it separately ..
This thread was started in the FC2 era.
prosen
11th November 2005, 08:43 PM
Greetings from Brazil
Here's how i managed to solve my problems with sound in fedora core 4 ...
hullo ?? I was referring to that ?? is it fine now ?? :)
I knew this thread is not new .. and I had to use the same approach on my previous rh9 .. but ppl were posting their probs on fc4 .. which is why I was surprised ..
jjcf89
29th August 2008, 08:06 PM
i was having problems with this issue in fedora 9. I did what the first post said and now it works. Awesome.
pikul
2nd September 2008, 02:48 AM
i was having problems with this issue in fedora 9. I did what the first post said and now it works. Awesome.
Really ??? still works ??? i guess ill try it instead of doing the config for pulseaudio :D
Demz
2nd September 2008, 02:54 AM
i think this thread could be closed since its an old thread
Powered by vBulletin® Version 4.2.5 Copyright © 2018 vBulletin Solutions Inc. All rights reserved.