<---- template headericclude ----->
ALSA software mixing (one program sound only bug)
FedoraForum.org - Fedora Support Forums and Community
Page 1 of 3 123 LastLast
Results 1 to 15 of 43
  1. #1
    Jman Guest

    ALSA software mixing (one program sound only bug)

    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:
    Code:
    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. It's just here for your convenience.
    Last edited by Jman; 10th August 2004 at 07:34 PM.

  2. #2
    foolish Guest
    Excelent, thank you. This works great on my computer.

  3. #3
    Join Date
    Mar 2004
    Location
    Quebec
    Posts
    78
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Work fine here, here is my asound.conf :

    Code:
    #
    # 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 :

    Code:
    gconftool-2 -s /system/gstreamer/0.8/default/audiosink -t string "alsasink device=output"
    Jeff Saucier (djf_jeff)
    Fedora profile
    GPG : 0xA9E6E953

  4. #4
    Bana's Avatar
    Bana is offline Retired Community Manager
    Join Date
    Feb 2004
    Location
    Austin, Texas
    Age
    37
    Posts
    581
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Works for me, although does anyone know how to make Helixplayer (alsa realplayer) use the default alsa device?
    http://coolhands.blogspot.com/
    binarybana AT gmail.com

  5. #5
    Jman Guest
    Helixplayer alsa drivers are still being worked on as of a week ago, unfortunately.

  6. #6
    jzke Guest
    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?

  7. #7
    Jman Guest
    You may have to create the file:
    Code:
    touch /etc/asound.conf

  8. #8
    Join Date
    Nov 2003
    Location
    Regensburg, Germany
    Age
    53
    Posts
    447
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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:
    Code:
    #rate 44100
    and it works perfectly now.
    /(bb|[^b]{2})/ -- that is the question!

  9. #9
    kennykongkl Guest
    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.

  10. #10
    jgionet Guest
    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)

  11. #11
    brymaster Guest
    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.

  12. #12
    rega451 Guest
    Quote Originally Posted by Jman
    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 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.

  13. #13
    Join Date
    Jul 2004
    Posts
    37
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Jman
    Edit: If I recall correctly, I got this from this ALSA howto. 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.

  14. #14
    Jman Guest
    Quote Originally Posted by gohanman
    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.

  15. #15
    Join Date
    Jul 2004
    Posts
    37
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.

Page 1 of 3 123 LastLast

Similar Threads

  1. Replies: 3
    Last Post: 23rd June 2009, 08:42 AM
  2. Alsa sound will only play in one program with wine....
    By Kanaric in forum Gamers' Lounge
    Replies: 9
    Last Post: 9th May 2008, 03:13 PM
  3. Video mixing software
    By blackarib in forum Using Fedora
    Replies: 3
    Last Post: 14th March 2006, 07:02 AM
  4. Mixing Simultaneous Sounds In Alsa
    By rega451 in forum Using Fedora
    Replies: 9
    Last Post: 4th March 2005, 12:53 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
[[template footer(Guest)]]