
Hi list
I have tried to access the bugtracker at https://bugtrack.alsa-project.org/alsa-bug for a while without luck, so now I will try to post the bug here...
Problem: When recording, audible clicking sounds are present in the resulting audio data.
Analysis: When recording at 48kHz 1024 samples per channel are returned by the snd_pcm_readi function. I made a test app that wrote zeros into the first 20 samples of each recorded buffer in order to 'mark' the beggining of each buffer in the output file and it appears that the clicking noise come from buffer corruption at position 1024-160 samples (160 samples from the end of the buffer).
The corruption are composed of approximately 10 samples, and the nature of the corrupted values are such that they could come from an earlier buffer (the corrupted data resemble wav forms).
Sometimes only a single sample seem to be corrupted (see wavform3.png), but sometimes several (see wavform1.png and wavform2.png).
Usually the number of corrupted samples are the same for both channels.
A sample recording produced by the command: arecord -c 2 -t raw -f S16_LE -r 48000 --disable-resample -d 10 alc662-noise-bug.raw The resulting file can be fetched at http://www.aasimon.org/public/alc662-noise-bug.raw (too big to send by email)
Hardware: Fit-PC2i (Atom Z530). Intel HD driver with ALC662 codec.
Kernel (uname -a): Linux InterCom 3.2.1-gentoo-r2-fitpc2i #1 SMP Tue Dec 11 09:10:23 i686 Intel(R) Atom(TM) CPU Z530 @ 1.60GHz GenuineIntel GNU/Linux
Alsa-lib and utils used were v.1.0.24, but tests with kernel-3.5.7 and alsa-lib/utils-1.0.25 has also been performed with similiar results.
Kernel compiled with asound debug (from .config): CONFIG_SND_DEBUG=y CONFIG_SND_DEBUG_VERBOSE=y CONFIG_SND_PCM_XRUN_DEBUG=y
Log output with "echo 127 > /proc/asound/card0/pcm0c/xrun_debug":
Command run: (arecord -c 2 -t raw -r 48000 -d 0.1 out.raw &) ; sleep 0.015; killall arecord
Dec 10 15:58:46 InterCom kernel: [ 1733.745094] hda-intel: azx_pcm_prepare: bufsize=0x10000, format=0x21 Dec 10 15:58:46 InterCom kernel: [ 1733.745109] hda_codec_setup_stream: NID=0x8, stream=0x2, channel=0, format=0x21 Dec 10 15:58:46 InterCom kernel: [ 1733.749510] hwptr_update: pcmC0D0c:0: pos=209/1024/8192, hwptr=209/0/209/0 Dec 10 15:58:46 InterCom kernel: [ 1733.749553] hwptr_update: pcmC0D0c:0: pos=212/1024/8192, hwptr=3/209/212/0 Dec 10 15:58:46 InterCom kernel: [ 1733.749609] hwptr_update: pcmC0D0c:0: pos=214/1024/8192, hwptr=2/212/214/0 Dec 10 15:58:46 InterCom kernel: [ 1733.749645] hwptr_update: pcmC0D0c:0: pos=216/1024/8192, hwptr=2/214/216/0 Dec 10 15:58:46 InterCom kernel: [ 1733.749664] hwptr_update: pcmC0D0c:0: pos=217/1024/8192, hwptr=1/216/217/0 Dec 10 15:58:46 InterCom kernel: [ 1733.749694] hwptr_update: pcmC0D0c:0: pos=219/1024/8192, hwptr=2/217/219/0 Dec 10 15:58:46 InterCom kernel: [ 1733.749719] hwptr_update: pcmC0D0c:0: pos=220/1024/8192, hwptr=1/219/220/0 Dec 10 15:58:46 InterCom kernel: [ 1733.749738] hwptr_update: pcmC0D0c:0: pos=221/1024/8192, hwptr=1/220/221/0 Dec 10 15:58:46 InterCom kernel: [ 1733.749767] hwptr_update: pcmC0D0c:0: pos=222/1024/8192, hwptr=1/221/222/0 Dec 10 15:58:46 InterCom kernel: [ 1733.749793] hwptr_update: pcmC0D0c:0: pos=223/1024/8192, hwptr=1/222/223/0 Dec 10 15:58:46 InterCom kernel: [ 1733.749813] hwptr_update: pcmC0D0c:0: pos=224/1024/8192, hwptr=1/223/224/0 Dec 10 15:58:46 InterCom kernel: [ 1733.749841] hwptr_update: pcmC0D0c:0: pos=226/1024/8192, hwptr=2/224/226/0 Dec 10 15:58:46 InterCom kernel: [ 1733.749867] hwptr_update: pcmC0D0c:0: pos=227/1024/8192, hwptr=1/226/227/0 Dec 10 15:58:46 InterCom kernel: [ 1733.749887] hwptr_update: pcmC0D0c:0: pos=228/1024/8192, hwptr=1/227/228/0 Dec 10 15:58:46 InterCom kernel: [ 1733.749914] hwptr_update: pcmC0D0c:0: pos=229/1024/8192, hwptr=1/228/229/0 Dec 10 15:58:46 InterCom kernel: [ 1733.749940] hwptr_update: pcmC0D0c:0: pos=230/1024/8192, hwptr=1/229/230/0 Dec 10 15:58:46 InterCom kernel: [ 1733.749961] hwptr_update: pcmC0D0c:0: pos=231/1024/8192, hwptr=1/230/231/0 Dec 10 15:58:46 InterCom kernel: [ 1733.749989] hwptr_update: pcmC0D0c:0: pos=233/1024/8192, hwptr=2/231/233/0 Dec 10 15:58:46 InterCom kernel: [ 1733.752935] hwptr_update: pcmC0D0c:0: pos=374/1024/8192, hwptr=141/233/374/0 Dec 10 15:58:46 InterCom kernel: [ 1733.752964] hwptr_update: pcmC0D0c:0: pos=376/1024/8192, hwptr=2/374/376/0 Dec 10 15:58:46 InterCom kernel: [ 1733.753002] hwptr_update: pcmC0D0c:0: pos=377/1024/8192, hwptr=1/376/377/0 Dec 10 15:58:46 InterCom kernel: [ 1733.754067] hwptr_update: pcmC0D0c:0: pos=428/1024/8192, hwptr=51/377/428/0 Dec 10 15:58:46 InterCom kernel: [ 1733.754092] hwptr_update: pcmC0D0c:0: pos=430/1024/8192, hwptr=2/428/430/0 Dec 10 15:58:46 InterCom kernel: [ 1733.754129] hwptr_update: pcmC0D0c:0: pos=431/1024/8192, hwptr=1/430/431/0 Dec 10 15:58:46 InterCom kernel: [ 1733.754156] hwptr_update: pcmC0D0c:0: pos=433/1024/8192, hwptr=2/431/433/0 Dec 10 15:58:46 InterCom kernel: [ 1733.754175] hwptr_update: pcmC0D0c:0: pos=434/1024/8192, hwptr=1/433/434/0 Dec 10 15:58:46 InterCom kernel: [ 1733.754204] hwptr_update: pcmC0D0c:0: pos=435/1024/8192, hwptr=1/434/435/0 Dec 10 15:58:46 InterCom kernel: [ 1733.754230] hwptr_update: pcmC0D0c:0: pos=436/1024/8192, hwptr=1/435/436/0 Dec 10 15:58:46 InterCom kernel: [ 1733.754250] hwptr_update: pcmC0D0c:0: pos=437/1024/8192, hwptr=1/436/437/0 Dec 10 15:58:46 InterCom kernel: [ 1733.754278] hwptr_update: pcmC0D0c:0: pos=439/1024/8192, hwptr=2/437/439/0 Dec 10 15:58:46 InterCom kernel: [ 1733.754304] hwptr_update: pcmC0D0c:0: pos=440/1024/8192, hwptr=1/439/440/0 Dec 10 15:58:46 InterCom kernel: [ 1733.754324] hwptr_update: pcmC0D0c:0: pos=441/1024/8192, hwptr=1/440/441/0 Dec 10 15:58:46 InterCom kernel: [ 1733.754351] hwptr_update: pcmC0D0c:0: pos=442/1024/8192, hwptr=1/441/442/0 Dec 10 15:58:46 InterCom kernel: [ 1733.754377] hwptr_update: pcmC0D0c:0: pos=443/1024/8192, hwptr=1/442/443/0 Dec 10 15:58:46 InterCom kernel: [ 1733.754398] hwptr_update: pcmC0D0c:0: pos=444/1024/8192, hwptr=1/443/444/0 Dec 10 15:58:46 InterCom kernel: [ 1733.754425] hwptr_update: pcmC0D0c:0: pos=446/1024/8192, hwptr=2/444/446/0 Dec 10 15:58:46 InterCom kernel: [ 1733.754450] hwptr_update: pcmC0D0c:0: pos=447/1024/8192, hwptr=1/446/447/0 Dec 10 15:58:46 InterCom kernel: [ 1733.754472] hwptr_update: pcmC0D0c:0: pos=448/1024/8192, hwptr=1/447/448/0 Dec 10 15:58:46 InterCom kernel: [ 1733.754501] hwptr_update: pcmC0D0c:0: pos=449/1024/8192, hwptr=1/448/449/0 Dec 10 15:58:46 InterCom kernel: [ 1733.754525] hwptr_update: pcmC0D0c:0: pos=450/1024/8192, hwptr=1/449/450/0 Dec 10 15:58:46 InterCom kernel: [ 1733.754545] hwptr_update: pcmC0D0c:0: pos=451/1024/8192, hwptr=1/450/451/0 Dec 10 15:58:46 InterCom kernel: [ 1733.754575] hwptr_update: pcmC0D0c:0: pos=453/1024/8192, hwptr=2/451/453/0 Dec 10 15:58:46 InterCom kernel: [ 1733.754599] hwptr_update: pcmC0D0c:0: pos=454/1024/8192, hwptr=1/453/454/0 Dec 10 15:58:46 InterCom kernel: [ 1733.754618] hwptr_update: pcmC0D0c:0: pos=455/1024/8192, hwptr=1/454/455/0 Dec 10 15:58:46 InterCom kernel: [ 1733.754647] hwptr_update: pcmC0D0c:0: pos=456/1024/8192, hwptr=1/455/456/0 Dec 10 15:58:46 InterCom kernel: [ 1733.754673] hwptr_update: pcmC0D0c:0: pos=458/1024/8192, hwptr=2/456/458/0 Dec 10 15:58:46 InterCom kernel: [ 1733.754691] hwptr_update: pcmC0D0c:0: pos=458/1024/8192, hwptr=0/458/458/0 Dec 10 15:58:46 InterCom kernel: [ 1733.754718] hwptr_update: pcmC0D0c:0: pos=460/1024/8192, hwptr=2/458/460/0 Dec 10 15:58:46 InterCom kernel: [ 1733.754744] hwptr_update: pcmC0D0c:0: pos=461/1024/8192, hwptr=1/460/461/0 Dec 10 15:58:46 InterCom kernel: [ 1733.754764] hwptr_update: pcmC0D0c:0: pos=462/1024/8192, hwptr=1/461/462/0 Dec 10 15:58:46 InterCom kernel: [ 1733.754791] hwptr_update: pcmC0D0c:0: pos=463/1024/8192, hwptr=1/462/463/0 Dec 10 15:58:46 InterCom kernel: [ 1733.754817] hwptr_update: pcmC0D0c:0: pos=464/1024/8192, hwptr=1/463/464/0 Dec 10 15:58:46 InterCom kernel: [ 1733.754837] hwptr_update: pcmC0D0c:0: pos=465/1024/8192, hwptr=1/464/465/0 Dec 10 15:58:46 InterCom kernel: [ 1733.754865] hwptr_update: pcmC0D0c:0: pos=467/1024/8192, hwptr=2/465/467/0 Dec 10 15:58:46 InterCom kernel: [ 1733.754889] hwptr_update: pcmC0D0c:0: pos=468/1024/8192, hwptr=1/467/468/0 Dec 10 15:58:46 InterCom kernel: [ 1733.754910] hwptr_update: pcmC0D0c:0: pos=469/1024/8192, hwptr=1/468/469/0 Dec 10 15:58:46 InterCom kernel: [ 1733.754940] hwptr_update: pcmC0D0c:0: pos=470/1024/8192, hwptr=1/469/470/0 Dec 10 15:58:46 InterCom kernel: [ 1733.754964] hwptr_update: pcmC0D0c:0: pos=472/1024/8192, hwptr=2/470/472/0 Dec 10 15:58:46 InterCom kernel: [ 1733.754983] hwptr_update: pcmC0D0c:0: pos=472/1024/8192, hwptr=0/472/472/0 Dec 10 15:58:46 InterCom kernel: [ 1733.761111] hda_codec_cleanup_stream: NID=0x8
Thank you in advance.
Kind regards Bent Bisballe Nyeng