Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
How to get sound working with 2 programs at same time.
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Multimedia
View previous topic :: View next topic  
Author Message
BlindSpy
Apprentice
Apprentice


Joined: 20 Mar 2004
Posts: 263

PostPosted: Sat Apr 17, 2004 7:04 pm    Post subject: How to get sound working with 2 programs at same time. Reply with quote

I want to use teamspeak while i play America's Army, but if I start teamspeak before i start americas army, i cant hear AA sounds. If i start AA first, I cant hear teamspeak sounds. This is the same with any programs that use sound. No two programs can use sound at the same time. I use ALSA and i've also tried emerging the arts thing but with no luck. Any suggestions?
Back to top
View user's profile Send private message
grepcomputers
Guru
Guru


Joined: 16 Sep 2003
Posts: 375

PostPosted: Sat Apr 17, 2004 7:26 pm    Post subject: Reply with quote

What sound card you got? The sound card on my ASUS L8400C does not work with more than one program at at time. I was using redhat 9.0 at the time, though.

However, my Turtle Beach and Audigy2 cards (not used at the same time, I upgraded) both worked fine with multiple streams. The TB only ever used alsa, the A2 switched from oss to alsa a few months ago. With both I have had something like up to 12 different instances of gqmpeg (front end for mpg123) open and playing music at the same time.

Do you get this problem only with different programs, or also when trying to get any kind of multiple sound streams?

cheers...
...grep
Back to top
View user's profile Send private message
BlindSpy
Apprentice
Apprentice


Joined: 20 Mar 2004
Posts: 263

PostPosted: Sun Apr 18, 2004 5:22 pm    Post subject: Reply with quote

I've got a VIA 8235 integrated soundcard, 2.6.5-r1 with compiled in alsa sound and yet I dont get any kind of multiple sound streams. Actually I get no sound unless I start alsasound '/etc/init.d/alsasound start' so I'm not even sure if its a kernel problem.
Back to top
View user's profile Send private message
Abraxas
l33t
l33t


Joined: 25 May 2003
Posts: 814

PostPosted: Sun Apr 18, 2004 5:25 pm    Post subject: Reply with quote

BlindSpy wrote:
I've got a VIA 8235 integrated soundcard, 2.6.5-r1 with compiled in alsa sound and yet I dont get any kind of multiple sound streams. Actually I get no sound unless I start alsasound '/etc/init.d/alsasound start' so I'm not even sure if its a kernel problem.


The alsasound script loads modules and restores the volume. Unless you manually change the settings or have them store and restore from /etc/conf.d/local.st* then you will NOT hear any sound.
_________________
Time makes more converts than reason. - Thomas Paine
Travel is fatal to prejudice, bigotry, and narrow-mindedness, and many of our people need it sorely on these accounts. - Mark Twain
Back to top
View user's profile Send private message
Jowilly
Guru
Guru


Joined: 22 Jun 2002
Posts: 319

PostPosted: Sun Apr 18, 2004 5:31 pm    Post subject: Reply with quote

BlindSpy wrote:
I've got a VIA 8235 integrated soundcard, 2.6.5-r1 with compiled in alsa sound and yet I dont get any kind of multiple sound streams. Actually I get no sound unless I start alsasound '/etc/init.d/alsasound start' so I'm not even sure if its a kernel problem.


You can hear multiple sounds with mono channel sound cards if you use a sound server (esd on gnome, arts on kde). The sound server will do the mixing. But for this to work, the apps must have arts (or esd) support.

The best is to get an audigy or an sblive... you can get them cheap. These cards (as many others) suppot multiple channels.
Back to top
View user's profile Send private message
BlindSpy
Apprentice
Apprentice


Joined: 20 Mar 2004
Posts: 263

PostPosted: Sun Apr 18, 2004 8:33 pm    Post subject: Reply with quote

Alright I think my sound card just cant handle 2 programs with sound at once and the 2 programs I want to use, dont have the ability to use esd or arts. This means I have to buy a new video card and a new sound card (because my ATI sucks on linux).
Back to top
View user's profile Send private message
sobers_2002
Veteran
Veteran


Joined: 16 Mar 2004
Posts: 1128

PostPosted: Sun Apr 18, 2004 8:49 pm    Post subject: Reply with quote

well you can do that by adding these lines to your .asoundrc file
Code:
pcm.dmixer {
    type dmix
    ipc_key 1024
    slave {
        pcm "hw:0,0"
        period_time 0
        period_size 1024
        buffer_size 8192
   rate 44100
    }

    bindings {
        0 0
        1 1
    }
}

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

pcm.!default {
        type plug
        slave.pcm "dmixer"
}


hope this helps

Saurabh
Back to top
View user's profile Send private message
BlindSpy
Apprentice
Apprentice


Joined: 20 Mar 2004
Posts: 263

PostPosted: Sun Apr 18, 2004 9:39 pm    Post subject: Reply with quote

I didnt have an .asoundrc so I made one with the contence you specified in my home dir. I'm not really sure what this is supposed to fix tough. I still cant play 2 programs with sound at once and I'm thinking maybe this was to fix having to do rc-update alsasound. please let me know. thanks.
Back to top
View user's profile Send private message
Locke
n00b
n00b


Joined: 02 Aug 2002
Posts: 50
Location: Baton Rouge, LA, US

PostPosted: Mon Apr 19, 2004 12:34 am    Post subject: Reply with quote

dmix works for some folks, but certain cards and programs tend to be too picky for it to work. I've spent the better part of 2 days trying to get it to work with my i820... I can play multiple ALSA streams, but OSS still pukes if anything else is using the sound card. If you can't get it working fairly quickly, then just fork over $10 for an SBLive like Jowilly said :p
Back to top
View user's profile Send private message
BlindSpy
Apprentice
Apprentice


Joined: 20 Mar 2004
Posts: 263

PostPosted: Mon Apr 19, 2004 1:24 am    Post subject: Reply with quote

Well im not really sure what I need to do to even try Dmix? If not - do they sell those $10 sound cards at best buy?
Back to top
View user's profile Send private message
sobers_2002
Veteran
Veteran


Joined: 16 Mar 2004
Posts: 1128

PostPosted: Mon Apr 19, 2004 5:27 am    Post subject: Reply with quote

the contents i posted are just a supplement to ur ~/.asoundrc file.......there are some lines there are specific to your card......
Code:
www.alsa-project.org
here search for your card and u'll get a sample .asoundrc......those lines ARE ALSO required.......these just help in playing 2 sounds at the same time :)
luck!

Saurabh
Back to top
View user's profile Send private message
BlindSpy
Apprentice
Apprentice


Joined: 20 Mar 2004
Posts: 263

PostPosted: Mon Apr 19, 2004 9:06 pm    Post subject: Reply with quote

I went through the gentoo alsa guide as well as the Alsa guide for my onboard sound card (VIA VT8235) and still no luck.

here's my /etc/asound.cont:

Code:
pcm.!default {
     type plug
     slave.pcm "dmixer"
    }
   
pcm.dmixer {
    type dmix
    ipc_key 1024
    slave {
        pcm "hw:0,0"
        period_time 0
        period_size 1024
        buffer_size 8192
   rate 44100
    }

    bindings {
        0 0
        1 1
    }
}

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

pcm.!default {
        type plug
        slave.pcm "dmixer"
}


and my /etc/modules.d/alsa:

Code:
# Alsa 0.9.X kernel modules' configuration file.
# $Header: /home/cvsroot/gentoo-x86/media-sound/alsa-utils/files/alsa-modules.conf-rc,v 1.1 2003/08/05 21:07:55 johnm Exp $

# ALSA portion
alias char-major-116 snd
alias snd-card-0 snd-via82xx

# OSS/Free portion
alias char-major-14 soundcore
alias sound-slot-0 snd-card-0

##
## IMPORTANT:
## You need to customise this section for your specific sound card(s)
## and then run `update-modules' command.
## Read alsa-driver's INSTALL file in /usr/share/doc for more info.
##
##  ALSA portion
## alias snd-card-0 snd-interwave
## alias snd-card-1 snd-ens1371
##  OSS/Free portion
## alias sound-slot-0 snd-card-0
## alias sound-slot-1 snd-card-1
##

# OSS/Free portion - card #1
alias sound-service-0-0 snd-mixer-oss
alias sound-service-0-1 snd-seq-oss
alias sound-service-0-3 snd-pcm-oss
alias sound-service-0-8 snd-seq-oss
alias sound-service-0-12 snd-pcm-oss
##  OSS/Free portion - card #2
## alias sound-service-1-0 snd-mixer-oss
## alias sound-service-1-3 snd-pcm-oss
## alias sound-service-1-12 snd-pcm-oss

alias /dev/mixer snd-mixer-oss
alias /dev/dsp snd-pcm-oss
alias /dev/midi snd-seq-oss

# Set this to the correct number of cards.
options snd cards_limit=1
Back to top
View user's profile Send private message
MaxDamage
l33t
l33t


Joined: 03 Jan 2004
Posts: 650
Location: Oviedo, Spain

PostPosted: Mon Apr 19, 2004 9:37 pm    Post subject: Reply with quote

I have the same sound system (integrated in my Gigabyte GA-7VAX mobo) and have spent days working on that. There are three ways of doing things sound with the VIA soundcard at the same time:

Programs that use ALSA will mix fine (with dmix configured as you already have done ;) ) like running two instances of Xmms with the ALSA output plugin.

Programs using ESD output will mix through ESD if you enable it under gnome options->sound->enable sound server at startup (haven't tested this a lot).

Programs using OSS will take over the soundcard and no more programs will be able to use it meanwhile. The only (dirty) way of getting sound is making the other programs use the 2nd channel of the VIA soundcard, with something like this:

aplay -D hw:0,1 whatever.wav

At least this way I can hear when I receive an email or some friend enters MSN while playing a game that uses OSS (as many do). Anyway sound gets distorted because of the different sample rate both programs could use (games using 22kHz, wav playing 44kHz).

Just my 2¢
_________________
La PDA de tungsteno
Back to top
View user's profile Send private message
BlindSpy
Apprentice
Apprentice


Joined: 20 Mar 2004
Posts: 263

PostPosted: Tue Apr 20, 2004 12:08 am    Post subject: Reply with quote

Let me get this straight, if i use ESD, i dont need to have support compiled into the program? Cause the 2 programs i want to use together (Americas Army and TeamSpeak) dont have the ability to have aRts support (or ESD).

With the configuration posted above, I tried using XMMS (with alsa support) and Americas Army (that uses alsa) together and it still only had XMMS sound (cause i started it first) even though both programs use alsa.
Back to top
View user's profile Send private message
MaxDamage
l33t
l33t


Joined: 03 Jan 2004
Posts: 650
Location: Oviedo, Spain

PostPosted: Tue Apr 20, 2004 4:55 am    Post subject: Reply with quote

There is a page specifically explaining this issue. Hope it helps.
http://www.linux-gamers.net/modules/wfsection/article.php?articleid=34
_________________
La PDA de tungsteno
Back to top
View user's profile Send private message
BlindSpy
Apprentice
Apprentice


Joined: 20 Mar 2004
Posts: 263

PostPosted: Wed Apr 21, 2004 9:29 pm    Post subject: Reply with quote

It helped a little but I didnt think it was as clear as it could have been. It says i need a combined playback/capture device and i did this to find out but i still dont know if i can:

Code:
cat /proc/asound/pcm
00-00: VIA 8235 : VIA 8235 : playback 4 : capture 1
00-01: VIA 8235 : VIA 8235 : playback 1 : capture 1


and when i do these (its supposed to make a beep), i get static:

Code:
cat /dev/urandom > /dev/dsp0
cat /dev/urandom > /dev/adsp


For this, i am confused - how would i set this up for americas army?:

Code:
Now you have to tell some games to use the playback only device (take this list as an example):

echo "quake3.bin 0 0 direct">/proc/asound/card0/pcm1p/oss
echo "quake3.x86 0 0 direct">/proc/asound/card0/pcm1p/oss
echo "quake3-smp 0 0 direct">/proc/asound/card0/pcm1p/oss
echo "wolfsp.x86 0 0 direct">/proc/asound/card0/pcm1p/oss
echo "wolf.x86 0 0 direct">/proc/asound/card0/pcm1p/oss
echo "et.x86 0 0 direct">/proc/asound/card0/pcm1p/oss


thanks for the help
Back to top
View user's profile Send private message
MaxDamage
l33t
l33t


Joined: 03 Jan 2004
Posts: 650
Location: Oviedo, Spain

PostPosted: Wed Apr 21, 2004 10:08 pm    Post subject: Reply with quote

BlindSpy wrote:
and when i do these (its supposed to make a beep), i get static:

Code:
cat /dev/urandom > /dev/dsp0
cat /dev/urandom > /dev/adsp



Getting static with those commands is exactly what is meant to be. You are piping the randon number generator to the sound card, so you get pseudo-white noise.

I didn't manage to work the echo /proc thing, so I cannot help you with that.

I don't play any of the two programs, but what you should try to do is to get one program (i.e. american army) playing through /dev/dsp0 ant the other (i.e. TeamSpeak) through /dev/adsp.

By default american army will use /dev/dsp so you could try firstly deleting /dev/dsp, then making the /dev/dsp0 link but naming it /dev/dsp, to use it instead of the original /dev/dsp you deleted, and finally configuring TeamSpeak to use /dev/adsp.
_________________
La PDA de tungsteno
Back to top
View user's profile Send private message
BlindSpy
Apprentice
Apprentice


Joined: 20 Mar 2004
Posts: 263

PostPosted: Thu Apr 22, 2004 8:44 pm    Post subject: Reply with quote

aaah so thats what the guide was trying to get me to do - thanks :D
Back to top
View user's profile Send private message
MaxDamage
l33t
l33t


Joined: 03 Jan 2004
Posts: 650
Location: Oviedo, Spain

PostPosted: Thu Apr 22, 2004 9:06 pm    Post subject: Reply with quote

I'm glad if I've been of aid ;)
_________________
La PDA de tungsteno
Back to top
View user's profile Send private message
BlindSpy
Apprentice
Apprentice


Joined: 20 Mar 2004
Posts: 263

PostPosted: Sat Apr 24, 2004 6:15 pm    Post subject: Reply with quote

=( i still cant get it working. I think my soundcard as all the features I need to be able to use TeamSpeak and America's Army at the same time, but I just dont know enough about sound devices to get them to work together.
Back to top
View user's profile Send private message
BlindSpy
Apprentice
Apprentice


Joined: 20 Mar 2004
Posts: 263

PostPosted: Tue Apr 27, 2004 4:46 am    Post subject: Reply with quote

Got it working! i donno if any of that stuff above helped but i went into alsaguimixer and realised i had all my soundcard channels muted except the first one. donno why it was like that cause i had origionally had em on but who knows.... anyway it works! thanks for your help!
Back to top
View user's profile Send private message
ygreen
n00b
n00b


Joined: 30 Apr 2004
Posts: 20
Location: Pacifica, CA

PostPosted: Sun Jul 04, 2004 10:44 pm    Post subject: Reply with quote

Damnit!

I've been trying to get this same exact thing working literally all day. I've followed the guide on setting up TEamSpeak as per the other post on this thread. /dev/sound/adsp does not produce any audio at all even with no audio devices started. Running...

Code:
cat /dev/urandom > /dev/adsp


Code:
cat /dev/urandom > /dev/sound/adsp


on my C-Media Electronics Inc CM8738 (rev 10) results in no white noise but runnig the test on /dev/dsp or /dev/sound/dsp works fine as long as TeamSpeak isn't already running.

I tried mapping TeamSpeak to any of the other devices listed in /dev/sound with no luck at all. Americas Army still sees /dev/sound/dsp as busy during startup no matter what device I tell TeamSpeak to use.

I even tried using the /dev/sound/dspW device I have but they all seem to actually point to /dev/sound/dsp no matter what I try. Here's the contents of my /dev/sound directory:

Code:

root@nightbox / # ls -l /dev/sound/
total 0
crw-rw-rw-  1 root   audio 14, 12 Dec 31  1969 adsp
crw-rw----  1 root   audio 14,  4 Dec 31  1969 audio
crw-rw-rw-  1 root   audio 14,  3 Dec 31  1969 dsp
crw-r--r--  1 root   root  14, 19 Jul  4 15:29 dsp0
crw-rw-rw-  1 ygreen audio 14,  5 Dec 31  1969 dspW
crw-rw----  1 root   audio 14,  0 Dec 31  1969 mixer
crw-rw----  1 root   audio 14,  1 Dec 31  1969 sequencer
crw-rw----  1 root   audio 14,  8 Dec 31  1969 sequencer2


dsp0 I created myself when I was trying to play around with creating alternate device but the rest were there since I installed the driver. This is what my ~/.asoundrc looks like:

Code:

pcm.cmipci {
    type hw
    card 0
}

ctl.cmipci {
    type hw
    card 0
}

pcm.dmixer {
    type dmix
    ipc_key 1024
    slave {
        pcm "hw:0"
        period_time 0
        period_size 1024
        buffer_size 8192
        rate 44100
    }
    bindings {
        0 0
        1 1
    }
}

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

pcm.!default {
    type plug
    slave.pcm "dmixer"
}

pcm.dmixoss {
    type dmix
    ipc_key 1025 # any unique value
    ipc_key_add_uid true
    slave {
        pcm "hw:0"
        period_time 0
        period_size 1024 # must be power of 2
        buffer_size 4096 # ditto
    }
    bindings {
    0 0 # map from 0 to 0
    1 1 # map from 1 to 1
    }
}


I'm going insane! I've managed to get this far and the only thing I can't seem to get working is getting both of these apps to share the soundcard.

Someone help, please.... :cry:[/code]
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Multimedia All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum