Skip to content

FileEncoder

Melchor Garau Madrigal edited this page Nov 27, 2016 · 4 revisions

A stream.Writable class that converts some PCM input to flac output in a file.

FileEncoder(options)

You can pass all the options that can expect the Writable object, but also you can pass:

  • file: String - File to the output file
    • You must provide this value
  • isOggStream: Boolean
    • Indicates if the output would be an ogg stream or a raw FLAC stream
    • Defaults to false
  • channels: Number
    • Indicates to the encoder the number of channels that will have the PCM stream
    • Defaults to 2
  • bitsPerSample: Number
    • Indicates to the encoder the bits per sample of the PCM stream
    • Defaults to 16
  • samplerate: Number
    • Indicates to the encoder the samplerate of the PCM stream
    • Defaults to 44100
  • oggSerialNumber: Number
    • Indicates the serial number of the ogg stream, if its an ogg stream
    • No default value, you must provide this value if its an ogg stream
  • totalSamplesEstimate: Number
    • An estimation of the total samples of the PCM stream
    • Optional
  • compressionLevel: Number
  • doMidSideStereo: Boolean
    • When true, encodes stereo streams using mid-side encoding.
    • Optional
  • looseMidSideStereo: Number
    • When true and doMidSideStereo set to true, enables adaptative switching between mid-side and left-right encoding
    • Optional
  • apodization: String
  • maxLpcOrder: Number
    • Set the maximum LPC Order, or set to 0 to use fixed predictors
    • Optional
  • qlpCoeffPrecision: Number
    • Set the precision of the QLP coefficients, or 0 to let the encoder select it for you
    • Optional
  • doQlpCoeffPrecSearch: Boolean
  • doExhaustiveModelSearch: Boolean
  • minResidualPartitionOrder: Number
  • maxResidualPartitionOrder: Number
  • riceParameterSearchDist: Number

StreamEncoder.write(Buffer chunk, Callback? callback)

Writes some PCM data to be encoded. The buffer must contain PCM with the bps passed in the constructor, that is, if you want a 16 bps, the buffer must contain 16bps PCM. It will transform for you to 32bit buffer, that is the kind of data accepted by FLAC library.

Clone this wiki locally