mwg API
    Preparing search index...

    Function encodeFlac

    • Encodes mono 16-bit frames as a FLAC stream (fLaC, STREAMINFO, then frames), lossless: the decoder returns exactly frames. rate goes into STREAMINFO; the MD5 field stays zero, which the format defines as "not computed".

      Parameters

      • frames: Int16Array
      • rate: number

      Returns Uint8Array

      import { decodeFlac, encodeFlac } from '@datamoc/mwg/audio';

      const flac = encodeFlac(Int16Array.from([0, 100, 200, 100, 0]), 22050);
      console.log(decodeFlac(flac).rate); // 22050