decodeOrNull
Decodes a WAV or Ogg Vorbis file held in bytes, recognized by its header, into float samples at the file's own sample rate, or returns null when bytes is empty, is neither a WAV nor an Ogg Vorbis file, is corrupt, or is too long to hold in one array.
Conversion follows decode. bytes is only read during the call and never retained.
Samples
assertPrints(AudioSamples.decodeOrNull(byteArrayOf(1, 2, 3)), "null")Content copied to clipboard