[alsa-devel] Click sound when playing "silence" buffer

Владимир Мартьянов vilgeforce at gmail.com
Wed Oct 11 21:16:50 CEST 2017


Hello! I'm completely new to ALSA and I tried to do a simply buzzer using it.

During the debug I noticed a strange behaviour: I used
SND_PCM_FORMAT_S8 format, tried to play the buffer filled with zero
bytes and I heard click sound when my program starts and end playing
the buffer. When I filled the buffer with 0x80 bytes I didn't hear any
clicks. The closer the bytes value to 0x80, the quieter the click is.

I tried snd_pcm_format_set_silence() instead of memset() and got
clicks too. Why I got them?

Does it mean what when I use some formats, the values in buffer for
zero output voltage are not 0x00?

My source code is in attachment, my sound card is Intel HDA.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: main.cpp
Type: text/x-c++src
Size: 1431 bytes
Desc: not available
URL: <http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20171011/722707fe/attachment-0001.bin>


More information about the Alsa-devel mailing list