reckfellENGINE

AudioStreamWav

A sampled-audio resource with format, sample rate and looping.

On this page
class AudioStreamWavReckfellSharpInherits AudioStream

AudioStreamWav stores sound data and the settings needed to interpret it. The teaching example uses Format16Bits, mono little-endian PCM: two bytes per sample without a RIFF/WAV header in Data. MixRate specifies sample rate; player position uses seconds.

LoopBegin and LoopEnd use audio-frame indices, not seconds or bytes. A stereo frame contains two channels. Imported resources may use another supported compression format: do not interpret all Data as PCM16. Resources can be shared; changing settings affects their users.

Working example.

Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.

Constructors1

AudioStreamWavConstructor
# AudioStreamWav
C#
public AudioStreamWav();

Properties8

DataProperty
# Data
C#
public byte[] Data { get; set; }

Audio bytes in the encoding identified by Format. For QOA and IMA ADPCM these are compressed data, not raw 16-bit PCM. This is not an ordinary source WAV header plus payload; account for Stereo and MixRate when interpreting PCM.

FormatProperty
# Format
C#
public AudioStreamWav.FormatEnum Format { get; set; }

Audio format.

LoopBeginProperty
# LoopBegin
C#
public int LoopBegin { get; set; }

Loop start in sample frames of the processed resource, not seconds. At 48000 Hz, frame 12000 is 0.25 seconds; do not multiply by channel count for stereo.

LoopEndProperty
# LoopEnd
C#
public int LoopEnd { get; set; }

Loop end in resource sample frames. A negative import setting such as −1 is resolved by the importer before storing this property; do not confuse it with Ogg/MP3 LoopOffset seconds.

LoopModeProperty
# LoopMode
C#
public AudioStreamWav.LoopModeEnum LoopMode { get; set; }

The loop mode.

MixRateProperty
# MixRate
C#
public int MixRate { get; set; }

Resource sample rate in Hz. After an import rate cap, inspect both MixRate and data size; setting force/max_rate_hz without enabling force/max_rate does not activate conversion.

StereoProperty
# Stereo
C#
public bool Stereo { get; set; }

If true, audio is stereo.

TagsProperty
# Tags
C#
public Reckfell.Collections.Dictionary Tags { get; set; }

Contains user-defined tags if found in the WAV data. Commonly used tags include title, artist, album, tracknumber, and date (date does not have a standard date format). Note: No tag is guaranteed to be present in every file, so make sure to account for the keys not always existing. Note: Only WAV files using a LIST chunk with an identifier of INFO to encode the tags are currently supported.

Methods21

GetDatabyte[]
# GetData
C#
public byte[] GetData();
Returns byte[]
GetFormatAudioStreamWav.FormatEnum
# GetFormat
C#
public AudioStreamWav.FormatEnum GetFormat();
Returns AudioStreamWav.FormatEnum
GetLoopBeginint
# GetLoopBegin
C#
public int GetLoopBegin();
Returns int
GetLoopEndint
# GetLoopEnd
C#
public int GetLoopEnd();
Returns int
GetLoopModeAudioStreamWav.LoopModeEnum
# GetLoopMode
C#
public AudioStreamWav.LoopModeEnum GetLoopMode();
Returns AudioStreamWav.LoopModeEnum
GetMixRateint
# GetMixRate
C#
public int GetMixRate();
Returns int
GetTagsReckfell.Collections.Dictionary
# GetTags
C#
public Reckfell.Collections.Dictionary GetTags();
Returns Reckfell.Collections.Dictionary
IsStereobool
# IsStereo
C#
public bool IsStereo();
Returns bool
LoadFromBuffer2 overloads
# LoadFromBuffer · 1/2
C#
public static AudioStreamWav LoadFromBuffer(byte[] streamData, Reckfell.Collections.Dictionary options = null);

Creates a new AudioStreamWav instance from the given buffer. The buffer must contain WAV data. The keys and values of options match the properties of ResourceImporterWav. The usage of options is identical to AudioStreamWav.LoadFromFile.

Parameters
NameTypeDefault
streamDatabyte[]—
optionsReckfell.Collections.Dictionarynull
Returns AudioStreamWav
# LoadFromBuffer · 2/2
C#
public static AudioStreamWav LoadFromBuffer(ReadOnlySpan<byte> streamData, Reckfell.Collections.Dictionary options);

