mwg API
    Preparing search index...

    Function detectSampleCodec

    • Names the codec of one compressed sample from its first bytes, or throws naming what it found. An Ogg stream is Vorbis when its first packet starts \x01vorbis and Opus when it starts OpusHead; a stream beginning fLaC is FLAC.

      Parameters

      • bytes: Uint8Array

      Returns SampleCodec

      import { detectSampleCodec } from '@datamoc/mwg/audio';

      console.log(detectSampleCodec(new TextEncoder().encode('fLaC')));