int BitsPerSample { get; set; }

book_4_sparkGenerated
code_blocksInput

Description

The BitsPerSample property of the SoundFile class represents the number of bits used for each sample in the sound file. This property is crucial for determining the audio quality and file size, as higher bits per sample generally indicate better sound quality and larger file size.

Usage

To access the BitsPerSample property, you need to have an instance of the SoundFile class. This property is read-only and provides information about the audio file's bit depth.

Example

// Example of accessing the BitsPerSample property
SoundFile soundFile = SoundFile.Load("path/to/soundfile.wav");
int bitsPerSample = soundFile.BitsPerSample;

// Output the bits per sample
// Note: Replace 'path/to/soundfile.wav' with the actual file path
System.Console.WriteLine($"Bits Per Sample: {bitsPerSample}");