reckfellENGINE

AudioStreamRandomizer

Wraps a pool of audio streams with pitch and volume shifting.

On this page
class AudioStreamRandomizerReckfellSharpInherits AudioStream

Wraps a pool of audio streams with pitch and volume shifting.

Picks a random AudioStream from the pool, depending on the playback mode, and applies random pitch shifting and volume shifting during playback.

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

Constructors1

AudioStreamRandomizerConstructor
# AudioStreamRandomizer
C#
public AudioStreamRandomizer();

Properties5

PlaybackModeProperty
# PlaybackMode
C#
public AudioStreamRandomizer.PlaybackModeEnum PlaybackMode { get; set; }

Controls how this AudioStreamRandomizer picks which AudioStream to play next.

RandomPitchProperty
# RandomPitch
C#
public float RandomPitch { get; set; }

The largest possible frequency multiplier of the random pitch variation. Pitch will be randomly chosen within a range of [code skip-lint]1.0 / random_pitch and [code skip-lint]random_pitch. A value of 1.0 means no variation. A value of 2.0 means pitch will be randomized between double and half. Note: Setting this property also sets AudioStreamRandomizer.RandomPitchSemitones.

RandomPitchSemitonesProperty
# RandomPitchSemitones
C#
public float RandomPitchSemitones { get; set; }

The largest possible distance, in semitones, of the random pitch variation. A value of 0.0 means no variation. Note: Setting this property also sets AudioStreamRandomizer.RandomPitch.

RandomVolumeOffsetDbProperty
# RandomVolumeOffsetDb
C#
public float RandomVolumeOffsetDb { get; set; }

The intensity of random volume variation. Volume will be increased or decreased by a random value up to [code skip-lint]random_volume_offset_db. A value of 0.0means no variation. A value of3.0means volume will be randomized between-3.0 dBand+3.0 dB`.

StreamsCountProperty
# StreamsCount
C#
public int StreamsCount { get; set; }

The number of streams in the stream pool.

Methods17

AddStreamvoid
# AddStream
C#
public void AddStream(int index, AudioStream stream, float weight = 1f);

Insert a stream at the specified index. If the index is less than zero, the insertion occurs at the end of the underlying pool.

Parameters
NameTypeDefault
indexint—
streamAudioStream—
weightfloat1f
GetPlaybackModeAudioStreamRandomizer.PlaybackModeEnum
# GetPlaybackMode
C#
public AudioStreamRandomizer.PlaybackModeEnum GetPlaybackMode();
Returns AudioStreamRandomizer.PlaybackModeEnum
GetRandomPitchfloat
# GetRandomPitch
C#
public float GetRandomPitch();
Returns float
GetRandomPitchSemitonesfloat
# GetRandomPitchSemitones
C#
public float GetRandomPitchSemitones();
Returns float
GetRandomVolumeOffsetDbfloat
# GetRandomVolumeOffsetDb
C#
public float GetRandomVolumeOffsetDb();
Returns float
GetStreamAudioStream
# GetStream
C#
public AudioStream GetStream(int index);

Returns the stream at the specified index.

Parameters
NameTypeDefault
indexint—
Returns AudioStream
GetStreamProbabilityWeightfloat
# GetStreamProbabilityWeight
C#
public float GetStreamProbabilityWeight(int index);

Returns the probability weight associated with the stream at the given index.

Parameters
NameTypeDefault
indexint—
Returns float
GetStreamsCountint
# GetStreamsCount
C#
public int GetStreamsCount();
Returns int
MoveStreamvoid
# MoveStream
C#
public void MoveStream(int indexFrom, int indexTo);

Move a stream from one index to another.

Parameters
NameTypeDefault
indexFromint—
indexToint—
RemoveStreamvoid
# RemoveStream
C#
public void RemoveStream(int index);

Remove the stream at the specified index.

Parameters
NameTypeDefault
indexint—
SetPlaybackModevoid
# SetPlaybackMode
C#
public void SetPlaybackMode(AudioStreamRandomizer.PlaybackModeEnum mode);
Parameters
NameTypeDefault
modeAudioStreamRandomizer.PlaybackModeEnum—
SetRandomPitchvoid
# SetRandomPitch
C#
public void SetRandomPitch(float scale);
Parameters
NameTypeDefault
scalefloat—
SetRandomPitchSemitonesvoid
# SetRandomPitchSemitones
C#
public void SetRandomPitchSemitones(float semitones);
Parameters
NameTypeDefault
semitonesfloat—
SetRandomVolumeOffsetDbvoid
# SetRandomVolumeOffsetDb
C#
public void SetRandomVolumeOffsetDb(float dbOffset);
Parameters
NameTypeDefault
dbOffsetfloat—
SetStreamvoid
# SetStream
C#
public void SetStream(int index, AudioStream stream);

Set the AudioStream at the specified index.

Parameters
NameTypeDefault
indexint—
streamAudioStream—
SetStreamProbabilityWeightvoid
# SetStreamProbabilityWeight
C#
public void SetStreamProbabilityWeight(int index, float weight);

Set the probability weight of the stream at the specified index. The higher this value, the more likely that the randomizer will choose this stream during random playback modes.

Parameters
NameTypeDefault
indexint—
weightfloat—
SetStreamsCountvoid
# SetStreamsCount
C#
public void SetStreamsCount(int count);
Parameters
NameTypeDefault
countint—

AudioStreamRandomizer.PlaybackModeEnum

ValueDescription
Random = 1

Pick a stream at random according to the probability weights chosen for each stream. If only 1 sound is present in the pool, the same sound will always play.

RandomNoRepeats = 0

Pick a stream at random according to the probability weights chosen for each stream, but avoid playing the same stream twice in a row whenever possible. If only 1 sound is present in the pool, the same sound will always play, effectively allowing repeats to occur.

Sequential = 2

Play streams in the order they appear in the stream pool. If only 1 sound is present in the pool, the same sound will always play.

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.