You are not logged in.

#1 2008-04-14 17:39:16

corrupt
Member
Registered: 2007-06-25
Posts: 74

threaded alsa sound noise issues

Hello, everyone!
I'm trying to make alsa work in threaded mode, i.e. allow more than one application to produce sounds.
All I've done so far is made /etc/asound.conf
As you can see from this config I use dmix to mix different sound threads

#/etc/asound.conf start:
pcm.!default {
    type plug
    slave.pcm "dmixer"
}


pcm.dsp0 {
    type plug
    slave.pcm "dmixer"
}
pcm.dmixer {
    type dmix
    ipc_key 1024
    slave {
        pcm "hw:0,0"
        period_time 0
        period_size 2048
        buffer_size 32768
        rate 48000   #many new cards are 48000 only
    }
    bindings {
        0 0
        1 1
    }
}

ctl.dmixer {
    type hw
    card 0
}

#end.

So I use dmixer as a default mixer. Now I can get reasonably good sound in xmms/audacious+firefox+mplayer/xine.
Without this config alsa worked only for one application at a time.
The only issue I have with alsa is sometimes noise from for example bass,i.e. low frequencies. But sometimes noise limited to very short time intervals appears out of nowhere. It's very annoying. SDL or oss don't produce such noise but they want full access to /dev/dsp and the whole point of threaded sound is violated.
Any critical input about or useful thoughts on reducing sound noise are appreciated.

ps I have old audio card CMedia with 2.1 support.

Last edited by corrupt (2008-04-14 17:40:32)

Offline

#2 2008-04-14 17:52:27

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: threaded alsa sound noise issues

SDL will use ALSA if told - put this in ~/.bashrc

# http://www.libsdl.org/cgi/docwiki.cgi/SDL_5fenvvars
# http://www.libsdl.org/faq.php?action=listentries&category=3
export SDL_AUDIODRIVER=alsa

For the "chirping", all I can suggest is to experiment with different values for period_size and buffer_size.

Offline

Board footer

Powered by FluxBB