lovr.data.newSoundData

Creates a new SoundData. You can pass a filename or Blob to decode, an existing AudioStream to decode audio samples from, or you can create an empty SoundData that can hold a certain number of samples.

soundData = lovr.data.newSoundData(filename)

Arguments

NameTypeDescription
filenamestringThe filename of the sound to decode.

Returns

NameTypeDescription
soundDataSoundDataThe new SoundData.

soundData = lovr.data.newSoundData(samples, sampleRate, bitDepth, channels)

Arguments

NameTypeDefaultDescription
samplesnumberThe total number of samples for each channel.
sampleRatenumber44100The number of samples per second.
bitDepthnumber16The number of bits stored for each sample.
channelsnumber2The number of channels in the sound (1 for mono, 2 for stereo).

Returns

NameTypeDescription
soundDataSoundDataThe new SoundData.

soundData = lovr.data.newSoundData()

Arguments

None

Returns

NameTypeDescription
soundDataSoundDataThe new SoundData.

soundData = lovr.data.newSoundData(blob)

Arguments

NameTypeDescription
blobstringThe Blob containing compressed sound data to decode.

Returns

NameTypeDescription
soundDataSoundDataThe new SoundData.

See also