LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 07-01-2005, 02:47 AM   #1
Belegdol
Member
 
Registered: Oct 2003
Location: Poland
Distribution: Fedora 7
Posts: 59

Rep: Reputation: 15
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.
 
Old 07-01-2005, 10:45 PM   #2
foo_bar_foo
Senior Member
 
Registered: Jun 2004
Posts: 2,553

Rep: Reputation: 53
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

Last edited by foo_bar_foo; 07-01-2005 at 10:53 PM.
 
Old 07-02-2005, 02:35 AM   #3
Belegdol
Member
 
Registered: Oct 2003
Location: Poland
Distribution: Fedora 7
Posts: 59

Original Poster
Rep: Reputation: 15
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.
 
Old 07-02-2005, 12:55 PM   #4
foo_bar_foo
Senior Member
 
Registered: Jun 2004
Posts: 2,553

Rep: Reputation: 53
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
	}
    }
 
Old 03-08-2006, 10:32 PM   #5
dreamlax
LQ Newbie
 
Registered: Nov 2005
Distribution: Slackware
Posts: 3

Rep: Reputation: 0
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
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
SDL sound is very jerky Belegdol Linux - Software 0 07-01-2005 12:55 PM
Sound and running applications gbj Linux - General 4 10-24-2004 07:04 AM
Several sound-applications at the same time atlesn Linux - General 2 04-27-2004 01:36 PM
No sound in various applications Imek Linux - General 1 02-14-2004 12:23 PM
No sound in 3D applications Mega Man X Slackware 1 08-14-2003 09:48 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 01:50 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration