Distortion on audio playback
Posted: 28 Apr 2012 18:18
I am experiencing distortion when playing-back audio with VLC 1.1.11. I am using XP and a Dell laptop. At the start of playback of an internet radio stream, the audio is clean but crackles develope and get worse after a few seconds. Pausing playback stops the crackles for a few seconds. So far I have heard it when playing streams with samplerates of 22050 but not 44100. The crackles are single impulses at random intervals and are most noticable when the audio is high-amplitude low-frequency sound, in which case the crackles are easy to hear at the top end of the audio band. There are no crackles if the stream is quiet.
I found that if I go to Tools/Preferences/Audio and change from the default samplerate (shown as "Audio frequency") to force playback at 44100, the distortion clears almost completely, only reappearing for a second or so every few minutes.
The built-in soundcard in my laptop (Sigma-Tel) has a hardware samplerate of 48kHz. Other rates are achieved by software. Some rates, such as 22050, 11025, 8000, are only approximate (22200, 11100, 8100 ). I think this might be a clue to the problem.
I have a Presonus Firebox, a semi-pro firewire sound box. This too has 48kHz hardware rate and the same problem with the 22050/11025/8000 rates, and playback via VLC is distorted through this too. However I can switch the Firebox to a hardware rate of 44.1 kHz and in this condition the 22050 and 11025 rates are exact. There is NO DISTORTION with VLC playback if it is using 44.1 kHz hardware rate.
All these tests lead me to ask whether there may be a problem with the audio re-sampling in VLC. From my own experience with synchronisation of data streams, I am sure that VLC will need to dynamically re-sample the audio from an externally-timed stream to prevent buffer under/overflow to the local soundcard. Other media players seem to manage this well but for me at least VLC seems to be dropping or padding single audio samples when some internal buffer under or overflows. This will sound worse if there is a large difference between the source and sink samplerates.
I can see from other similar topics that this question has arisen before, but I don't see a solution posted and the topics seem to have died. I don't know whether anyone will read an old topic so I am starting a new one.
Later edit:
It's the same with WaveAudio or DirectX.
Message entries like (I don't show duplicates):
main warning: PTS is out of range (-34920), dropping buffer
main warning: output date isn't PTS date, requesting resampling (-40443)
main warning: buffer is 40444 in advance, triggering downsampling
main warning: timing screwed, stopping resampling
Surprise: the SAME distortion (and messages) when playing-back 22050Hz mp3 files from the hard drive. I would not have expected resampling problems playing from a local file! Surely the program can fetch the file data in sync. with the sink!
With my work-around (force playback to 44100Hz), the following messages every few minutes ..
main warning: output date isn't PTS date, requesting resampling (-40001)
main warning: buffer is 40002 in advance, triggering downsampling
main warning: resampling stopped after 7025562 usec (drift: -451)
While the downsampling is active (for 7 secs), the audio is distorted.
regards
Peter
I found that if I go to Tools/Preferences/Audio and change from the default samplerate (shown as "Audio frequency") to force playback at 44100, the distortion clears almost completely, only reappearing for a second or so every few minutes.
The built-in soundcard in my laptop (Sigma-Tel) has a hardware samplerate of 48kHz. Other rates are achieved by software. Some rates, such as 22050, 11025, 8000, are only approximate (22200, 11100, 8100 ). I think this might be a clue to the problem.
I have a Presonus Firebox, a semi-pro firewire sound box. This too has 48kHz hardware rate and the same problem with the 22050/11025/8000 rates, and playback via VLC is distorted through this too. However I can switch the Firebox to a hardware rate of 44.1 kHz and in this condition the 22050 and 11025 rates are exact. There is NO DISTORTION with VLC playback if it is using 44.1 kHz hardware rate.
All these tests lead me to ask whether there may be a problem with the audio re-sampling in VLC. From my own experience with synchronisation of data streams, I am sure that VLC will need to dynamically re-sample the audio from an externally-timed stream to prevent buffer under/overflow to the local soundcard. Other media players seem to manage this well but for me at least VLC seems to be dropping or padding single audio samples when some internal buffer under or overflows. This will sound worse if there is a large difference between the source and sink samplerates.
I can see from other similar topics that this question has arisen before, but I don't see a solution posted and the topics seem to have died. I don't know whether anyone will read an old topic so I am starting a new one.
Later edit:
It's the same with WaveAudio or DirectX.
Message entries like (I don't show duplicates):
main warning: PTS is out of range (-34920), dropping buffer
main warning: output date isn't PTS date, requesting resampling (-40443)
main warning: buffer is 40444 in advance, triggering downsampling
main warning: timing screwed, stopping resampling
Surprise: the SAME distortion (and messages) when playing-back 22050Hz mp3 files from the hard drive. I would not have expected resampling problems playing from a local file! Surely the program can fetch the file data in sync. with the sink!
With my work-around (force playback to 44100Hz), the following messages every few minutes ..
main warning: output date isn't PTS date, requesting resampling (-40001)
main warning: buffer is 40002 in advance, triggering downsampling
main warning: resampling stopped after 7025562 usec (drift: -451)
While the downsampling is active (for 7 secs), the audio is distorted.
regards
Peter