As this neither language- nor platform-specific, I'll post this here. I'm looking into making a tone generator program. As far as I can tell, this involves generating sine waves at different frequencies and amplitudes, a bit like so:-
However, when I pass this to an output device, I either hear nothing at all or some weird "clicking" or "popping". Am I going deaf?Code:int i; double scale; unsigned char ucBuffer; //48KHz sampling rate, 8-bit mono unsigned char *pData; scale = (2 * PI) / 48000; pData = ucBuffer; for (i=0;i<48000;i++) *(pData++) = (unsigned char)sin(i * scale);
I know the code above is too simple to produce anything meaningful, but I'm heading in the right direction, aren't I?