Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Alsa underrun
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Multimedia
View previous topic :: View next topic  
Author Message
alex6
Apprentice
Apprentice


Joined: 18 Jul 2011
Posts: 172

PostPosted: Fri Apr 26, 2013 8:21 pm    Post subject: Alsa underrun Reply with quote

I often get this message with several apps :

Quote:
ALSA lib pcm.c:7339:(snd_pcm_recover) underrun occurred


lspci :
Quote:
00:14.2 Audio device: Advanced Micro Devices [AMD] nee ATI SBx00 Azalia (Intel HDA)


By the way, my soundcard is VIA VT1708S controry to what lspci shows...

Any idea how to fix this ?
Back to top
View user's profile Send private message
PaulBredbury
Watchman
Watchman


Joined: 14 Jul 2005
Posts: 7310

PostPosted: Fri Apr 26, 2013 9:59 pm    Post subject: Reply with quote

In general, raise the app's priority, because audio is a real-time process.
_________________
Improve your font rendering and ALSA sound
Back to top
View user's profile Send private message
alex6
Apprentice
Apprentice


Joined: 18 Jul 2011
Posts: 172

PostPosted: Sat Apr 27, 2013 10:54 am    Post subject: Reply with quote

Quote:
In general, raise the app's priority, because audio is a real-time process.


Thanks for your reply...Anyway, are you sure it's the good link ? This seems more related to file copy

Should I change my buffer size ?

Quote:
cat /proc/asound/card0/pcm0p/sub0/hw_params

access: MMAP_INTERLEAVED
format: S32_LE
subformat: STD
channels: 2
rate: 48000 (48000/1)
period_size: 1024
buffer_size: 8192


Can it be a problem of frequency rate ? (most of the time default is 44.1, not 48)
Back to top
View user's profile Send private message
PaulBredbury
Watchman
Watchman


Joined: 14 Jul 2005
Posts: 7310

PostPosted: Sat Apr 27, 2013 12:33 pm    Post subject: Reply with quote

alex6 wrote:
This seems more related to file copy

No, it's for *both* nice and ionice.

Quote:
period_size: 1024
buffer_size: 8192

Those are normally OK - I use those values. If getting under-runs, try doubling the buffer_size to 16384.

You should put more effort into understanding that link I gave you, and provide more detail, e.g. what apps? Also, check that your soundcard is configured correctly, e.g. model= and position_fix - google them.
_________________
Improve your font rendering and ALSA sound
Back to top
View user's profile Send private message
alex6
Apprentice
Apprentice


Joined: 18 Jul 2011
Posts: 172

PostPosted: Sat Apr 27, 2013 1:54 pm    Post subject: Reply with quote

Quote:
No, it's for *both* nice and ionice.


Which one of those would be related to sound buffer ?

Quote:
If getting under-runs, try doubling the buffer_size to 16384.


Do you mean with the .asounrc option ? Or is there another way to do that ?

Quote:
what apps ?

