Ogg Vorbis encoding on the Browser
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.

README.md

Overview

vorbis-encoder-js is a JavaScript Library that encodes audio data to Ogg Vorbis on web browsers with Browserify.

libogg and libvorbis are used for encoding engine. Emscripten is used to convert libogg/libvorbis C code into JavaScript.

this project is inspired by OggVorbisEncoder.js.

Installation

$ npm install vorbis-encoder-js

Usage

var Encoder = require("vorbis-encoder-js").encoder;

var sampleRate = audioBuffer.sampleRate;
var numberOfChannels = audioBuffer.numberOfChannels;
var quality = 0; // -0.1 to 1 (Vorbis quality)
var tags = {
  TITLE: "test_ogg",
  ALBUM: "テストアルバム", // UTF-8 is usable
  ARTIST: "miyabisun",
  LOOPSTART: "10000",
  LOOPLENGTH: "30000"
};

var encoder = new Encoder(sampleRate, numberOfChannels, quality, tags);
encoder.encodeFrom(audioBuffer);
var blob = encoder.finish();

Build

Docker and Node.js are required to build the library.

$ npm run build

Download and extract libogg + libvorbis, build library files (see package.json and Makefile for more details).

License

libogg and libvorbis are released under Xiph's BSD-like license below. JavaScript-converted part of this library follows the same license.

http://www.xiph.org/licenses/bsd/

This library is released under MIT licence, see LICENSE.txt.