Description
The Rate
property of the SoundFile
class represents the sample rate of the sound file, measured in samples per second. This property is crucial for understanding the quality and playback speed of the audio file. A higher sample rate typically indicates better sound quality.
Usage
To access the sample rate of a SoundFile
instance, simply use the Rate
property. This property is read-only and provides an integer value representing the number of samples per second.
Example
// Example of accessing the Rate property
SoundFile soundFile = SoundFile.Load("path/to/soundfile.wav");
int sampleRate = soundFile.Rate;
// Output the sample rate
// Note: Avoid using Console.WriteLine in s&box
// Instead, use the appropriate logging or UI display method
Log.Info($"Sample Rate: {sampleRate} samples per second");