SetSoundFrequency()

Syntax

SetSoundFrequency(#Sound, Frequency [, Channel])
Description
Set the new frequency, in real-time, for the sound. The new frequency value is saved for the sound, so it's not needed to call it every time.

Parameters

#Sound The sound to use.
Frequency The sound new frequency (in Hz) to set. Valid values are from 1000 Hz to 100000 Hz.
Channel (optional) The channel to use. It's the value returned by PlaySound() when using the #PB_Sound_MultiChannel flag. If #PB_All is specified, all the channels of the sound are affected.

Return value

None.

Example

 InitSound()           ; Initialize Sound system
 UseOGGSoundDecoder()  ; Use ogg files

 ; Loads a sound from a file
 LoadSound(0, #PB_Compiler_Home +"Examples\3D\Data\Siren.ogg")
 ; The sound is playing
 PlaySound(0, #PB_Sound_Loop, 20)
 
 MessageRequester("Info", "The average frequency is " + Str(GetSoundFrequency(0))+" Hz")
 PauseSound(0)
 
 SetSoundFrequency(0,16000)
 
 ResumeSound(0)
 
 MessageRequester("Info", "The average frequency is " + Str(GetSoundFrequency(0))+" Hz")
 
 FreeSound(0) ; The sound is freed
 End

See Also

GetSoundFrequency()

Supported OS

Windows

<- ResumeSound() - Sound Index - SetSoundPosition() ->