Thread: Playing samples
View Single Post
Old 17 June 2011, 20:42   #1
Lonewolf10
AMOS Extensions Developer
 
Lonewolf10's Avatar
 
Join Date: Jun 2007
Location: near Cambridge, UK
Age: 44
Posts: 1,924
Playing samples

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
Lonewolf10 is offline  
 
Page generated in 0.04864 seconds with 11 queries