LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 04-01-2006, 04:47 PM   #1
stormrider_may
Member
 
Registered: Sep 2005
Distribution: Debian
Posts: 304

Rep: Reputation: 30
How to make alsa play two sounds at the same time?


Hi, is it possible to make alsa respond to two or more programs at the same time?

Like, i'm listening to some music on xmms and if i want to see a video on mplayer, when i start a video, it doesn't play anything until i close xmms. If i use arts as output audio driver it works, i can open as many programs as i want and they will work at the same time. But, arts is a little buggy (makes mplayer slow, and when i stop xmms it takes about 2 or 3 seconds to REALLY stop).
 
Old 04-01-2006, 05:58 PM   #2
win32sux
LQ Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
maybe try esound or jack instead of arts??
 
Old 04-02-2006, 11:23 PM   #3
stormrider_may
Member
 
Registered: Sep 2005
Distribution: Debian
Posts: 304

Original Poster
Rep: Reputation: 30
esound and jack did not worked for me. Well, xmms and mplayer couldn't play anything.

How does esound and jack work? I have to make something like alsaconf or they are already configured?
 
Old 04-02-2006, 11:52 PM   #4
foo_bar_foo
Senior Member
 
Registered: Jun 2004
Posts: 2,553

Rep: Reputation: 53
alsa can do this directly
have to use dmix plugin
it is possible to write a HUGE file as ~/.asoundrc for this but here is as simple as i can think right now.
save this as ~/.asoundrc and see if it works
Code:
pcm.dsp0 {
    type plug
    slave.pcm "dmix"
}

pcm.!default {
    type plug
    slave.pcm "dmix"
}
 
Old 04-03-2006, 12:05 AM   #5
stormrider_may
Member
 
Registered: Sep 2005
Distribution: Debian
Posts: 304

Original Poster
Rep: Reputation: 30
well, i have a good and a bad news.
The good one is that you solved and old problem which i had reported here but didn't found any solution. Well, when i boot up my computer it usually takes about 1 minute to get my sound working (after everything is loaded). Doing what you told me stopped this.

The bad one. The sound was horrible, like lagged and noisy (sorry, can't describe, my english is horrible).

Thanks for the help!
 
Old 04-07-2006, 11:42 AM   #6
stormrider_may
Member
 
Registered: Sep 2005
Distribution: Debian
Posts: 304

Original Poster
Rep: Reputation: 30
can somebody help me to make it work? It would be great if i don't have to wait 1 minute after boot to play a sound.
 
Old 04-07-2006, 12:26 PM   #7
win32sux
LQ Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
what part of the startup is taking a minute?? please be as specific as possible...

the way i see it, you have two separate issues:

1) your weird startup time thing

2) your installation of a sound server and/or your configuration of alsa to achieve multi-sound...
 
Old 04-07-2006, 12:35 PM   #8
stormrider_may
Member
 
Registered: Sep 2005
Distribution: Debian
Posts: 304

Original Poster
Rep: Reputation: 30
Sorry, i will be as much specific as i can.

I always had an weird problem on Debian, after boot (when everything is up, including KDE) if i open something that play any kind of sound it says my sound card is in use.
Like if i try to play a mp3 with xmms, it says my sound card is in use and keeps there on 00:00. After one minute (about), it starts playing.

I´ve tried the tip that foo_bar_foo have talked. Well it worked, as soon as kde opened, i could play a song on xmms and watch a video o mplayer. The problem is that it was lagged and really noisy. I could not fix it.

So, i was wondering if there is another way to do this.
 
Old 04-07-2006, 12:48 PM   #9
win32sux
LQ Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
so when you apt-get esound and then you tell xmms to use esound instead of alsa or oss it doesn't work?? what kinda error does it give??
 
Old 04-08-2006, 07:28 PM   #10
stormrider_may
Member
 
Registered: Sep 2005
Distribution: Debian
Posts: 304

Original Poster
Rep: Reputation: 30
It gives this error...
Code:
Please, verify if:

Your sound card is correctely configured.
You selected the right output plugin.
Any other program is blocking your sound card.
Asking again, after doing apt-get install esound, i don't have to run anything right? esound autoconfs itself?
 
Old 04-08-2006, 07:37 PM   #11
win32sux
LQ Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
well, on slackware i didn't have to do anyting after installing esound...

i was able to use it right away... i don't use xmms, i use audacious, but it's kinda the same crap... i did recompile audacious in order for it to recognize i had esound... but i'm pretty sure debian's xmms would have already been compiled with esound support, as esound is part of the official debian repositories and stuff...

