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.
\x01vorbis
OpusHead
fLaC
import { detectSampleCodec } from '@datamoc/mwg/audio';console.log(detectSampleCodec(new TextEncoder().encode('fLaC'))); Copy
import { detectSampleCodec } from '@datamoc/mwg/audio';console.log(detectSampleCodec(new TextEncoder().encode('fLaC')));
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
\x01vorbisand Opus when it startsOpusHead; a stream beginningfLaCis FLAC.