AudioSource.pitch Manual     Reference     Scripting  
Scripting > Runtime Classes > AudioSource
AudioSource.pitch

var pitch : float

Description

The pitch of the audio source.

JavaScript
// Decreases the pitch in the given seconds

var startingPitch = 4;
var timeToDecrease = 5;
@script RequireComponent(AudioSource)
function Start() {
audio.pitch = startingPitch;
}

function Update() {
if(audio.pitch > 0)
audio.pitch -= ((Time.deltaTime * startingPitch) / timeToDecrease);
}