WavAudio
Defined in: src/encoders/WavAudio.ts:14
Wav audio object. Used to create a WAV file from a PCM audio stream or a Flipnote object.
Currently only supports PCM s16_le audio encoding.
Extends
EncoderBase
Constructors
new WavAudio()
new WavAudio(
sampleRate
,channels
,bitsPerSample
):WavAudio
Defined in: src/encoders/WavAudio.ts:40
Create a new WAV audio object
Parameters
Parameter | Type | Default value | Description |
---|---|---|---|
sampleRate | number | undefined | audio samplerate |
channels | number | 1 | number of audio channels |
bitsPerSample | number | 16 | number of bits per sample |
Returns
Overrides
EncoderBase.constructor
Properties
dataUrl
dataUrl:
string
=null
Defined in: src/encoders/EncoderBase.ts:6
Inherited from
EncoderBase.dataUrl
mimeType
mimeType:
"audio/wav"
Defined in: src/encoders/WavAudio.ts:16
Overrides
EncoderBase.mimeType
sampleRate
sampleRate:
number
Defined in: src/encoders/WavAudio.ts:21
Audio samplerate
channels
channels:
number
Defined in: src/encoders/WavAudio.ts:25
Number of audio channels
bitsPerSample
bitsPerSample:
number
Defined in: src/encoders/WavAudio.ts:29
Number of bits per sample
Methods
getBuffer()
getBuffer():
Buffer
Defined in: src/encoders/EncoderBase.ts:18
Returns the file data as a NodeJS Buffer.
Note: This method does not work outside of NodeJS environments.
Returns
Buffer
Inherited from
EncoderBase.getBuffer
getBlob()
getBlob():
Blob
Defined in: src/encoders/EncoderBase.ts:26
Returns the file data as a Blob.
Returns
Inherited from
EncoderBase.getBlob
getUrl()
getUrl():
string
Defined in: src/encoders/EncoderBase.ts:38
Returns the file data as an Object URL.
Note: This method does not work outside of browser environments.
Returns
string
Inherited from
EncoderBase.getUrl
revokeUrl()
revokeUrl():
void
Defined in: src/encoders/EncoderBase.ts:50
Revokes this file’s Object URL if one has been created, use this when the url created with getUrl is no longer needed, to preserve memory.
Note: This method does not work outside of browser environments.
Returns
void
Inherited from
EncoderBase.revokeUrl
fromFlipnote()
static
fromFlipnote(note
):WavAudio
Defined in: src/encoders/WavAudio.ts:84
Create a WAV audio file from a Flipnote’s master audio track
Parameters
Parameter | Type |
---|---|
note | BaseParser |
Returns
fromFlipnoteTrack()
static
fromFlipnoteTrack(flipnote
,trackId
):WavAudio
Defined in: src/encoders/WavAudio.ts:97
Create a WAV audio file from a given Flipnote audio track
Parameters
Parameter | Type | Description |
---|---|---|
flipnote | BaseParser | |
trackId | FlipnoteAudioTrack |
Returns
writeSamples()
writeSamples(
pcmData
):void
Defined in: src/encoders/WavAudio.ts:109
Add PCM audio frames to the WAV
Parameters
Parameter | Type | Description |
---|---|---|
pcmData | Int16Array | signed int16 PCM audio samples |
Returns
void
getArrayBuffer()
getArrayBuffer():
ArrayBufferLike
Defined in: src/encoders/WavAudio.ts:123
Returns the WAV audio data as an ArrayBuffer
Returns
ArrayBufferLike
Overrides
EncoderBase.getArrayBuffer