wasm-audio-decoders icon indicating copy to clipboard operation
wasm-audio-decoders copied to clipboard

Complete decoders pack

Open dy opened this issue 1 year ago • 3 comments

Hi @eshaz. That comes to be very unique in class bundle, but it seems there's some more quite standard decoders out there, I'm curious if you would consider adding:

  • wav
  • webm
  • aiff, aac
  • m4a

dy avatar Jan 30 '23 16:01 dy

For WAV you can, in general, start at byte 44, see https://github.com/guest271314/AudioWorkletStream.

guest271314 avatar Feb 03 '23 01:02 guest271314

@dy For completeness encoding to Opus packets output by WebCodecs AudioEncoder - without a container - and playing back at Media Source Extensions or converting to WAV and playing back at HTMLMediaElement. The last time I tested (before adding support for embedding Media Session API metadata) the resulting single file was less total file size than Opus in WebM produced by MediaRecorder https://github.com/guest271314/WebCodecsOpusRecorder.

guest271314 avatar Feb 03 '23 02:02 guest271314

@dy Thanks for the additional suggestion.

  • wav, aiff
    • I've had a few others suggest this as well. These formats really aren't codecs, but are container formats that encapsulate raw (i.e. uncompressed) PCM data. However, it might be useful to have a WASM based converter for wav, aiff, and potentially other PCM formats that parses the information in these formats (i.e. sample rate, bit depth, channels) and outputs the audio as Float32Arrays. The conversion between whatever integer type is in these formats and float could be sped up significantly using WASM SIMD instructions.
  • aac
    • This is an audio codec, and I might add this one someday. This codec is widely used, but I would encourage anyone developing a new application with compressed audio to use Opus, which is open source and much better in terms of compression ratio and quality.
  • webm, m4a
    • These are container formats that can encapsulate many different codecs. I think for now I'm just going to support raw codecs and the Ogg container format in this library. If you have webm or m4a files, there might be other demuxers out there that can pull out the audio frames, which can then be decoded with this library.

eshaz avatar Feb 03 '23 05:02 eshaz