Git Product home page Git Product logo

opus.js-sample's Introduction

libopus.js

非可逆音声符号形式であるOpusのJavaScript実装と, Webブラウザを用いてOpusのエンコード・デコードを行うサンプルです.

TypeScriptで記述しています.

Demo: https://kazuki.github.io/opus.js-sample/index.html

詳細

OpusのJavaScript実装は,Xiph.org Foundationによる Opusの実装Emscriptenを使ってコンパイルしたものです.

Webブラウザを用いてOpusのエンコード・デコードを行うサンプルでは, ローカルに保存してあるRIFF PCM Waveファイルを再生したり, そのファイルを利用して,エンコード速度・デコード速度を測定するほか, エンコード結果をデコードし,その結果を再生することが出来ます.

このエンコード・デコード機能のサンプルでは, WebWorkerを利用し別スレッドでエンコード・デコード処理を行うため, ブラウザの他の処理に影響を与えません. また,Opusのデコード負荷がそれほど高くないことと, Emscriptenが出力するasm.jsは高速に動作するため,スマートフォン上でもOpusのリアルタイムデコードが可能です.

Opusは限られたサンプリングレートにしか対応しておらず, また,WebAudioのAudioContextは環境に依存したサンプリングレートでしか動作しないため, このサンプルではSpeexのリサンプラーを利用してサンプリングレートを合わせています.

各種バージョン

  • opus: master (3a1dc9dc, Tue Aug 4 15:24:21 2015 -0400)
  • speexdsp: 1.2rc3 (887ac103, Mon Dec 15 01:27:40 2014 -0500)
  • emscripten: v1.34.8

ビルド方法

Makefileを用意してありますので,以下のコマンドを実行してください. 事前にemscriptenの各種実行ファイルにパスを通す必要があります. また,opus/speexdspがgcc等を使って普通にビルドできる環境である必要が有ります.

$ git clone --recursive https://github.com/kazuki/opus.js-sample.git
$ cd opus.js-sample
$ git submodule init
$ git submodule update
$ make

ライセンス

修正BSDライセンス

opus.js-sample's People

Contributors

jeffkaufman avatar kazuki avatar rillke avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.