A lot of apps, for example : Battle for Wesnoth or Wine (ok, wine has multiple sound issues so maybe it's normal)

Quote:

provide more detail


2 sound cards using the same driver (should be a cause of this problem maybe ?) :
Sound card #0 : VIA VT1708s driver snd_hda_intel
Sound card #1 : nvidia integrated soundcard on the graphic card (I don't need it, can't blacklist it by blacklisting the driver)

Here is how lspci detects it :
http://bpaste.net/show/94589/

Juste In case :

, lspci -vv
http://bpaste.net/show/94593/
aplay -l
http://bpaste.net/show/94595/
aplay -L
http://bpaste.net/show/94596/
Back to top
View user's profile Send private message
PaulBredbury
Watchman
Watchman


Joined: 14 Jul 2005
Posts: 7310

PostPosted: Sat Apr 27, 2013 2:06 pm    Post subject: Reply with quote

alex6 wrote:
Which one of those would be related to sound buffer ?

Neither of them. nice is concerned with getting your app some CPU time when appropriate to stop the buffer from emptying.

Quote:
Do you mean with the .asoundrc option ?

Yes, see buffer_size in the config in my sig, for how it's done.

Quote:
wine has multiple sound issues

Sadly, this is true. E.g. Thief2 can crackle, but luckily Thief2 can use openal instead, which works much better.
Back to top
View user's profile Send private message
alex6
Apprentice
Apprentice


Joined: 18 Jul 2011
Posts: 172

PostPosted: Sat Apr 27, 2013 3:02 pm    Post subject: Reply with quote

About the two cards using the same driver, any idea how to blacklist one card ?

I don't need that soundcard integrated to graphic card ! (can only be source of problems)
Back to top
View user's profile Send private message
PaulBredbury
Watchman
Watchman


Joined: 14 Jul 2005
Posts: 7310

PostPosted: Sat Apr 27, 2013 3:14 pm    Post subject: Reply with quote

Use probe_mask, e.g. I use:

Code:
options snd-hda-intel index=0 probe_mask=1 model=acer-aspire-8930g
Back to top
View user's profile Send private message
alex6
Apprentice
Apprentice


Joined: 18 Jul 2011
Posts: 172

PostPosted: Sat Apr 27, 2013 3:20 pm    Post subject: Reply with quote

found an alternate solution :

http://hennr.name/2011/06/29/how-to-remove-nvidia-hdmi-sound-cards-under-linux

It seems I no longer get these overrun since I did that ! I must check with more apps.
Back to top
View user's profile Send private message
wcg
Guru
Guru


Joined: 06 Jan 2009
Posts: 588

PostPosted: Sat Apr 27, 2013 6:59 pm    Post subject: Reply with quote

Note that the VIA VT1708S is only the codec. The actual sound card is
in your mb chipset:
http://www.hardwaresecrets.com/article/How-On-Board-Audio-Works/28
(Onboard sound in AMD and Nvidia chipsets works the same way as the
sound support in the Intel chipset used as an example in the article.)
_________________
TIA
Back to top
View user's profile Send private message
radio_flyer
Guru
Guru


Joined: 04 Nov 2004
Posts: 317
Location: Northern California

PostPosted: Wed May 08, 2013 7:45 pm    Post subject: Reply with quote

It's not uncommon for my onboard HDA Intel audio to underrun after I log in to my desktop. In my case, the issue is KDE (namely nepomuk/virtuoso) doing its file scanning. On directories with lots of small files it impacts I/O processes, causing audio underruns. The underruns stop once nepomuk/virtuoso stop scanning.

Just an FYI in case you happening to be running KDE.
Back to top
View user's profile Send private message
PaulBredbury
Watchman
Watchman


Joined: 14 Jul 2005
Posts: 7310

PostPosted: Wed May 08, 2013 11:02 pm    Post subject: Reply with quote

radio_flyer wrote:
KDE (namely nepomuk/virtuoso) doing its file scanning

Then that should be run using nice and ionice - see info.

Also, sound-playing apps should have their priority boosted - again, using nice and ionice.
_________________
Improve your font rendering and ALSA sound
Back to top
View user's profile Send private message
radio_flyer
Guru
Guru


Joined: 04 Nov 2004
Posts: 317
Location: Northern California

PostPosted: Thu May 09, 2013 4:24 pm    Post subject: Reply with quote

Quote:

Then that should be run using nice and ionice - see info.


Actually, the nepomuk and virtuoso processes ARE running at a nice level of 19 and an ionice of idle. Even though they consume around 30% on each of my four cores while they're running, they don't noticeable interfere with most desktop tasks.

The problem seems to be that even with those lowest possible nice levels some I/O subsystem itself occasionally stalls when nepomuk/virtuoso is indexing lots of small files while audio is playing at the same time. Most likely either the kernel is running out of I/O buffers, or there is some disk I/O hardware activity/stall happening. I'm fairly certain it's related to the SATA subsystem, as my disk activity LED 'hangs' lit for a second or so at the same time as the audio skips. It may just manifest itself on certain hardware/driver combinations such as my Shuttle. I haven't bothered to dig deeper, as the easy fix is to make sure nepomuk/virtuoso aren't running if the audio stutters. Nepomuk/virtuoso seem more stable on KDE 4.10, and usually finish their new-file indexing and go away a few minutes after logging in anyway.
Back to top
View user's profile Send private message
PaulBredbury
Watchman
Watchman


Joined: 14 Jul 2005
Posts: 7310

PostPosted: Thu May 09, 2013 10:30 pm    Post subject: Reply with quote

Sounds like you need filesystem tweaks to prevent the audio player from being starved of data.

E.g. in /etc/fstab I use:
Code:
/dev/sda1   /   ext4    defaults,noatime,commit=60,nobarrier 1 1


And in /etc/sysctl.conf - see info
Code:
vm.dirty_background_ratio=10
vm.dirty_ratio=30

_________________
Improve your font rendering and ALSA sound
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Multimedia All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum