Task<System.Int16[]> GetSamplesAsync()

robot_2Generated
code_blocksInput

Description

The GetSamplesAsync method asynchronously requests decompressed audio samples from a SoundFile object. This method is useful for obtaining raw audio data for further processing or analysis.

Usage

To use the GetSamplesAsync method, you must have an instance of the SoundFile class. Call this method to retrieve the audio samples as an array of Int16 values. The method returns a Task<Int16[]>, which can be awaited to get the result once the operation is complete.

Example

// Example of using GetSamplesAsync
async Task ProcessAudioSamplesAsync(SoundFile soundFile)
{
    if (soundFile.IsLoaded)
    {
        Int16[] samples = await soundFile.GetSamplesAsync();
        // Process the samples here
    }
    else
    {
        // Handle the case where the sound file is not loaded
    }
}