GetSoundFrequency()

Syntax

Result = GetSoundFrequency(#Sound [, Channel])
Description
Get the current frequency of the sound.

Parameters

#Sound The sound to use.
Channel (optional) The channel to use. It's the value returned by PlaySound() when using the #PB_Sound_MultiChannel flag.

Return value

Returns the current frequency (in Hz) of the sound.

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")
 
 MessageRequester("Info", "Ok to stop.")
 
 FreeSound(0) ; The sound is freed
 End

See Also

SetSoundFrequency()

Supported OS

Windows

<- FreeSound() - Sound Index - GetSoundPosition() ->