Sound.WriteSamples

void WriteSamples(Single[]& samples)

Only works if this Sound is a stream type! This writes a number of audio samples to the sample buffer, and samples should be between -1 and +1. Streams are stored as ring buffers of a fixed size, so writing beyond the capacity of the ring buffer will overwrite the oldest samples.

StereoKit uses 48,000 samples per second of audio.

   
Single[]& samples An array of audio samples, where each sample is between -1 and +1.
void WriteSamples(Single[]& samples, int sampleCount)

Only works if this Sound is a stream type! This writes a number of audio samples to the sample buffer, and samples should be between -1 and +1. Streams are stored as ring buffers of a fixed size, so writing beyond the capacity of the ring buffer will overwrite the oldest samples.

StereoKit uses 48,000 samples per second of audio.

   
Single[]& samples An array of audio samples, where each sample is between -1 and +1.
int sampleCount You can use this to write only a subset of the samples in the array, rather than the entire array!
void WriteSamples(IntPtr samples, int sampleCount)

Only works if this Sound is a stream type! This writes a number of audio samples to the sample buffer, and samples should be between -1 and +1. Streams are stored as ring buffers of a fixed size, so writing beyond the capacity of the ring buffer will overwrite the oldest samples.

StereoKit uses 48,000 samples per second of audio.

This variation of the method bypasses marshalling memory into C#, so it is the most optimal way to copy sound data if your source is already in native memory!

   
IntPtr samples A pointer to a native array of float audio samples, where each sample is between -1 and +1.
int sampleCount You can use this to write only a subset of the samples in the array, rather than the entire array!




Found an issue with these docs, or have some additional questions? Create an Issue on Github!