RangedFloat Pitch { get; set; }

book_4_sparkGenerated
code_blocksInput

Description

The Pitch property of the SoundEvent class represents the base pitch of the sound. It is a RangedFloat type, allowing you to adjust the pitch of the sound within a specified range. This property is useful for altering the frequency of the sound, making it higher or lower.

Usage

The Pitch property can be set to a value between 0 and 2, with a default step of 0.01. This range allows for a wide variety of pitch adjustments, from halving the pitch to doubling it. The property is public and can be accessed and modified directly.

Example

// Example of setting the Pitch property
SoundEvent soundEvent = new SoundEvent();
soundEvent.Pitch = 1.5f; // Sets the pitch to 1.5, which is 50% higher than the normal pitch

// Example of getting the Pitch property
float currentPitch = soundEvent.Pitch;
// currentPitch will be 1.5 in this case