Description
The Pitch
property of the SoundEvent
class represents the base pitch of the sound. It is a RangedFloat
type, allowing you to specify a pitch value within a defined range. This property is used to adjust the pitch of the sound, which can affect the perceived frequency or tone of the audio being played.
Usage
The Pitch
property can be set to any value between 0 and 2, with a step of 0.01. This range allows for a wide variety of pitch adjustments, from lowering the pitch to raising it significantly. The default value is set using the DefaultValueAttribute
.
To modify the pitch of a sound event, simply assign a new value to the Pitch
property:
Example
// Create a new SoundEvent instance
SoundEvent soundEvent = new SoundEvent();
// Set the pitch of the sound event
soundEvent.Pitch = 1.5f;
// This will play the sound with a higher pitch than the default
soundEvent.Play();