11 Oct
2017
11 Oct
'17
9:16 p.m.
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.