LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Sound is very jerky in some applications (https://www.linuxquestions.org/questions/linux-software-2/sound-is-very-jerky-in-some-applications-338973/)

Belegdol 07-01-2005 02:47 AM

Sound is very jerky in some applications
 
Hi. Since I've upgraded my computer and started to use onboard AC97 soundcard (namely Realtek ALC850) sound in some applications has started to be very jerky, even worse than on my old SB128PCI. I'm using alsa. The problem concerns mainly various emulators: meka, VisualBoy Advance, ZSNES and Gens. OTOH, xmame, zinc, m1 and almost every other application works fine. I am using alsa. What can be wrong? Greets.

foo_bar_foo 07-01-2005 10:45 PM

first see if you can change the output from the emulators to the oss emulation device
for some reason oss emulation often seems to work better than alsa device here for certain things (i have no idea why or how they are different)

and the problem might be in the buffer setup
although the fact that everything works fine accept the emulators seems to say otherwise
alsa uses a ring buffer so the sound chases itself around in circles
and it has to sync up properly
you can play with the buffer in your ~/.asoundrc file
i do it in my dmix plugin
but you can make a seperate plugin to use with the emuators if you have to
here are some peoples examples
http://www.alsa-project.org/alsa-doc...odule=intel8x0

take a look at the output from
cat /proc/asound/card0/pcm0p/sub0/hw_params

my sound card is different but
i found the default-times-hardware settings didn't work so i set
period_time 2
and
buffer_size 2052

and didn't set anything else and things got better to the point of being fine now
the default period time or even what the values represent (bytes or usecs) or exactly how to calculate them aludes me so i had to go trial and error
if it starts fine then later gets all weird that's how long it takes for the sync to get off within the loop -- perhaps the lag in the emulation layer has an effect on this syncronization

Belegdol 07-02-2005 02:35 AM

Hmm, have a look at my .asoundrc:
Quote:

pcm.asymed {
type asym
playback.pcm "dmix"
capture.pcm "dsnoop"
}
pcm.!default {
type plug
slave.pcm "asymed"
}
The sound is jerky regardless of its presence. But I have noticed that these emus use SDL for sound output, and also that exporting SDL_AUDIODRIVER=dsp makes the situation much better. So I guess the problem lies on SDL<>alsa interaction.

foo_bar_foo 07-02-2005 12:55 PM

yea there is something about dsp that works better -- as for .asoundrc what i meant is try this and play with the settings by commenting or uncommenting various values. of course back up your old one first.
Code:

pcm.asymed {
type asym
playback.pcm "dmixer"
capture.pcm "dsnoop"
}
pcm.dsp {
    type plug
    slave.pcm "dmixer"
    slave.pcm "dsnoop"
}

pcm.dsp0 {
    type plug
    slave.pcm "dmixer"
    slave.pcm "dsnoop"
}
pcm.!default {
type plug
slave.pcm "asymed"
}
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 # don't really understand this one
        #  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
        }
    }


dreamlax 03-08-2006 10:32 PM

Hey cool, this worked a charm for me (sorry to revive a dead thread). I was not only experiencing choppy sound, it was also lagged by about 250 milliseconds. I'll add some keywords so people can find this problem easily.

ALSA sound lag lagged delay choppy emulator scratchy barbeque


All times are GMT -5. The time now is 10:22 AM.