Discussion:
[Alsa-user] Short pauses in playback depending on output volume
Fabian Keller
2017-01-15 08:57:49 UTC
Permalink
Hi all,

While developing an audio software based on PortAudio, I discovered a
surprising problem related to ALSA: I'm getting short pauses in the
audio playback (sounding like typical buffer underruns) depending on
the audio amplitude.

As a test, I have generated two wave files containing pure white
noise. One of them with an amplitude of 0.5 the other one using a full
range amplitude of 1.0. I'm playing both files with aplay, but I'm
getting the same behavior with other players and also with the
software I'm developing: The 0.5 amplitude files plays without any
issues. But the 1.0 amplitude file plays with short breaks in the
audio stream. I'm getting about two of these breaks per minute, but
there does not seem to be a deterministic pattern. I would guess the
pauses are <100 ms in duration, which is why I was debugging in the
direction of buffer underruns for many days until I discovered this
amplitude effect. I have xruns logging enabled, so I'm pretty sure
this is not related to that.

Do you have any idea what could be causing this?

System specs:
- Ubuntu 14.04. with the default libportaudio2 (based on the last 2014 release)
- Standard Intel onboard sound: PCH [HDA Intel PCH], device 0: ALC892
Analog [ALC892 Analog]

Another test: Amplitude 0.9 also has breaks, so it is not just the
full range amplitude.

Thanks,
Fabian
James Shatto
2017-01-19 15:59:30 UTC
Permalink
Does the playback file exist on a slow storage device? I have a few
usb sticks that pause with cd quality wav files because of the slow
I/O of the device. But the same file compressed to flac or mp3 on the
same storage device will play without pauses. Or the cd quality file
on any "faster" device, even sdhc cards plays without pauses.

It could be a power management issue and hardware related. Swapping
around the ports that things are plugged into or using a powered hub
can help, sometimes.

Try running something like nmon when you trigger the issue. With "L"
for cpu, it can be a little more informative. With a blue "w" when
it's waiting on something from the system. Which might indicate
hardware type issues like bus speed or swap usage. Also check dmesg
for indications of hardware issues (iffy connections).

- James
Post by Fabian Keller
Hi all,
While developing an audio software based on PortAudio, I discovered a
surprising problem related to ALSA: I'm getting short pauses in the
audio playback (sounding like typical buffer underruns) depending on
the audio amplitude.
As a test, I have generated two wave files containing pure white
noise. One of them with an amplitude of 0.5 the other one using a full
range amplitude of 1.0. I'm playing both files with aplay, but I'm
getting the same behavior with other players and also with the
software I'm developing: The 0.5 amplitude files plays without any
issues. But the 1.0 amplitude file plays with short breaks in the
audio stream. I'm getting about two of these breaks per minute, but
there does not seem to be a deterministic pattern. I would guess the
pauses are <100 ms in duration, which is why I was debugging in the
direction of buffer underruns for many days until I discovered this
amplitude effect. I have xruns logging enabled, so I'm pretty sure
this is not related to that.
Do you have any idea what could be causing this?
- Ubuntu 14.04. with the default libportaudio2 (based on the last 2014 release)
- Standard Intel onboard sound: PCH [HDA Intel PCH], device 0: ALC892
Analog [ALC892 Analog]
Another test: Amplitude 0.9 also has breaks, so it is not just the
full range amplitude.
Thanks,
Fabian
------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi
_______________________________________________
Alsa-user mailing list
https://lists.sourceforge.net/lists/listinfo/alsa-user
Fabian Keller
2017-01-22 13:21:32 UTC
Permalink
Thanks for your ideas! I didn't know nmon, interesting tool. But
unfortunately it shows nothing unusual when a glitch happens,
everything seems to be in a steady state: ~5% CPU load and no "Huge
Pages". Also, there are no dmesg messages during playback at all.
Since low volume output has no glitches at all I think there can't be
general problems in that area.

I think it is also safe to exclude the influence of the storage device, because
- In the software I'm developing I'm generating random noise with
reading from files, purely from a (very fast) random number generator.
- The WAV file test is running from a fast SSD.
- I/O would be the same for the full amplitude / half amplitude files,
and the problem remains 100% reproducible just depending on the volume
levels.

Regarding swapping ports: The sound device is just an onboard chipset
and I have my headphones plugged straight to the mainboard jack plug.
In theory there is not much to go wrong in terms of connections.

The only components which might be sensible to audio levels are maybe
the final hardware mixer or something else deep down in the audio
drivers.

Kind regards,
Fabian
Post by James Shatto
Does the playback file exist on a slow storage device? I have a few
usb sticks that pause with cd quality wav files because of the slow
I/O of the device. But the same file compressed to flac or mp3 on the
same storage device will play without pauses. Or the cd quality file
on any "faster" device, even sdhc cards plays without pauses.
It could be a power management issue and hardware related. Swapping
around the ports that things are plugged into or using a powered hub
can help, sometimes.
Try running something like nmon when you trigger the issue. With "L"
for cpu, it can be a little more informative. With a blue "w" when
it's waiting on something from the system. Which might indicate
hardware type issues like bus speed or swap usage. Also check dmesg
for indications of hardware issues (iffy connections).
- James
Post by Fabian Keller
Hi all,
While developing an audio software based on PortAudio, I discovered a
surprising problem related to ALSA: I'm getting short pauses in the
audio playback (sounding like typical buffer underruns) depending on
the audio amplitude.
As a test, I have generated two wave files containing pure white
noise. One of them with an amplitude of 0.5 the other one using a full
range amplitude of 1.0. I'm playing both files with aplay, but I'm
getting the same behavior with other players and also with the
software I'm developing: The 0.5 amplitude files plays without any
issues. But the 1.0 amplitude file plays with short breaks in the
audio stream. I'm getting about two of these breaks per minute, but
there does not seem to be a deterministic pattern. I would guess the
pauses are <100 ms in duration, which is why I was debugging in the
direction of buffer underruns for many days until I discovered this
amplitude effect. I have xruns logging enabled, so I'm pretty sure
this is not related to that.
Do you have any idea what could be causing this?
- Ubuntu 14.04. with the default libportaudio2 (based on the last 2014 release)
- Standard Intel onboard sound: PCH [HDA Intel PCH], device 0: ALC892
Analog [ALC892 Analog]
Another test: Amplitude 0.9 also has breaks, so it is not just the
full range amplitude.
Thanks,
Fabian
------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi
_______________________________________________
Alsa-user mailing list
https://lists.sourceforge.net/lists/listinfo/alsa-user
Loading...