Alright, so I have a small program in which user can control the output frequency of the audio signal and play songs (in theory :) ).
I generate the sine wave myself in code by figuring out how many points it will take for a single period of that waveform given it's sampled at 44100Hz. Like this:
for (int k = 0; k < points_sine_wave; k++)
{
// Generate sine wave
sineWave[k] = pow(2.0,10) * (sin(2*3.14159*f*td*k + old_angle) + 1);
}
td is delta t (constant), f is frequency, k is just an index. To ensure continuity of the sine wave when the frequency changes, I use old_angle which is saved to remember which angle to resume from. I checked the waveforms generated here and it works (the sine wave remains continuous but will change frequency). The +1 is to make everything positive.
Now, depending on what I put into that pow(2.0, x), I may not be able to hear low frequencies. It seems like at 2^7, I can hear everything just fine (100Hz is something of interest), but if I go to 2^6 or 2^5, I cannot hear the low frequency anymore.
I looked at my output through Audacity, and noticed that high frequency components always occupy the whole vertical range (-1 to 1), while the low frequency are kind of between -0.4 and 0.4.
Why is that? The signal I write to the buffer is all the same max amplitude (checked in Matlab - can post this if you'd like).
The format is set to PCM, the # of bits is 32 and # of valid bits is also 32 (although 32 seems to rail everything).