Flac
module that provides functionality
for encoding WAV/PCM audio to Flac and decoding Flac to PCM.
NOTE most functions are named analogous to the original C library functions, so that its documentation may be used for further reading.
Methods
-
_create_pointer_array(bufferArray){Flac.PointerInfo}
-
Helper function for creating pointer (and allocating the data) to an array of buffers on the (memory) heap. Use the returned
PointerInfo.dataPointer
as argument, where the array-pointer is required. NOTE: afer use, the allocated buffers on the heap need be freed, see_destroy_pointer_array
.Name Type Description bufferArray
Array.<Uint8Array> the buffer for which to create Returns:
Type Description Flac.PointerInfo false
if the decoder is already initialized, elsetrue
-
_destroy_pointer_array(pointerInfo)
-
Helper function for destroying/freeing a previously created pointer (and allocating the data) of an array of buffers on the (memory) heap.
Name Type Description pointerInfo
Flac.PointerInfo the pointer / allocation information that should be destroyed/freed -
create_libflac_decoder(is_verify){number}
-
Create a decoder.
Name Type Description is_verify
boolean optional enable/disable checksum verification during decoding
DEFAULT: trueReturns:
Type Description number the ID of the created decoder instance (or 0, if there was an error) -
create_libflac_encoder(sample_rate, channels, bps, compression_level, total_samples, is_verify, block_size){number}
-
Create an encoder.
Name Type Description sample_rate
number the sample rate of the input PCM data channels
number the number of channels of the input PCM data bps
number bits per sample of the input PCM data compression_level
Flac.CompressionLevel the desired Flac compression level: [0, 8] total_samples
number optional OPTIONAL the number of total samples of the input PCM data:
Sets an estimate of the total samples that will be encoded. This is merely an estimate and may be set to 0 if unknown. This value will be written to the STREAMINFO block before encoding, and can remove the need for the caller to rewrite the value later if the value is known before encoding.
If specified, the it will be written into metadata of the FLAC header.
DEFAULT: 0 (i.e. unknown number of samples)is_verify
boolean optional OPTIONAL enable/disable checksum verification during encoding
DEFAULT: true
NOTE: this argument is positional (i.e. total_samples must also be given)block_size
number optional OPTIONAL the number of samples to use per frame.
DEFAULT: 0 (i.e. encoder sets block size automatically) NOTE: this argument is positional (i.e. total_samples and is_verify must also be given)Returns:
Type Description number the ID of the created encoder instance (or 0, if there was an error) -
FLAC__stream_decoder_delete(decoder)
-
Delete the decoder instance, and free up its resources.
Name Type Description decoder
number the ID of the decoder instance -
FLAC__stream_decoder_finish(decoder){boolean}
-
Finish the decoding process. The decoder can be reused, after initializing it again.
Name Type Description decoder
number the ID of the decoder instance Returns:
Type Description boolean false
if MD5 checking is on AND a STREAMINFO block was available AND the MD5 signature in the STREAMINFO block was non-zero AND the signature does not match the one computed by the decoder; elsetrue
. -
FLAC__stream_decoder_get_md5_checking(decoder){boolean}
-
Get if MD5 verification is enabled for the decoder
Name Type Description decoder
number the ID of the decoder instance Returns:
Type Description boolean true
if MD5 verification is enabled -
FLAC__stream_decoder_get_state(decoder){Flac.FLAC__StreamDecoderState}
-
Name Type Description decoder
number the ID of the decoder instance Returns:
Type Description Flac.FLAC__StreamDecoderState the decoder state -
FLAC__stream_decoder_process_single(decoder){boolean}
-
Decodes a single frame. To check decoding progress, use
FLAC__stream_decoder_get_state
.Name Type Description decoder
number the ID of the decoder instance Returns:
Type Description boolean FALSE if an error occurred -
FLAC__stream_decoder_process_until_end_of_metadata(decoder){boolean}
-
Decodes data until end of metadata.
Name Type Description decoder
number the ID of the decoder instance Returns:
Type Description boolean false if any fatal read, write, or memory allocation error occurred (meaning decoding must stop), else true. -
FLAC__stream_decoder_process_until_end_of_stream(decoder){boolean}
-
Decodes data until end of stream.
Name Type Description decoder
number the ID of the decoder instance Returns:
Type Description boolean FALSE if an error occurred -
FLAC__stream_decoder_reset(decoder){boolean}
-
Reset the decoder for reuse.
NOTE: Needs to be re-initialized, before it can be used again
Name Type Description decoder
number the ID of the decoder instance Returns:
Type Description boolean true if successful -
FLAC__stream_decoder_set_md5_checking(decoder, is_verify){boolean}
-
Set the "MD5 signature checking" flag. If true, the decoder will compute the MD5 signature of the unencoded audio data while decoding and compare it to the signature from the STREAMINFO block, if it exists, during
FLAC__stream_decoder_finish()
. MD5 signature checking will be turned off (until the nextFLAC__stream_decoder_reset()
) if there is no signature in the STREAMINFO block or when a seek is attempted. Clients that do not use the MD5 check should leave this off to speed up decoding.Name Type Description decoder
number the ID of the decoder instance is_verify
boolean enable/disable checksum verification during decoding Returns:
Type Description boolean FALSE if the decoder is already initialized, else TRUE. -
FLAC__stream_decoder_set_metadata_ignore(decoder, type){boolean}
-
Direct the decoder to filter out all metadata blocks of type type. By default, only the STREAMINFO block is returned via the metadata callback.
NOTE: only use on un-initilized decoder instances!
Name Type Description decoder
number the ID of the decoder instance type
Flac.FLAC__MetadataType the metadata type to be ignored Returns:
Type Description boolean false
if the decoder is already initialized, elsetrue
-
FLAC__stream_decoder_set_metadata_ignore_all(decoder){boolean}
-
Direct the decoder to filter out all metadata blocks of any type. By default, only the STREAMINFO block is returned via the metadata callback.
NOTE: only use on un-initilized decoder instances!
Name Type Description decoder
number the ID of the decoder instance - See:
Returns:
Type Description boolean false
if the decoder is already initialized, elsetrue
-
FLAC__stream_decoder_set_metadata_ignore_application(decoder, id){boolean}
-
Direct the decoder to filter out all APPLICATION metadata blocks of the given id. By default, only the STREAMINFO block is returned via the metadata callback.
NOTE: only use on un-initilized decoder instances!
Name Type Description decoder
number the ID of the decoder instance id
number the ID of application metadata Returns:
Type Description boolean false
if the decoder is already initialized, elsetrue
-
FLAC__stream_decoder_set_metadata_respond(decoder, type){boolean}
-
Direct the decoder to pass on all metadata blocks of type type. By default, only the STREAMINFO block is returned via the metadata callback.
NOTE: only use on un-initilized decoder instances!
Name Type Description decoder
number the ID of the decoder instance type
Flac.FLAC__MetadataType the metadata type to be enabled Returns:
Type Description boolean false
if the decoder is already initialized, elsetrue
-
FLAC__stream_decoder_set_metadata_respond_all(decoder){boolean}
-
Direct the decoder to pass on all metadata blocks of any type. By default, only the STREAMINFO block is returned via the metadata callback.
NOTE: only use on un-initilized decoder instances!
Name Type Description decoder
number the ID of the decoder instance - See:
Returns:
Type Description boolean false
if the decoder is already initialized, elsetrue
-
FLAC__stream_decoder_set_metadata_respond_application(decoder, id){boolean}
-
Direct the decoder to pass on all APPLICATION metadata blocks of the given id. By default, only the STREAMINFO block is returned via the metadata callback.
NOTE: only use on un-initilized decoder instances!
Name Type Description decoder
number the ID of the decoder instance id
number the ID of application metadata Returns:
Type Description boolean false
if the decoder is already initialized, elsetrue
-
FLAC__stream_encoder_delete(encoder)
-
Delete the encoder instance, and free up its resources.
Name Type Description encoder
number the ID of the encoder instance -
FLAC__stream_encoder_finish(encoder){boolean}
-
Finish the encoding process.
Name Type Description encoder
number the ID of the encoder instance Returns:
Type Description boolean false
if an error occurred processing the last frame; or if verify mode is set, there was a verify mismatch; elsetrue
. Iffalse
, caller should check the state withFlac#FLAC__stream_encoder_get_state
for more information about the error. -
FLAC__stream_encoder_get_state(encoder){Flac.FLAC__StreamEncoderState}
-
Name Type Description encoder
number the ID of the encoder instance Returns:
Type Description Flac.FLAC__StreamEncoderState the encoder state -
FLAC__stream_encoder_get_verify(encoder){boolean}
-
Get the "verify" flag for the encoder.
Name Type Description encoder
number the ID of the encoder instance Returns:
Type Description boolean the verify flag for the encoder -
FLAC__stream_encoder_get_verify_decoder_state(encoder){Flac.FLAC__StreamDecoderState}
-
Get the state of the verify stream decoder. Useful when the stream encoder state is FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR.
Name Type Description encoder
number the ID of the encoder instance Returns:
Type Description Flac.FLAC__StreamDecoderState the verify stream decoder state -
FLAC__stream_encoder_process(encoder, channelBuffers, num_of_samples){boolean}
-
Encode / submit data for encoding. Submit data for encoding. This version allows you to supply the input data via an array of pointers, each pointer pointing to an array of samples samples representing one channel. The samples need not be block-aligned, but each channel should have the same number of samples. Each sample should be a signed integer, right-justified to the resolution set by FLAC__stream_encoder_set_bits_per_sample(). For example, if the resolution is 16 bits per sample, the samples should all be in the range [-32768,32767]. For applications where channel order is important, channels must follow the order as described in the frame header.
Name Type Description encoder
number the ID of the encoder instance channelBuffers
Array.<TypedArray> an array for the audio data channels as typed arrays with signed integers (and size according to the set bits-per-sample setting) num_of_samples
number the number of samples in one channel (i.e. one of the buffers) Returns:
Type Description boolean true if successful, else false; in this case, check the encoder state with FLAC__stream_encoder_get_state() to see what went wrong. -
FLAC__stream_encoder_process_interleaved(encoder, buffer, num_of_samples){boolean}
-
Encode / submit data for encoding. This version allows you to supply the input data where the channels are interleaved into a single array (i.e. channel0_sample0, channel1_sample0, ... , channelN_sample0, channel0_sample1, ...). The samples need not be block-aligned but they must be sample-aligned, i.e. the first value should be channel0_sample0 and the last value channelN_sampleM. Each sample should be a signed integer, right-justified to the resolution set by bits-per-sample. For example, if the resolution is 16 bits per sample, the samples should all be in the range [-32768,32767]. For applications where channel order is important, channels must follow the order as described in the frame header.
Name Type Description encoder
number the ID of the encoder instance buffer
TypedArray the audio data in a typed array with signed integers (and size according to the set bits-per-sample setting) num_of_samples
number the number of samples in buffer Returns:
Type Description boolean true if successful, else false; in this case, check the encoder state with FLAC__stream_encoder_get_state() to see what went wrong. -
FLAC__stream_encoder_set_blocksize(encoder, block_size){boolean}
-
Set the blocksize to use while encoding. The number of samples to use per frame. Use 0 to let the encoder estimate a blocksize; this is usually best.
NOTE: only use on un-initilized encoder instances!
Name Type Description encoder
number the ID of the encoder instance block_size
number the number of samples to use per frame Returns:
Type Description boolean false
if the encoder is already initialized, elsetrue
-
FLAC__stream_encoder_set_compression_level(encoder, compression_level){boolean}
-
Set the compression level The compression level is roughly proportional to the amount of effort the encoder expends to compress the file. A higher level usually means more computation but higher compression. The default level is suitable for most applications. Currently the levels range from 0 (fastest, least compression) to 8 (slowest, most compression). A value larger than 8 will be treated as 8.
NOTE: only use on un-initilized encoder instances!
Name Type Description encoder
number the ID of the encoder instance compression_level
Flac.CompressionLevel the desired Flac compression level: [0, 8] - See:
Returns:
Type Description boolean false
if the encoder is already initialized, elsetrue
-
FLAC__stream_encoder_set_metadata(encoder, metadataBuffersPointer, num_blocks){boolean}
-
Set the metadata blocks to be emitted to the stream before encoding. A value of NULL, 0 implies no metadata; otherwise, supply an array of pointers to metadata blocks. The array is non-const since the encoder may need to change the is_last flag inside them, and in some cases update seek point offsets. Otherwise, the encoder will not modify or free the blocks. It is up to the caller to free the metadata blocks after encoding finishes.
The encoder stores only copies of the pointers in the metadata array; the metadata blocks themselves must survive at least until after FLAC__stream_encoder_finish() returns. Do not free the blocks until then. The STREAMINFO block is always written and no STREAMINFO block may occur in the supplied array. By default the encoder does not create a SEEKTABLE. If one is supplied in the metadata array, but the client has specified that it does not support seeking, then the SEEKTABLE will be written verbatim. However by itself this is not very useful as the client will not know the stream offsets for the seekpoints ahead of time. In order to get a proper seektable the client must support seeking. See next note. SEEKTABLE blocks are handled specially. Since you will not know the values for the seek point stream offsets, you should pass in a SEEKTABLE 'template', that is, a SEEKTABLE object with the required sample numbers (or placeholder points), with 0 for the frame_samples and stream_offset fields for each point. If the client has specified that it supports seeking by providing a seek callback to FLAC__stream_encoder_init_stream() or both seek AND read callback to FLAC__stream_encoder_init_ogg_stream() (or by using FLAC__stream_encoder_init*_file() or FLAC__stream_encoder_init*_FILE()), then while it is encoding the encoder will fill the stream offsets in for you and when encoding is finished, it will seek back and write the real values into the SEEKTABLE block in the stream. There are helper routines for manipulating seektable template blocks; see metadata.h: FLAC__metadata_object_seektable_template_*(). If the client does not support seeking, the SEEKTABLE will have inaccurate offsets which will slow down or remove the ability to seek in the FLAC stream. The encoder instance will modify the first SEEKTABLE block as it transforms the template to a valid seektable while encoding, but it is still up to the caller to free all metadata blocks after encoding. A VORBIS_COMMENT block may be supplied. The vendor string in it will be ignored. libFLAC will use it's own vendor string. libFLAC will not modify the passed-in VORBIS_COMMENT's vendor string, it will simply write it's own into the stream. If no VORBIS_COMMENT block is present in the metadata array, libFLAC will write an empty one, containing only the vendor string. The Ogg FLAC mapping requires that the VORBIS_COMMENT block be the second metadata block of the stream. The encoder already supplies the STREAMINFO block automatically. If metadata does not contain a VORBIS_COMMENT block, the encoder will supply that too. Otherwise, if metadata does contain a VORBIS_COMMENT block and it is not the first, the init function will reorder metadata by moving the VORBIS_COMMENT block to the front; the relative ordering of the other blocks will remain as they were. The Ogg FLAC mapping limits the number of metadata blocks per stream to 65535. If num_blocks exceeds this the function will return false.
Name Type Description encoder
number the ID of the encoder instance metadataBuffersPointer
Flac.PointerInfo num_blocks
number Returns:
Type Description boolean false
if the encoder is already initialized, elsetrue
.false
if the encoder is already initialized, or if num_blocks > 65535 if encoding to Ogg FLAC, else true. -
FLAC__stream_encoder_set_verify(encoder, is_verify){boolean}
-
Set the "verify" flag. If true, the encoder will verify it's own encoded output by feeding it through an internal decoder and comparing the original signal against the decoded signal. If a mismatch occurs, the process call will return false. Note that this will slow the encoding process by the extra time required for decoding and comparison.
NOTE: only use on un-initilized encoder instances!
Name Type Description encoder
number the ID of the encoder instance is_verify
boolean enable/disable checksum verification during encoding Returns:
Type Description boolean false
if the encoder is already initialized, elsetrue
-
getOptions(p_coder){CodingOptions}
-
Get coding options for the encoder / decoder instance: returns FALSY when not set.
Name Type Description p_coder
Number the encoder/decoder pointer (ID) Returns:
Type Description CodingOptions the coding options -
init_decoder_ogg_stream(decoder, read_callback_fn, write_callback_fn, error_callback_fn, metadata_callback_fn, ogg_serial_number){Flac.FLAC__StreamDecoderInitStatus}
-
Initialize the decoder for writing to an OGG container.
Name Type Description decoder
number the ID of the decoder instance that has not been initialized (or has been reset) read_callback_fn
Flac~decoder_read_callback_fn the callback for reading the Flac data that should get decoded: read_callback_fn(numberOfBytes: Number) : {buffer: ArrayBuffer, readDataLength: number, error: boolean}
write_callback_fn
Flac~decoder_write_callback_fn the callback for writing the decoded data: write_callback_fn(data: Uint8Array[], frameInfo: Metadata)
error_callback_fn
Flac~decoder_error_callback_fn the error callback: error_callback_fn(errorCode: Number, errorDescription: String)
metadata_callback_fn
Flac~metadata_callback_fn optional OPTIONAL callback for receiving the metadata of FLAC data that will be decoded: metadata_callback_fn(metadata: StreamMetadata)
ogg_serial_number
number optional OPTIONAL the serial number for the stream in the OGG container that should be decoded.
The default behavior is to use the serial number of the first Ogg page. Setting a serial number here will explicitly specify which stream is to be decoded.Returns:
Type Description Flac.FLAC__StreamDecoderInitStatus the decoder status( 0
forFLAC__STREAM_DECODER_INIT_STATUS_OK
) -
init_decoder_stream(decoder, read_callback_fn, write_callback_fn, error_callback_fn, metadata_callback_fn, ogg_serial_number){Flac.FLAC__StreamDecoderInitStatus}
-
Initialize the decoder.
Name Type Description decoder
number the ID of the decoder instance that has not been initialized (or has been reset) read_callback_fn
Flac~decoder_read_callback_fn the callback for reading the Flac data that should get decoded: read_callback_fn(numberOfBytes: Number) : {buffer: ArrayBuffer, readDataLength: number, error: boolean}
write_callback_fn
Flac~decoder_write_callback_fn the callback for writing the decoded data: write_callback_fn(data: Uint8Array[], frameInfo: Metadata)
error_callback_fn
Flac~decoder_error_callback_fn the error callback: error_callback_fn(errorCode: Number, errorDescription: String)
metadata_callback_fn
Flac~metadata_callback_fn optional OPTIONAL callback for receiving the metadata of FLAC data that will be decoded: metadata_callback_fn(metadata: StreamMetadata)
ogg_serial_number
number | boolean optional OPTIONAL if number or true
is specified, the decoder will be initilized to read from an OGG container, seeFlac.init_decoder_ogg_stream
:
true
will use the default serial number, if specified as number the corresponding stream with the serial number from the ogg container will be used.Returns:
Type Description Flac.FLAC__StreamDecoderInitStatus the decoder status( 0
forFLAC__STREAM_DECODER_INIT_STATUS_OK
) -
init_encoder_ogg_stream(encoder, write_callback_fn, metadata_callback_fn, ogg_serial_number){Flac.FLAC__StreamEncoderInitStatus}
-
Initialize the encoder for writing to an OGG container.
Name Type Description encoder
number the ID of the encoder instance that has not been initialized (or has been reset) write_callback_fn
Flac~encoder_write_callback_fn the callback for writing the encoded Flac data: write_callback_fn(data: Uint8Array, numberOfBytes: Number, samples: Number, currentFrame: Number)
metadata_callback_fn
Flac~metadata_callback_fn optional OPTIONAL the callback for the metadata of the encoded Flac data: metadata_callback_fn(metadata: StreamMetadata)
ogg_serial_number
number optional OPTIONAL the serial number for the stream in the OGG container DEFAULT: 1
Returns:
Type Description Flac.FLAC__StreamEncoderInitStatus the encoder status ( 0
forFLAC__STREAM_ENCODER_INIT_STATUS_OK
) -
init_encoder_stream(encoder, write_callback_fn, metadata_callback_fn, ogg_serial_number){Flac.FLAC__StreamEncoderInitStatus}
-
Initialize the encoder.
Name Type Description encoder
number the ID of the encoder instance that has not been initialized (or has been reset) write_callback_fn
Flac~encoder_write_callback_fn the callback for writing the encoded Flac data: write_callback_fn(data: Uint8Array, numberOfBytes: Number, samples: Number, currentFrame: Number)
metadata_callback_fn
Flac~metadata_callback_fn optional OPTIONAL the callback for the metadata of the encoded Flac data: metadata_callback_fn(metadata: StreamMetadata)
ogg_serial_number
number | boolean optional OPTIONAL if number or true
is specified, the encoder will be initialized to write to an OGG container, seeFlac.init_encoder_ogg_stream
:true
will set a default serial number (1
), if specified as number, it will be used as the stream's serial number within the ogg container.Returns:
Type Description Flac.FLAC__StreamEncoderInitStatus the encoder status ( 0
forFLAC__STREAM_ENCODER_INIT_STATUS_OK
) -
init_libflac_decoder()
-
- Deprecated
- use
create_libflac_decoder
instead
- use
-
init_libflac_encoder()
-
- Deprecated
- use
create_libflac_encoder
instead
- use
-
isReady(){boolean}
-
Returns if Flac has been initialized / is ready to be used.
Returns:
Type Description boolean true
, if Flac is ready to be used -
off(eventName, listener)
-
Remove an event listener for module-events.
Name Type Description eventName
string listener
function - See:
-
on(eventName, listener)
-
Add an event listener for module-events. Supported events:
-
"ready"
→Flac.event:ReadyEvent
: emitted when module is ready for usage (i.e.isReady
is true)
NOTE listener will get immediately triggered if module is already"ready"
-
"created"
→Flac.event:CreatedEvent
: emitted when an encoder or decoder instance was created
-
"destroyed"
→Flac.event:DestroyedEvent
: emitted when an encoder or decoder instance was destroyed
Name Type Description eventName
string listener
function Example
Flac.on('ready', function(event){ //gets executed when library is ready, or becomes ready... });
-
-
onready(event)
-
Hook for handler function that gets called, when asynchronous initialization has finished. NOTE that if the execution environment does not support
Object#defineProperty
, then this function is not called, afterisReady
istrue
. In this case,isReady
should be checked, before settingonready
and if it istrue
, handler should be executed immediately instead of settingonready
.Name Type Description event
Flac.event:ReadyEvent the ready-event object Example
// [1] if Object.defineProperty() IS supported: Flac.onready = function(event){ //gets executed when library becomes ready, or immediately, if it already is ready... doSomethingWithFlac(); }; // [2] if Object.defineProperty() is NOT supported: // do check Flac.isReady(), and only set handler, if not ready yet // (otherwise immediately excute handler code) if(!Flac.isReady()){ Flac.onready = function(event){ //gets executed when library becomes ready... doSomethingWithFlac(); }; } else { // Flac is already ready: immediately start processing doSomethingWithFlac(); }
-
setOptions(p_coder, options)
-
Set coding options for an encoder / decoder instance (will / should be deleted, when finish()/delete())
Name Type Description p_coder
Number the encoder/decoder pointer (ID) options
CodingOptions the coding options
Type Definitions
-
decoder_error_callback_fn(errorCode, errorDescription)
-
The callback for reporting decoding errors.
Name Type Description errorCode
number the error code errorDescription
Flac.FLAC__StreamDecoderErrorStatus the string representation / description of the error -
decoder_read_callback_fn(numberOfBytes){Flac.ReadResult|Flac.CompletedReadResult}
-
The callback for reading the FLAC data that will be decoded.
Name Type Description numberOfBytes
number the maximal number of bytes that the read callback can return Returns:
Type Description Flac.ReadResult | Flac.CompletedReadResult the result of the reading action/request -
decoder_write_callback_fn(data, frameInfo)
-
The callback for writing the decoded FLAC data.
Name Type Description data
Array.<Uint8Array> array of the channels with the decoded PCM data as Uint8Array
sframeInfo
Flac.BlockMetadata the metadata information for the decoded data -
encoder_write_callback_fn(data, numberOfBytes, samples, currentFrame){void|false}
-
The callback for writing the encoded FLAC data.
Name Type Description data
Uint8Array the encoded FLAC data numberOfBytes
number the number of bytes in data samples
number the number of samples encoded in data currentFrame
number the number of the (current) encoded frame in data Returns:
Type Description void | false returning false
indicates that an unrecoverable error occurred and decoding should be aborted -
metadata_callback_fn(metadata, metadataBlock)
-
The callback for the metadata of the encoded/decoded Flac data. By default, only the STREAMINFO metadata is enabled. For other metadata types
Flac.FLAC__MetadataType
they need to be enabled, see e.g.Flac#FLAC__stream_decoder_set_metadata_respond
Name Type Description metadata
Flac.StreamMetadata | undefined the FLAC meta data, NOTE only STREAMINFO is returned in first argument, for other types use 2nd argument's metadataBlock.data
metadataBlock
Flac.MetadataBlock the detailed meta data block
Interface Definitions
-
Flac.ApplicationMetadata
-
FLAC application metadata block NOTE the application meta data type is not really supported, i.e. the (binary) data is only a pointer to the memory heap.
- See:
-
- Flac.FLAC__MetadataType#FLAC__METADATA_TYPE_APPLICATION
- application block format specification
Properties:
Name Type Description id
number the application ID data
number (pointer) -
Flac.BlockMetadata
-
FLAC block meta data
- See:
Properties:
Name Type Attributes Description blocksize
number the block size (bytes) number
number the number of the decoded samples or frames numberType
string the type to which number
refers to: either"frames"
or"samples"
channelAssignment
Flac.FLAC__ChannelAssignment the channel assignment crc
string the MD5 checksum for the decoded data, if validation is enabled subframes
Array.<Flac.SubFrameMetadata> <optional>
the metadata of the subframes. The array length corresponds to the number of channels. NOTE will only be included if CodingOptions.analyseSubframes
is enabled for the decoder.sampleRate
number inherited the sample rate (Hz) channels
number inherited the number of channels bitsPerSample
number inherited bits per sample -
Flac.CoderChangedEventData
-
Life cycle event data for signaling life cycle changes of encoder or decoder instances
- See:
Properties:
Name Type Attributes Description id
number the ID for the encoder or decoder instance type
"encoder" | "decoder" signifies whether the event is for an encoder or decoder instance data
any <optional>
specific data for the life cycle change -
Flac.CodingOptions
-
Additional options for encoding or decoding
- See:
Properties:
Name Type Attributes Description analyseSubframes
boolean <optional>
for decoding: include subframes metadata in write-callback metadata, DEFAULT: false analyseResiduals
boolean <optional>
for decoding: include residual data in subframes metadata in write-callback metadata, NOTE #analyseSubframes
muste also be enabled, DEFAULT: falseenableRawMetadata
boolean <optional>
DEBUG option for decoding: enable receiving raw metadata for unknown metadata types in second argument in the metadata-callback, DEFAULT: false -
Flac.CompletedReadResult
-
Result / return value for
Flac~decoder_read_callback_fn
callback function for signifying that there is no more data to readProperties:
Name Type Attributes Description buffer
TypedArray | undefined a TypedArray (e.g. Uint8Array) with the read data (will be ignored in case readDataLength is 0
)readDataLength
0 the number of read data bytes: The number of 0
(zero) indicates that the end-of-stream is reached.error
boolean <optional>
inheritedOPTIONAL value of true
indicates that an error occured (decoding will be aborted) -
Flac.CompressionLevel
-
Set the compression level The compression level is roughly proportional to the amount of effort the encoder expends to compress the file. A higher level usually means more computation but higher compression. The default level is suitable for most applications. Currently the levels range from 0 (fastest, least compression) to 8 (slowest, most compression). A value larger than 8 will be treated as 8. This function automatically calls the following other set functions with appropriate values, so the client does not need to unless it specifically wants to override them:
FLAC__stream_encoder_set_do_mid_side_stereo() FLAC__stream_encoder_set_loose_mid_side_stereo() FLAC__stream_encoder_set_apodization() FLAC__stream_encoder_set_max_lpc_order() FLAC__stream_encoder_set_qlp_coeff_precision() FLAC__stream_encoder_set_do_qlp_coeff_prec_search() FLAC__stream_encoder_set_do_escape_coding() FLAC__stream_encoder_set_do_exhaustive_model_search() FLAC__stream_encoder_set_min_residual_partition_order() FLAC__stream_encoder_set_max_residual_partition_order() FLAC__stream_encoder_set_rice_parameter_search_dist()
The actual values set for each level are: | level | do mid-side stereo | loose mid-side stereo | apodization | max lpc order | qlp coeff precision | qlp coeff prec search | escape coding | exhaustive model search | min residual partition order | max residual partition order | rice parameter search dist | |--------|---------------------|------------------------|------------------------------------------------|----------------|----------------------|------------------------|----------------|--------------------------|-------------------------------|-------------------------------|------------------------------| | 0 | false | false | tukey(0.5) | 0 | 0 | false | false | false | 0 | 3 | 0 | | 1 | true | true | tukey(0.5) | 0 | 0 | false | false | false | 0 | 3 | 0 | | 2 | true | false | tukey(0.5) | 0 | 0 | false | false | false | 0 | 3 | 0 | | 3 | false | false | tukey(0.5) | 6 | 0 | false | false | false | 0 | 4 | 0 | | 4 | true | true | tukey(0.5) | 8 | 0 | false | false | false | 0 | 4 | 0 | | 5 | true | false | tukey(0.5) | 8 | 0 | false | false | false | 0 | 5 | 0 | | 6 | true | false | tukey(0.5);partial_tukey(2) | 8 | 0 | false | false | false | 0 | 6 | 0 | | 7 | true | false | tukey(0.5);partial_tukey(2) | 12 | 0 | false | false | false | 0 | 6 | 0 | | 8 | true | false | tukey(0.5);partial_tukey(2);punchout_tukey(3) | 12 | 0 | false | false | false | 0 | 6 | 0 |Properties:
Name Type Description 0
"FLAC__COMPRESSION_LEVEL_0" compression level 0 1
"FLAC__COMPRESSION_LEVEL_1" compression level 1 2
"FLAC__COMPRESSION_LEVEL_2" compression level 2 3
"FLAC__COMPRESSION_LEVEL_3" compression level 3 4
"FLAC__COMPRESSION_LEVEL_4" compression level 4 5
"FLAC__COMPRESSION_LEVEL_5" compression level 5 6
"FLAC__COMPRESSION_LEVEL_6" compression level 6 7
"FLAC__COMPRESSION_LEVEL_7" compression level 7 8
"FLAC__COMPRESSION_LEVEL_8" compression level 8 -
Flac.CueSheetMetadata
-
FLAC cue sheet metadata block
- See:
-
- Flac.FLAC__MetadataType#FLAC__METADATA_TYPE_CUESHEET
Properties:
Name Type Description media_catalog_number
string Media catalog number, in ASCII printable characters 0x20-0x7e. In general, the media catalog number may be 0 to 128 bytes long. lead_in
number The number of lead-in samples. is_cd
boolean true if CUESHEET corresponds to a Compact Disc, else false. num_tracks
number The number of tracks. tracks
Array.<Flac.CueSheetTrack> the tracks -
Flac.CueSheetTracIndex
-
FLAC track index data for cue sheet metadata
- See:
Properties:
Name Type Description offset
number Offset in samples, relative to the track offset, of the index point. number
number The index point number. -
Flac.CueSheetTrack
-
FLAC cue sheet track data
- See:
Properties:
Name Type Description offset
number Track offset in samples, relative to the beginning of the FLAC audio stream. number
number The track number. isrc
string Track ISRC. This is a 12-digit alphanumeric code. type
"AUDIO" | "NON_AUDIO" The track type: audio or non-audio. pre_emphasis
boolean The pre-emphasis flag num_indices
number The number of track index points. indices
Flac.CueSheetTracIndex The track index points. -
Flac.FixedSubFrameData
-
metadata for FIXED subframe type
Properties:
Name Type Attributes Description order
number The polynomial order. warmup
Array.<number> Warmup samples to prime the predictor, length == order. partition
Flac.SubFramePartition The residual coding method. residual
Array.<number> <optional>
The residual signal, length == (blocksize minus order) samples. NOTE will only be included if CodingOptions.analyseSubframes
is enabled for the decoder. -
Flac.FLAC__ChannelAssignment
-
The channel assignment for the (decoded) frame.
Properties:
Name Type Description 0
"FLAC__CHANNEL_ASSIGNMENT_INDEPENDENT" independent channels 1
"FLAC__CHANNEL_ASSIGNMENT_LEFT_SIDE" left+side stereo 2
"FLAC__CHANNEL_ASSIGNMENT_RIGHT_SIDE" right+side stereo 3
"FLAC__CHANNEL_ASSIGNMENT_MID_SIDE" mid+side stereo -
Flac.FLAC__EntropyCodingMethodType
-
entropy coding methods
Properties:
Name Type Description 0
"FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE" Residual is coded by partitioning into contexts, each with it's own 4-bit Rice parameter. 1
"FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2" Residual is coded by partitioning into contexts, each with it's own 5-bit Rice parameter. -
Flac.FLAC__MetadataType
-
An enumeration of the available metadata block types.
- See:
Properties:
Name Type Description 0
"FLAC__METADATA_TYPE_STREAMINFO" STREAMINFO block 1
"FLAC__METADATA_TYPE_PADDING" PADDING block 2
"FLAC__METADATA_TYPE_APPLICATION" APPLICATION block 3
"FLAC__METADATA_TYPE_SEEKTABLE" SEEKTABLE block 4
"FLAC__METADATA_TYPE_VORBIS_COMMENT" VORBISCOMMENT block (a.k.a. FLAC tags) 5
"FLAC__METADATA_TYPE_CUESHEET" CUESHEET block 6
"FLAC__METADATA_TYPE_PICTURE" PICTURE block 7
"FLAC__METADATA_TYPE_UNDEFINED" marker to denote beginning of undefined type range; this number will increase as new metadata types are added 126
"FLAC__MAX_METADATA_TYPE" No type will ever be greater than this. There is not enough room in the protocol block. -
Flac.FLAC__StreamDecoderErrorStatus
-
Decoding error codes.
If the error code is not known, valueFLAC__STREAM_DECODER_ERROR__UNKNOWN__
is used.Properties:
Name Type Description 0
"FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC" An error in the stream caused the decoder to lose synchronization. 1
"FLAC__STREAM_DECODER_ERROR_STATUS_BAD_HEADER" The decoder encountered a corrupted frame header. 2
"FLAC__STREAM_DECODER_ERROR_STATUS_FRAME_CRC_MISMATCH" The frame's data did not match the CRC in the footer. 3
"FLAC__STREAM_DECODER_ERROR_STATUS_UNPARSEABLE_STREAM" The decoder encountered reserved fields in use in the stream. -
Flac.FLAC__StreamDecoderInitStatus
-
Properties:
Name Type Description 0
"FLAC__STREAM_DECODER_INIT_STATUS_OK" Initialization was successful. 1
"FLAC__STREAM_DECODER_INIT_STATUS_UNSUPPORTED_CONTAINER" The library was not compiled with support for the given container format. 2
"FLAC__STREAM_DECODER_INIT_STATUS_INVALID_CALLBACKS" A required callback was not supplied. 3
"FLAC__STREAM_DECODER_INIT_STATUS_MEMORY_ALLOCATION_ERROR" An error occurred allocating memory. 4
"FLAC__STREAM_DECODER_INIT_STATUS_ERROR_OPENING_FILE" fopen() failed in FLAC__stream_decoder_init_file() or FLAC__stream_decoder_init_ogg_file(). 5
"FLAC__STREAM_DECODER_INIT_STATUS_ALREADY_INITIALIZED" FLAC__stream_decoder_init_*() was called when the decoder was already initialized, usually because FLAC__stream_decoder_finish() was not called. -
Flac.FLAC__StreamDecoderState
-
Decoder state code.
Properties:
Name Type Description 0
"FLAC__STREAM_DECODER_SEARCH_FOR_METADATA" The decoder is ready to search for metadata 1
"FLAC__STREAM_DECODER_READ_METADATA" The decoder is ready to or is in the process of reading metadata 2
"FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC" The decoder is ready to or is in the process of searching for the frame sync code 3
"FLAC__STREAM_DECODER_READ_FRAME" The decoder is ready to or is in the process of reading a frame 4
"FLAC__STREAM_DECODER_END_OF_STREAM" The decoder has reached the end of the stream 5
"FLAC__STREAM_DECODER_OGG_ERROR" An error occurred in the underlying Ogg layer 6
"FLAC__STREAM_DECODER_SEEK_ERROR" An error occurred while seeking. The decoder must be flushed with FLAC__stream_decoder_flush() or reset with FLAC__stream_decoder_reset() before decoding can continue 7
"FLAC__STREAM_DECODER_ABORTED" The decoder was aborted by the read callback 8
"FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR" An error occurred allocating memory. The decoder is in an invalid state and can no longer be used 9
"FLAC__STREAM_DECODER_UNINITIALIZED" The decoder is in the uninitialized state; one of the FLAC__stream_decoder_init_*() functions must be called before samples can be processed. -
Flac.FLAC__StreamEncoderInitStatus
-
Properties:
Name Type Description 0
"FLAC__STREAM_ENCODER_INIT_STATUS_OK" Initialization was successful. 1
"FLAC__STREAM_ENCODER_INIT_STATUS_ENCODER_ERROR" General failure to set up encoder; call FLAC__stream_encoder_get_state() for cause. 2
"FLAC__STREAM_ENCODER_INIT_STATUS_UNSUPPORTED_CONTAINER" The library was not compiled with support for the given container format. 3
"FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_CALLBACKS" A required callback was not supplied. 4
"FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_NUMBER_OF_CHANNELS" The encoder has an invalid setting for number of channels. 5
"FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_BITS_PER_SAMPLE" The encoder has an invalid setting for bits-per-sample. FLAC supports 4-32 bps but the reference encoder currently supports only up to 24 bps. 6
"FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_SAMPLE_RATE" The encoder has an invalid setting for the input sample rate. 7
"FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_BLOCK_SIZE" The encoder has an invalid setting for the block size. 8
"FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_MAX_LPC_ORDER" The encoder has an invalid setting for the maximum LPC order. 9
"FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_QLP_COEFF_PRECISION" The encoder has an invalid setting for the precision of the quantized linear predictor coefficients. 10
"FLAC__STREAM_ENCODER_INIT_STATUS_BLOCK_SIZE_TOO_SMALL_FOR_LPC_ORDER" The specified block size is less than the maximum LPC order. 11
"FLAC__STREAM_ENCODER_INIT_STATUS_NOT_STREAMABLE" The encoder is bound to the Subset but other settings violate it. 12
"FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_METADATA" The metadata input to the encoder is invalid, in one of the following ways: FLAC__stream_encoder_set_metadata() was called with a null pointer but a block count > 0 One of the metadata blocks contains an undefined type It contains an illegal CUESHEET as checked by FLAC__format_cuesheet_is_legal() It contains an illegal SEEKTABLE as checked by FLAC__format_seektable_is_legal() It contains more than one SEEKTABLE block or more than one VORBIS_COMMENT block 13
"FLAC__STREAM_ENCODER_INIT_STATUS_ALREADY_INITIALIZED" FLAC__stream_encoder_init_*() was called when the encoder was already initialized, usually because FLAC__stream_encoder_finish() was not called. -
Flac.FLAC__StreamEncoderState
-
Encoder state code.
Properties:
Name Type Description 0
"FLAC__STREAM_ENCODER_OK" The encoder is in the normal OK state and samples can be processed. 1
"FLAC__STREAM_ENCODER_UNINITIALIZED" The encoder is in the uninitialized state; one of the FLAC__stream_encoder_init_*() functions must be called before samples can be processed. 2
"FLAC__STREAM_ENCODER_OGG_ERROR" An error occurred in the underlying Ogg layer. 3
"FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR" An error occurred in the underlying verify stream decoder; check FLAC__stream_encoder_get_verify_decoder_state(). 4
"FLAC__STREAM_ENCODER_VERIFY_MISMATCH_IN_AUDIO_DATA" The verify decoder detected a mismatch between the original audio signal and the decoded audio signal. 5
"FLAC__STREAM_ENCODER_CLIENT_ERROR" One of the callbacks returned a fatal error. 6
"FLAC__STREAM_ENCODER_IO_ERROR" An I/O error occurred while opening/reading/writing a file. Check errno. 7
"FLAC__STREAM_ENCODER_FRAMING_ERROR" An error occurred while writing the stream; usually, the write_callback returned an error. 8
"FLAC__STREAM_ENCODER_MEMORY_ALLOCATION_ERROR" Memory allocation failed. -
Flac.FLAC__StreamMetadata_Picture_Type
-
An enumeration of the PICTURE types (see FLAC__StreamMetadataPicture and id3 v2.4 APIC tag).
- See:
Properties:
Name Type Description 0
"FLAC__STREAM_METADATA_PICTURE_TYPE_OTHER" Other 1
"FLAC__STREAM_METADATA_PICTURE_TYPE_FILE_ICON_STANDARD" 32x32 pixels 'file icon' (PNG only) 2
"FLAC__STREAM_METADATA_PICTURE_TYPE_FILE_ICON" Other file icon 3
"FLAC__STREAM_METADATA_PICTURE_TYPE_FRONT_COVER" Cover (front) 4
"FLAC__STREAM_METADATA_PICTURE_TYPE_BACK_COVER" Cover (back) 5
"FLAC__STREAM_METADATA_PICTURE_TYPE_LEAFLET_PAGE" Leaflet page 6
"FLAC__STREAM_METADATA_PICTURE_TYPE_MEDIA" Media (e.g. label side of CD) 7
"FLAC__STREAM_METADATA_PICTURE_TYPE_LEAD_ARTIST" Lead artist/lead performer/soloist 8
"FLAC__STREAM_METADATA_PICTURE_TYPE_ARTIST" Artist/performer 9
"FLAC__STREAM_METADATA_PICTURE_TYPE_CONDUCTOR" Conductor 10
"FLAC__STREAM_METADATA_PICTURE_TYPE_BAND" Band/Orchestra 11
"FLAC__STREAM_METADATA_PICTURE_TYPE_COMPOSER" Composer 12
"FLAC__STREAM_METADATA_PICTURE_TYPE_LYRICIST" Lyricist/text writer 13
"FLAC__STREAM_METADATA_PICTURE_TYPE_RECORDING_LOCATION" Recording Location 14
"FLAC__STREAM_METADATA_PICTURE_TYPE_DURING_RECORDING" During recording 15
"FLAC__STREAM_METADATA_PICTURE_TYPE_DURING_PERFORMANCE" During performance 16
"FLAC__STREAM_METADATA_PICTURE_TYPE_VIDEO_SCREEN_CAPTURE" Movie/video screen capture 17
"FLAC__STREAM_METADATA_PICTURE_TYPE_FISH" A bright coloured fish 18
"FLAC__STREAM_METADATA_PICTURE_TYPE_ILLUSTRATION" Illustration 19
"FLAC__STREAM_METADATA_PICTURE_TYPE_BAND_LOGOTYPE" Band/artist logotype 20
"FLAC__STREAM_METADATA_PICTURE_TYPE_PUBLISHER_LOGOTYPE" Publisher/Studio logotype -
Flac.FLAC__SubframeType
-
The types for FLAC subframes
Properties:
Name Type Description 0
"FLAC__SUBFRAME_TYPE_CONSTANT" constant signal 1
"FLAC__SUBFRAME_TYPE_VERBATIM" uncompressed signal 2
"FLAC__SUBFRAME_TYPE_FIXED" fixed polynomial prediction 3
"FLAC__SUBFRAME_TYPE_LPC" linear prediction -
Flac.LPCSubFrameData
-
metadata for LPC subframe type
Properties:
Name Type Attributes Description order
number The FIR order. qlp_coeff
Array.<number> FIR filter coefficients. qlp_coeff_precision
number Quantized FIR filter coefficient precision in bits. quantization_level
number The qlp coeff shift needed. warmup
Array.<number> inherited Warmup samples to prime the predictor, length == order. partition
Flac.SubFramePartition inherited The residual coding method. residual
Array.<number> <optional>
inheritedThe residual signal, length == (blocksize minus order) samples. NOTE will only be included if CodingOptions.analyseSubframes
is enabled for the decoder. -
Flac.Metadata
-
FLAC meta data
Properties:
Name Type Description sampleRate
number the sample rate (Hz) channels
number the number of channels bitsPerSample
number bits per sample -
Flac.MetadataBlock
-
FLAC raw metadata
Properties:
Name Type Attributes Description type
Flac.FLAC__MetadataType the type of the metadata isLast
boolean if it is the last block of metadata length
number the length of the metadata block (bytes) data
Flac.StreamMetadata | Flac.PaddingMetadata | Flac.ApplicationMetadata | Flac.SeekTableMetadata | Flac.CueSheetMetadata | Flac.PictureMetadata <optional>
the metadata (omitted for unknown metadata types) raw
Uint8Array <optional>
raw metadata (for debugging: enable via Flac#setOptions
) -
Flac.PaddingMetadata
-
FLAC padding metadata block
- See:
-
- Flac.FLAC__MetadataType#FLAC__METADATA_TYPE_PADDING
Properties:
Name Type Description dummy
number Conceptually this is an empty struct since we don't store the padding bytes. Empty structs are not allowed by some C compilers, hence the dummy. -
Flac.PictureMetadata
-
FLAC picture metadata block
Properties:
Name Type Description type
Flac.FLAC__StreamMetadata_Picture_Type The kind of picture stored. mime_type
string Picture data's MIME type, in ASCII printable characters 0x20-0x7e, NUL terminated. For best compatibility with players, use picture data of MIME type image/jpeg or image/png. A MIME type of '–>' is also allowed, in which case the picture data should be a complete URL. description
string Picture's description. width
number Picture's width in pixels. height
number Picture's height in pixels. depth
number Picture's color depth in bits-per-pixel. colors
number For indexed palettes (like GIF), picture's number of colors (the number of palette entries), or 0 for non-indexed (i.e. 2^depth). data_length
number Length of binary picture data in bytes. data
Uint8Array Binary picture data. -
Flac.PointerInfo
-
Helper object for allocating an array of buffers on the (memory) heap.
- See:
Properties:
Name Type Description pointerPointer
number pointer to the array of (pointer) buffers dataPointer
Array.<number> array of pointers to the allocated data arrays (i.e. buffers) -
Flac.ReadResult
-
Result / return value for
Flac~decoder_read_callback_fn
callback functionProperties:
Name Type Attributes Description buffer
TypedArray a TypedArray (e.g. Uint8Array) with the read data readDataLength
number the number of read data bytes. A number of 0
(zero) indicates that the end-of-stream is reached.error
boolean <optional>
OPTIONAL value of true
indicates that an error occured (decoding will be aborted) -
Flac.SeekPoint
-
FLAC seek point data
- See:
Properties:
Name Type Description sample_number
number The sample number of the target frame. NOTE -1
for a placeholder point.stream_offset
number The offset, in bytes, of the target frame with respect to beginning of the first frame. frame_samples
number The number of samples in the target frame. -
Flac.SeekTableMetadata
-
FLAC seek table metadata block
From the format specification: The seek points must be sorted by ascending sample number. Each seek point's sample number must be the first sample of the target frame. Each seek point's sample number must be unique within the table Existence of a SEEKTABLE block implies a correct setting of total_samples in the stream_info block. Behavior is undefined when more than one SEEKTABLE block is present in a stream.
- See:
-
- Flac.FLAC__MetadataType#FLAC__METADATA_TYPE_SEEKTABLE
Properties:
Name Type Description num_points
number the number of seek points points
Array.<Flac.SeekPoint> the seek points -
Flac.StreamMetadata
-
FLAC stream meta data
Properties:
Name Type Attributes Description min_blocksize
number the minimal block size (bytes) max_blocksize
number the maximal block size (bytes) min_framesize
number the minimal frame size (bytes) max_framesize
number the maximal frame size (bytes) total_samples
number the total number of (encoded/decoded) samples md5sum
string the MD5 checksum for the decoded data (if validation is active) sampleRate
number inherited the sample rate (Hz) channels
number inherited the number of channels bitsPerSample
number inherited bits per sample -
Flac.SubFrameMetadata
-
FLAC subframe metadata
Properties:
Name Type Description type
Flac.FLAC__SubframeType the type of the subframe data
number | Flac.FixedSubFrameData | Flac.LPCSubFrameData the type specific metadata for subframe wastedBits
number the wasted bits-per-sample -
Flac.SubFramePartition
-
metadata for FIXED or LPC subframe partitions
Properties:
Name Type Description type
Flac.FLAC__EntropyCodingMethodType the entropy coding method data
Flac.SubFramePartitionData metadata for a Rice partitioned residual -
Flac.SubFramePartitionContent
-
metadata for FIXED or LPC subframe partition data content
Properties:
Name Type Description parameters
Array.<number> The Rice parameters for each context. rawBits
Array.<number> Widths for escape-coded partitions. Will be non-zero for escaped partitions and zero for unescaped partitions. capacityByOrder
number The capacity of the parameters and raw_bits arrays specified as an order, i.e. the number of array elements allocated is 2 ^ capacity_by_order. -
Flac.SubFramePartitionData
-
metadata for FIXED or LPC subframe partition data
Properties:
Name Type Description order
number The partition order, i.e. # of contexts = 2 ^ order. contents
Flac.SubFramePartitionContent The context's Rice parameters and/or raw bits. -
Flac.VorbisCommentMetadata
-
FLAC vorbis comment metadata block
- See:
-
- Flac.FLAC__MetadataType#FLAC__METADATA_TYPE_VORBIS_COMMENT
Properties:
Name Type Description vendor_string
string the vendor string num_comments
number the number of comments comments
Array.<string> the comments
Events
-
Flac.event:CreatedEvent
-
Created event: is fired when an encoder or decoder was created.
Type:
- object
- See:
Properties:
Name Type Description type
"created" the type of the event "created"
target
Flac.CoderChangedEventData the information for the created encoder or decoder -
Flac.event:DestroyedEvent
-
Destroyed event: is fired when an encoder or decoder was destroyed.
Type:
- object
- See:
Properties:
Name Type Description type
"destroyed" the type of the event "destroyed"
target
Flac.CoderChangedEventData the information for the destroyed encoder or decoder -
Flac.event:ReadyEvent
-
Ready event: is fired when the library has been initialized and is ready to be used (e.g. asynchronous loading of binary / WASM modules has been completed). Before this event is fired, use of functions related to encoding and decoding may cause errors.
Type:
- object