SetSoundPitch(string soundObjectName, float pitch)
This function sets the pitch of ambient or 3D sound soundObjectName to pitch.
Specifies the ambient or 3D sound name. You can also use the name “this” for this parameter. In this case, “this” string refers to the name of the sound to which this script is attached.
pitch of 3D or ambient sound soundObjectName. This value must be greater than 0.0.
function Init() SetSoundPitch("sound1", 1.5) end function Update() end
This script sets the pitch of sound “sound1” to 1.5.
--Name of script is SetSoundPitch2.lua function Init() SetSoundPitch("this", 0.5) end function Update() end
Assume that the above script named SetSoundPitch2.lua is attached to a sound object named “sound1”. In this case, string “this” in the SetSoundPitch function will be equal to “sound1”. In our example, the function SetSoundPitch sets the pitch of current sound, which is “sound1”, to 0.5.SetSoundPitch