lovr.data.newAudioStream

Creates a new AudioStream. AudioStream has two modes:

Create an AudioStream decoding ogg audio from the file at filename.

audioStream = lovr.data.newAudioStream(filename, bufferSize)

Arguments

NameTypeDefaultDescription
filenamestringThe filename of the audio file to load.
bufferSizenumber4096The size of the stream's audio buffer, in samples.

Returns

NameTypeDescription
audioStreamAudioStreamThe new AudioStream.

Create an AudioStream decoding ogg audio from the given Blob.

audioStream = lovr.data.newAudioStream(blob, bufferSize)

Arguments

NameTypeDefaultDescription
blobBlobThe Blob containing audio data to decode.
bufferSizenumber4096The size of the stream's audio buffer, in samples.

Returns

NameTypeDescription
audioStreamAudioStreamThe new AudioStream.

Create a raw AudioStream. You must call append to give it audio to stream later.

audioStream = lovr.data.newAudioStream(channelCount, sampleRate, bufferSize, queueLimit)

Arguments

NameTypeDefaultDescription
channelCountnumberNumber of audio channels (1 for mono or 2 for stereo).
sampleRatenumberThe resolution of the stream, in samples per second (examples of common values: 44100, 48000, 16000).
bufferSizenumber4096The size of the stream's audio buffer, in samples.
queueLimitnumbersampleRate * 0.5The maximum number of audio samples that this AudioStream will queue. The default is half a second worth of data. Set to 0 for no limit (but be careful not to use too much RAM).

Returns

NameTypeDescription
audioStreamAudioStreamThe new AudioStream.

See also