I have a really stupid problem here and thought maybe you guys could
help me improve my understanding..
I have a tiny audio program. It consists of two threads. The first
thread uses the xinelib for audio output and reads its input from a
fifo. The second thread creates a sine wave, "converts" it into
WAV/PCM16 format and sends it to the fifo. After it has sent the first
WAV/PCM16 chunk it keeps on looping but only sends the PCM part of the
sine wave without the WAVE header.
Now my problem: the second thread (=sine thread) uses a buffer where it
generates the sine data. Once that buffer is full it writes the whole
buffer to the fifo.
What I experience is that what I hear depends on the size of this
buffer. When I set the buffer size to 44100 samples (which I think
equals 1 second of sound) then I hear a proper sine wave at the right
frequency. When I change it to 22050 still ok. But once I choose for
intance 11025 or 16384 or 8192 or 4096 I get strange stuttering, clicks
or a somewhat modulated sound.
So I thought the problem is my sine generator and compared the output
using different buffer sizes. But it's the same no matter what buffer
size I use.
I can post some code too if that helps and would be grateful for any help.
Thanks
mimo