Share |

Choppy sound under linux/ubuntu

gamma2

Moderator: MisterX

Choppy sound under linux/ubuntu

Postby Jeremie » June 3rd, 2012, 2:26 pm

Hi,

Maybe this is not the best place for such a question; please let me know.
I have bought a y1/y2 full option to a guy that has built it but has upgraded to another DAC.
The product is really great, the sound is wonderful; congrat guys! :D

My concern is under linux (ubuntu 11.10) -the guy is uned windows: I am (still) using pulseaudio (alsa) and mplayer.
When I scroll a window or browse on internet while playing music, I get a choppy sound (many breaks as if music had a lower priority in the system: the music is "chopped", "interrupted" until the system has resources for playing it). If I do not execute anything else during music, all is ok (perfect sound). I tried to "renice" mplayer and pulseaudio processes, but it does not fix the issue.

Do you guy ever know how to configure pulseaudio, alsa, the system and/or mplayer to avoid "jerky" "choppy" sound?

Thanks for your help!
Jérémie
Jeremie
 
Posts: 9
Joined: June 3rd, 2012, 1:48 pm
Country: France (fr)

Re: Choppy sound under linux/ubuntu

Postby amb » June 3rd, 2012, 2:44 pm

I have no such problem using γ1/γ2 under a fairly standard PulseAudio configuration. Make sure your $HOME/.pulse/daemon.conf (or the system-wide /etc/pulse/daemon.conf if you don't have have a personal one) does not specify a different sampling rate than the files you're trying to play, and don't use a CPU-intensive resampling method if you do.
User avatar
amb
Site Admin
 
Posts: 4913
Joined: March 29th, 2010, 9:49 pm
Location: Sunnyvale, CA
Country: United States (us)

Re: Choppy sound under linux/ubuntu

Postby linux-works » June 3rd, 2012, 2:50 pm

change usb ports; see if that helps. also, avoid using usb hubs on linux, it used to be a real problem. go direct to a motherboard port and put nothing else on its twin usb port.

what speed cpu do you have? anything in the last 10 yrs should handle audio with no choppiness.

are you using an ssd, btw?

does it matter if the music is on disk, NAS (do you have one?), opto cd/dvd or even usb media?
Sercona Audio (Control Systems for Analog and Digital)
Photos: http://www.flickr.com/photos/linux-works/
User avatar
linux-works
 
Posts: 1620
Joined: March 31st, 2010, 9:04 am
Location: Santa Clara, CA
Country: United States (us)

Re: Choppy sound under linux/ubuntu

Postby Jeremie » June 5th, 2012, 2:20 pm

All,

Many thanks for your quick answers! :)
I have tried some of your ideas, but unfortunetly the problem is still there.

1-

In my /etc/pulse/daemon.conf, I can find this line: resample-method = speex-float-1
I guess this is what you suspect; correct?
Here it the full content (I have not configured anything more default configuration) with only non commented lines:
resample-method = speex-float-1
flat-volumes = no
default-fragments = 8
default-fragment-size-msec = 10

Commenting the first line ("resample-method = speex-float-1") improves a little (note that for having the configuration being taken into account, I have restarted the pulseaudio daemon with such a command which terminates the daemon: pulseaudio -k. The init process (pid=1) automatically restarts it on my ubuntu 11.10).

I have tried a "test web page"; with the change, the sound becomes choppy after a _longer_ time of "scrolling": around 10 seconds (no resample option) instead of around 5 seconds (with option). Moreover, once the sound has chopped one time, if I scroll again the sound is choppy immediatly. If I wait a long time (about 1 minute), I need to scroll again 10s or 5s ("respectively") to get the choppy sound again. As if a sound buffer in the system were longer or were less used with smaller resampling; nothing else, the problem is still there, just delayed.

But with another "test web page", I can not notice any improvement. So this is not very reproductible... except the choppy sound!

2-

I do not have any USB hub. The PC is a Dell Latitude D820, CPU is a Core2 duo, @1GHz (3990 bogomips per cpu in /proc/cpuinfo). I tried the 4 mother board ports and the problem is the same for all of them. The track sound comes from the motherboard hard disk (no SSD, no NAS, etc); the disk is a relatively high performances one; this is not the original one, it is a WD Scorpio Black 7200trs/mn (WD3200BJKT) - able to run at more than 100Gbps.

So to my mind the issue does not come from the source, all the more that when it occurs, the disk led activity does not hit (all the music is probably already in the 2GB of RAM!).




My global feeling is that something like a wrong priority setting is chopping the audio flow _around the USB_, not in pulseaudio or in mplayer (or VLC btw) because 1) if I change priority of them, nothing is improved and 2) if I used the internal sound card of my PC (not the AMB y2) then there is no choppy sound (in the same conditions).

I suggest to use the PC sound card instead of the y2 since it is not chopping the sound... I'm just kidding ;)

Any other ideas?
Thanks!
Jeremie
 
Posts: 9
Joined: June 3rd, 2012, 1:48 pm
Country: France (fr)

Re: Choppy sound under linux/ubuntu

Postby amb » June 5th, 2012, 11:30 pm

My .pulse/daemon.conf file has these:

high-priority = yes
nice-level = -11
realtime-scheduling = yes
realtime-priority = 5
resample-method = speex-float-3

The only other un-commented lines are:

default-sample-format = s16le
default-sample-rate = 44100
default-fragments = 4
default-fragment-size-msec = 4

The explicit format and sample rate specified in here ensures that no resampling occurs if you are playing 16/44.1K files. This makes the resample-method line moot, but if you play files other than 16/44.1K, then resample-method will be used to resample the audio to the specified rate. On-the-fly resampling is very CPU intensive, and the CPU usage is directly proportional to the quality of the resampling method. Resampling in software should be avoided if possible.

You can google "pulse resampling-method" for info about the various resampling methods if you want to dig deeper.

Btw what's your system processor, speed, cache sizes and RAM size? Are you running other resource-intensive programs at the same time? How loaded is the CPU when it's otherwise "idle"? Is the system constantly paging to/from disk? Maybe there is a separate underlying system issue. Use "xosview" or "gkrellm" (graphical X-based) or "top", "iotop" (curses based) tools to examine the machine.
User avatar
amb
Site Admin
 
Posts: 4913
Joined: March 29th, 2010, 9:49 pm
Location: Sunnyvale, CA
Country: United States (us)

Re: Choppy sound under linux/ubuntu

Postby Jeremie » June 6th, 2012, 2:21 pm

Thanks for your answer! :)

I have tried your configuration: still choppy :(
I have run iotop, top, gkrellm: nothing is giving me any idea :(

However, with xosview, I can notice that with USB DAC, interrupt "11" is constantly running during music, but never hits if I use internal sound card or after a while if no music is played. Interrupt "12" is, on its side, constantly running if I scroll a webpage. I suspect that interrupt 11 has not enough bandwidth when 12 is concurrently running (note also that sometime it is the 11, sometime the 9, sometime the 23, etc.).

I would like to insist on one point: in all experiments I have tried, when I scroll a webpage, the sound is always choppy for the DAC, but never for the internal sound card. One is on USB while another is on PCI. To my mind this is very important: either the USB interrupt is not enough critical, either its rate is too much low, or anything that gets wrong around the USB.

I don't think the issue is due to:
-cpu (core 2 duo @1GHz); note that by the way when music is played, idle is between 90% and 95% (no other "intensive" program); when page are scrolled, it is minimum 40% (source: top);
-ram and cache: 2GB of ram with 1.5GB of free memory (cache: 100% free) (source: gkrellm)
-disk: peaks less than 180kbit/s (source: xosview, gkrellm, iotop), the led is hitting at around 1% of the time (almost identical when no music is played)

So...
Any idea how to measure USB rate, how to increase it? How to get priority of interrupts, how to increase them? At least to understand where the problem comes from...

Thanks!
Jeremie
 
Posts: 9
Joined: June 3rd, 2012, 1:48 pm
Country: France (fr)

Re: Choppy sound under linux/ubuntu

Postby MisterX » June 6th, 2012, 3:26 pm

Try changing a few of the settings and see if it helps any

For instance change:
default-fragments = 7
default-fragment-size-msec = 9
(defaults are 4 & 25 respectively)

and also try tweaking the resampler settings:

resample-method = speex-float-1

(settings, from best to worst are: src-sinc-best-quality, src-sinc-medium-quality, src-sinc-fastest, speex-float-{10-0}, speex-fixed-{10-0}, ffmpeg, src-zero-order-hold, src-linear, trivial (CPU usage scales with quality)
1352.5 and counting.
User avatar
MisterX
 
Posts: 791
Joined: March 31st, 2010, 2:00 am
Location: Kalamazoo, MI
Country: United States (us)

Choppy sound under linux/ubuntu

Postby amb » June 6th, 2012, 3:29 pm

Have you tried using different USB ports to see if it makes any difference? On some computers not all USB ports are the same.
User avatar
amb
Site Admin
 
Posts: 4913
Joined: March 29th, 2010, 9:49 pm
Location: Sunnyvale, CA
Country: United States (us)

Re: Choppy sound under linux/ubuntu

Postby ShinyFalcon » June 6th, 2012, 3:41 pm

If you run something CPU intensive like linpack (don't go overboard with the stress testing) , does it cause audio breakup? Is graphics hardware acceleration on as well?
ShinyFalcon
 
Posts: 80
Joined: April 1st, 2010, 5:37 pm
Location: Houston, TX
Country: United States (us)

Re: Choppy sound under linux/ubuntu

Postby linux-works » June 6th, 2012, 4:01 pm

some pc's are just badly implemented. bios, interrupt structure are 2 culprits.

if your video causes starvation, I'd perhaps blame your video card! is that swappable? can you try a diff one?

I remember old matrox cards used to 'bus steal' just to get better perf times and it would cause audio and other pci drop-outs.

you could TRY a pci card that has usb ports on it. that might give it its own fighting chance but its a bit extreme. still, maybe better than swapping a whole video card out.

if you did not do anything strange to your linux install, I would not think its a software issue at all.

and btw, some onboard usb ports are STILL behind hubs even though they seem to be 'motherboard based'. if you tried a cheap pci card of usb2.0 ports (I would actually avoid the usb3 ports) that could give you an easy work-around.
Sercona Audio (Control Systems for Analog and Digital)
Photos: http://www.flickr.com/photos/linux-works/
User avatar
linux-works
 
Posts: 1620
Joined: March 31st, 2010, 9:04 am
Location: Santa Clara, CA
Country: United States (us)

Next

Return to γ2 compact high-performance DAC

Who is online

Users browsing this forum: No registered users and 0 guests

Quick Links

AMB audio DIY resources
AMB audio shop