Creates a new AudioStreamWav instance from the given buffer. The buffer must contain WAV data. The keys and values of options match the properties of ResourceImporterWav. The usage of options is identical to AudioStreamWav.LoadFromFile.

Parameters
NameTypeDefault
streamDataReadOnlySpan<byte>—
optionsReckfell.Collections.Dictionary—
Returns AudioStreamWav
LoadFromFileAudioStreamWav
# LoadFromFile
C#
public static AudioStreamWav LoadFromFile(string path, Reckfell.Collections.Dictionary options = null);

Reads a raw audio file directly without applying editor .import settings. Use ResourceLoader.Load for a project asset with its imported settings. Pass WAV conversion settings in options; default compression without options is PCM, not the editor importer’s QOA.

Parameters
NameTypeDefault
pathstring—
optionsReckfell.Collections.Dictionarynull
path

Path to the actual source file. Ensure it is available in the chosen build; an imported resource path does not guarantee the original bytes are shipped.

options

Conversion settings such as force/mono and compress/mode. This is an explicit dictionary; .import values are not supplied automatically.

Returns AudioStreamWav

Loaded audio resource, or null on a reading/format error. Check the result before playback.

SaveToWavError
# SaveToWav
C#
public Error SaveToWav(string path);

Saves existing stream data as WAV. Does not start microphone capture or verify useful signal. The checked PCM16 file reloaded with matching rate, stereo, and duration.

Parameters
NameTypeDefault
pathstring—
path

Output path, usually user://recording.wav. The implementation appends .wav when missing; check directory access.

Returns Error

Error.Ok on success; handle other codes. This method cannot save IMA ADPCM or QOA; the example creates PCM16.

SetData2 overloads
# SetData · 1/2
C#
public void SetData(byte[] data);
Parameters
NameTypeDefault
databyte[]—
# SetData · 2/2
C#
public void SetData(ReadOnlySpan<byte> data);
Parameters
NameTypeDefault
dataReadOnlySpan<byte>—
SetFormatvoid
# SetFormat
C#
public void SetFormat(AudioStreamWav.FormatEnum format);
Parameters
NameTypeDefault
formatAudioStreamWav.FormatEnum—
SetLoopBeginvoid
# SetLoopBegin
C#
public void SetLoopBegin(int loopBegin);
Parameters
NameTypeDefault
loopBeginint—
SetLoopEndvoid
# SetLoopEnd
C#
public void SetLoopEnd(int loopEnd);
Parameters
NameTypeDefault
loopEndint—
SetLoopModevoid
# SetLoopMode
C#
public void SetLoopMode(AudioStreamWav.LoopModeEnum loopMode);
Parameters
NameTypeDefault
loopModeAudioStreamWav.LoopModeEnum—
SetMixRatevoid
# SetMixRate
C#
public void SetMixRate(int mixRate);
Parameters
NameTypeDefault
mixRateint—
SetStereovoid
# SetStereo
C#
public void SetStereo(bool stereo);
Parameters
NameTypeDefault
stereobool—
SetTagsvoid
# SetTags
C#
public void SetTags(Reckfell.Collections.Dictionary tags);
Parameters
NameTypeDefault
tagsReckfell.Collections.Dictionary—

AudioStreamWav.FormatEnum

ValueDescription
Format16Bits = 1

16-bit PCM audio codec.

Format8Bits = 0

8-bit PCM audio codec.

ImaAdpcm = 2

Audio is lossily compressed as IMA ADPCM.

Qoa = 3

Audio is lossily compressed as Quite OK Audio.

AudioStreamWav.LoopModeEnum

ValueDescription
Backward = 3

Audio loops the data between AudioStreamWav.LoopBegin and AudioStreamWav.LoopEnd, playing backward only.

Disabled = 0

Audio does not loop.

Forward = 1

Audio loops the data between AudioStreamWav.LoopBegin and AudioStreamWav.LoopEnd, playing forward only.

Pingpong = 2

Audio loops the data between AudioStreamWav.LoopBegin and AudioStreamWav.LoopEnd, playing back and forth.

Reckfell Engine documentationBack to top ↑
QUICK LINKSGetting startedEntity hierarchyC# & .NET 10Scenes and prefabs
Reckfell guides and full API K
reckfellENGINE
RECKFELL ACCOUNT

Sign in

Sign in to your Reckfell account.

One account for the entire Reckfell platform.