Hi,
I am trying to add a few sound samples to my demo, but I am having trouble calculating the period. I believe I have the correct formula (below), but my results (also below) give me the result of 30 - this gives a short high pitched noise. A period value around 200 gives a better sounding result, but doesn't help me to calculate the proper value for this sample (and other samples).
Code:
Formula for calculating the period
period = frequency (Hz) / (1/sample length (bytes) )
--------------------------------------------
0.281937 (PAL) microseconds per interval
0.279365 (NTSC)
My calculations
period = ( 11025 / 0.0001303 ) / 0.281937
= ( 11025 / 1303 ) / 0.281937
= 30
Am I using the correct formula for calculating the period?
The sample should be played at 11025Hz and is 7673 bytes long.
Regards,
Lonewolf10