JSPM

oggmented

1.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 487
  • Score
    100M100P100Q90647F
  • License MIT

Drop-in replacement for AudioContext. Overrides decodeAudioData and provides Ogg Vorbis decoding, calling super.decodeAudioData for non-vorbis.

Package Exports

  • oggmented

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (oggmented) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

oggmented

oggmented extends AudioContext and overrides decodeAudioData to use an Emscripten transpiling of libogg-1.3.4 and libvorbis-1.3.6 when it encounters ogg vorbis data.

This allows you to decodeAudioData ogg vorbis buffers correctly in any browser. This is especially useful in Safari and iOS browsers, which don't decodeAudioData(oggVorbisBuffer) at all.

In addition, Blink (Brave, Opera, Chrome) uses ffmpeg, which has a bug that slightly bloats the end of decoded vorbis audio, resulting in clicks when audioContext.createBufferSource().loop === true. Using this package fixes that (assuming of course that the waveform begins and ends at the same place etc).

Installation

npm install oggmented

Usage

Use it like you would regular AudioContext:

import oggmentedAudioContext from 'oggmented'

const audioCtx = new oggmentedAudioContext()
// instead of 
// const audioCtx = new (window.AudioContext || window.webkitAudioContext)()