-
-
Notifications
You must be signed in to change notification settings - Fork 1
StreamDecoder
A stream.Transform class that converts a flac encoded input to PCM output, all in memory, suitable for connecting to other streams.
You can pass all the options that can expect the Transform object, but also you can pass:
-
oggStream: Boolean
- Determines if the Input data is an OGG Stream
- Defaults to false
-
metadata: Array or Boolean
- If is an array, tells the decoder to emit
metadatawhen metadata blocks of the types passed are found - If is
true, tells the decoder to emitmetadataon all metadata blocks found - Defaults to
STREAMINFOonly
- If is an array, tells the decoder to emit
-
outputAs32: Boolean
- Tells the decoder that the output is in
bitsPerSamplesbut must store it in 32 bit integer. Default value isfalseexcept if thebitsPerSamplesis 24. - Optional
- Tells the decoder that the output is in
Reads a chunk of decoded audio, in interleaved PCM format, on which every sample has the bit depth from StreamDecoder.getBitsPerSample(). As example, a 16bit stream with 2 channels will produce the following structure in the buffer:
--------------------------------------------------
| Left | Right | Left | Right | Left | Right | ... | 2 bytes per sample
| Frame 0 | Frame 1 | Frame 2 | ... | 4 bytes per frame
--------------------------------------------------
Here, frame means a pack of one sample for every channel. Differs from FLAC frame that is other thing.
Gets the number of samples stored in the stream, or 0 if it's undefined.
Gets the number of channels stored in the stream.
Returns the channel assignment of the stream. Values are from bindings.format.ChannelAssignment.
Gets the bits per sample of the stream.
When some metadata has been read, is emitted in a event and it passes an JS representation of it.