when you get that error you aren't running arts or anything, right??

i actually got rid of esound after a few minutes of usage, as i realized alsa was letting me play several sounds at once by itself... i installed alsa like yesterday or the day before...
 
Old 04-09-2006, 01:43 AM   #12
foo_bar_foo
Senior Member
 
Registered: Jun 2004
Posts: 2,553

Rep: Reputation: 53
sorry it took so long to get back
first in the KDE controll make sure you uncheck
"enable the sound system"
restart KDE
then set your apps to use alsa as output never arts
if that doesn't help trade the ~/.asoundrc with this one (mine -- very messy)
i have given it to people here before and it has helped
Code:

pcm.jackplug {
	        type plug
	        slave { pcm "jack" }
	}

	pcm.jack {
	        type jack
	        playback_ports {
 	               0 alsa_pcm:playback_1
 	               1 alsa_pcm:playback_2
 	       }
 	       	capture_ports {
 	               0 alsa_pcm:capture_1
                	1 alsa_pcm:capture_2
        	}

	}

pcm.dsp {
    type plug
   # slave.pcm "dmixer"
    slave.pcm "duplex"
}

pcm.dsp0 {
    type plug
   # slave.pcm "dmixer"
    slave.pcm "duplex"
}



# this makes native ALSA apps default to using dmix
pcm.!default {
    type plug
   # slave.pcm "dmixer"
    slave.pcm "duplex"
   
}

ctl.!default {
	type hw           
	card 0
        }

pcm.dmixer  {
	type dmix
	ipc_key 1024
	slave {
	    pcm "hw:0,0"
	 #   period_time 0 # set to 0 lets period size and buffer size do everything
             period_time 2 # this is the general standard even though often is set to 0
         #   period_time 84000
         #   period_size 512
             period_size 1024 # oss period frames this is the one shown as hardware
	 #   period_size 2048
         #   period_size 4096 # not great to go over this 
         #   buffer_time 340000
	 #   buffer_size 16384 # this is the one shown as hardware but causes huge mess
         #   buffer_size 8192
         #   buffer_size 4096
             buffer_size 2052 # this is the one i use
             rate 44100 # can let card decide this on it's own this one is what hardware says
	 #   rate 48000

	}
	bindings {
	    0 0
	    1 1
	}
    }
 
    ctl.dmixer {
	type hw
	card 0
    }

    ctl.mixin {
        type hw
        card 0
     }

    pcm.duplex{
         type asym
         playback.pcm "dmixer"
         capture.pcm "mixin"
      }

pcm.mixin {
        type dsnoop
        ipc_key 5978293	# must be unique for all dmix plugins!!!!
        ipc_key_add_uid yes
        slave {
                pcm "hw:0,0"
		channels 2
	#	period_size 1024
                period_size 1026
	#	buffer_size 4096
                buffer_size 2052
		rate 44100
      #		periods 0 
		period_time 2
        }
        bindings {
                0 0
                0 1
        }
    }
 
Old 04-09-2006, 12:57 PM   #13
stormrider_may
Member
 
Registered: Sep 2005
Distribution: Debian
Posts: 304

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by win32sux
well, on slackware i didn't have to do anyting after installing esound...

i was able to use it right away... i don't use xmms, i use audacious, but it's kinda the same crap... i did recompile audacious in order for it to recognize i had esound... but i'm pretty sure debian's xmms would have already been compiled with esound support, as esound is part of the official debian repositories and stuff...

when you get that error you aren't running arts or anything, right??

i actually got rid of esound after a few minutes of usage, as i realized alsa was letting me play several sounds at once by itself... i installed alsa like yesterday or the day before...
Can tou tell the steps you did on slack to make it work? I installed xmms (have esound) and installed esound, but when i try to open fuhquake, xmms stops working and fuhquake doesn't have any sound.

foo_bar_foo

Thanks, i'll try it as soon as i get home.
 
  


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
Can't play sounds on more than one gnome app at a time TheMabster Linux - General 1 02-11-2006 11:12 AM
Can't play two sounds at the same time with a C-Media atros Linux - Software 3 08-11-2004 11:26 AM
alsa not letting me play multiple sounds. e1000 Linux - Hardware 5 05-01-2004 09:02 PM
Cannot play two sounds at a time. Jose Muņiz Linux - Hardware 1 01-11-2004 01:03 AM
Can't play many sounds at the same time in KDE Mikessu Linux - General 2 10-11-2003 04:05 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08:04 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration