Page 1 of 4 123 ... LastLast
Results 1 to 10 of 69

Thread: HOWTO: Hear multiple sounds at once

Hybrid View

  1. #1
    Join Date
    Nov 2004
    Location
    Purdue University, Indiana
    Beans
    816
    Distro
    Dapper Drake Testing/

    HOWTO: Hear multiple sounds at once

    This one seems to stump most linux newbies..."Why can't I hear sounds from two applications at once?" This is because your sound card requires something called "software mixing." Thankfully, ALSA provides software mixing, so this shouldn't be very hard.

    The first thing to do is install the package libesd-alsa0. Use synaptic, a sudo apt-get install, or whatever. Its available in the Ubuntu repositories.

    Then, create the following file using "sudo gedit" or your favorite text editor, and save it as /etc/asound.conf. (Make sure you use sudo, you need root priviledges to do this.)

    pcm.card0 {
    type hw
    card 0
    }

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

    }


    pcm.dmixer {
    type dmix
    ipc_key 1025
    slave {
    pcm "hw:0,0"
    period_time 0
    period_size 1024
    buffer_size 4096
    periods 128
    rate 44100
    }
    bindings {
    0 0
    1 1
    }
    }

    (the above file should work with most sound cards...I've tried it with 3 different ones with success. I can't guarantee it'll work in all cases, though.)

    Next, execute a "sudo gedit /etc/esound/esd.conf" and change the file to the following:

    [esd]
    auto_spawn=1
    spawn_options=-terminate -nobeeps -as 2 -d default
    spawn_wait_ms=100
    # default options are used in spawned and non-spawned mode
    default_options=

    Next, go to your Sound control panel in Gnome and enable sound server startup. After this, go to your Multimedia Systems Selector control panel and set it to either ALSA or ESD. Then, reboot your computer.

    After doing this, you can set any application to use alsa or ESD, and you'll hear multiple sounds at once! No more problems playing games that use ALSA and hearing sounds from a Gnome app that uses ESD...

  2. #2
    Join Date
    Oct 2004
    Location
    Netherlands
    Beans
    2,983
    Distro
    Ubuntu 8.04 Hardy Heron

    Re: HOWTO: Hear multiple sounds at once

    Quote Originally Posted by varunus
    This one seems to stump most linux newbies..."Why can't I hear sounds from two applications at once?" This is because your sound card requires something called "software mixing." Thankfully, ALSA provides software mixing, so this shouldn't be very hard.

    The first thing to do is install the package libesd-alsa0. Use synaptic, a sudo apt-get install, or whatever. Its available in the Ubuntu repositories.

    Then, create the following file using "sudo gedit" or your favorite text editor, and save it as /etc/asound.conf. (Make sure you use sudo, you need root priviledges to do this.)

    pcm.card0 {
    type hw
    card 0
    }

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

    }


    pcm.dmixer {
    type dmix
    ipc_key 1025
    slave {
    pcm "hw:0,0"
    period_time 0
    period_size 1024
    buffer_size 4096
    periods 128
    rate 44100
    }
    bindings {
    0 0
    1 1
    }
    }

    (the above file should work with most sound cards...I've tried it with 3 different ones with success. I can't guarantee it'll work in all cases, though.)

    Next, execute a "sudo gedit /etc/esound/esd.conf" and change the file to the following:

    [esd]
    auto_spawn=1
    spawn_options=-terminate -nobeeps -as 2 -d default
    spawn_wait_ms=100
    # default options are used in spawned and non-spawned mode
    default_options=

    Next, go to your Sound control panel in Gnome and enable sound server startup. After this, go to your Multimedia Systems Selector control panel and set it to either ALSA or ESD. Then, reboot your computer.

    After doing this, you can set any application to use alsa or ESD, and you'll hear multiple sounds at once! No more problems playing games that use ALSA and hearing sounds from a Gnome app that uses ESD...
    Why isn't software mixing enabled by default ? And don't most current audio cards / audio chips support hardware mixing ?

  3. #3
    Join Date
    Dec 2004
    Location
    Waterloo Ontario (Canada)
    Beans
    159
    Distro
    Kubuntu 5.10

    Re: HOWTO: Hear multiple sounds at once

    After this, go to your Multimedia Systems Selector control panel and set it to either ALSA or ESD.
    Where would one find this? It's not in my Multimedia menu. Is there a command line for this?
    I seem to have discovered a truly remarkable proof for Fermat's Last Theorem, which this siggie is too small to contain.

  4. #4
    Join Date
    Dec 2004
    Location
    Västerås, Sweden
    Beans
    9
    Distro
    Dapper Drake Testing/

    Re: HOWTO: Hear multiple sounds at once

    Quote Originally Posted by Hikaru79
    Where would one find this? It's not in my Multimedia menu. Is there a command line for this?
    gstreamer-properties

  5. #5
    Join Date
    Dec 2004
    Beans
    75

    Re: HOWTO: Hear multiple sounds at once

    Quote Originally Posted by Hikaru79
    Where would one find this? It's not in my Multimedia menu. Is there a command line for this?
    Hi, use this to access control panel

    gnome-control-center --use-shell

    Can also place a shortcut in Nautilus application:///

  6. #6
    Join Date
    Oct 2004
    Beans
    18

    Re: HOWTO: Hear multiple sounds at once

    Quote Originally Posted by demon666_nl
    Why isn't software mixing enabled by default ? And don't most current audio cards / audio chips support hardware mixing ?
    Nope. A lot of cheap ones that come onboard do not.

  7. #7
    Join Date
    Oct 2004
    Location
    Netherlands
    Beans
    2,983
    Distro
    Ubuntu 8.04 Hardy Heron

    Re: HOWTO: Hear multiple sounds at once

    Quote Originally Posted by iwasbiggs
    Nope. A lot of cheap ones that come onboard do not.
    So why isn't hardware mixing enabled by default ? And if it is unknown whether the card/chip supports it then switch automatically to software mixing.

  8. #8
    Join Date
    Nov 2004
    Location
    Roma, Italia
    Beans
    279

    Re: HOWTO: Hear multiple sounds at once

    I don't know why, but it's enough to said that in the alsa's faqs they still mention they don't have software mixing and it will never be implemented!!
    Yeah, I love this hacker non-sense

  9. #9
    Join Date
    Dec 2004
    Location
    UK
    Beans
    18

    Re: HOWTO: Hear multiple sounds at once

    Thanks this works great on my nForce soundcard. However, it needed a couple of tweaks.

    1. I used hw: 0,2 to output through the SPDIF.
    2. Using
    -d default
    caused crackling and pops in anything played back through the esd. Using
    -d <device default points at>
    dmixer in your case fixed that.

    I'm stuck with GStreamer using esd though as setting it to use ALSA caues it to lock up.

  10. #10
    Join Date
    Nov 2004
    Location
    Purdue University, Indiana
    Beans
    816
    Distro
    Dapper Drake Testing/

    Re: HOWTO: Hear multiple sounds at once

    I can see why you would need to use 0,2 for your soundcard...some computers have the modem or some other device set as 0,1 so this would cause problems for you.. But having to use dmixer instead of default is kind of odd...I've never had to do that before to get clear sounds through ESD. (I've used this exact setup on several different computers...this is mostly needed with cheap integrated soundcards.) For gstreamer, do you have gstreamer0.8-alsa (I think that's the name of the package) installed?

    DMIX is the plugin for ALSA that allows software mixing...it comes standard with ALSA, so I don't know why the ALSA website would say they don't support software mixing. This HOWTO is written mostly from the DMIX howto over at the ALSA site! Of course, that one goes into much more detail...

Page 1 of 4 123 ... LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •