; ChannelPitch Example ; -------------------- Graphics 640,480,0,2 SetBuffer BackBuffer() ; A short tone looped endlessly gives us a steady engine hum snd=LoadSound("media/beep.wav") LoopSound snd channel=PlaySound(snd) ; beep.wav was recorded at 11025 hertz - its natural pitch hertz=11025 While Not KeyDown(1) ; Hold Up/Down to rev the engine like a siren If KeyDown(200) And hertz<33000 Then hertz=hertz+150 If KeyDown(208) And hertz>2000 Then hertz=hertz-150 ; ChannelPitch retunes the channel WHILE it plays - no need to ; restart it. (SoundPitch instead changes the sound for future ; PlaySound calls.) ChannelPitch channel,hertz Cls ; A frequency meter: the bar grows with the hertz value Color 100,100,100 Rect 100,240,441,20,False Color 255,180,80 Rect 102,242,(hertz-2000)*437/31000,16 Color 255,255,255 Text 0,0,"Up/Down: rev the live channel Esc: exit" Text 0,20,"ChannelPitch channel,"+hertz+" (recorded at 11025 Hz)" Flip Wend StopChannel channel End