GithubHelp home page GithubHelp logo

node-web-audio-api's Introduction

Node Web Audio API

This library implements the web audio API specification on node.js.

Why the hell doing that??? I know it sounds crazy, so I guess I'll have to build a case for it, and write some blog posts.

And this is not even alpha. Use this library only if you're the adventurous kind.

What's implemented

  • AudioContext(partially)
  • AudioParam (almost there)
  • AudioBufferSourceNode
  • ScriptProcessorNode
  • GainNode

What's left to do

Most of the AudioNodes ... Most of many other things ... :(

Installation

npm install web-audio-api

Demo

Get ready, this is going to blow up your mind :

node test/manual-testing/AudioContext-sound-output.js

Streaming audio

AudioContext just writes PCM data to a node writable stream. The default stream is a stream created with Speaker, which plays the audio back to your soundcard. But you can use any writable stream, file, including the stdin of a child process.

For example, here is an example for streaming audio to an icecast server, using ices :

var spawn = require('child_process').spawn
  , AudioContext = require('web-audio-api').AudioContext
  , context = new AudioContext()

var ices = spawn('ices', ['ices.xml'])
context.outStream = ices.stdin

Cool huh?

Extensions

Wow! The whole thing is not even half-done that there's already some extensions for it! See the list in the wiki.

Running the debugger

Right now everything runs in one process, so if you set a break point in your code, there's going to be a lot of buffer underflows, and you won't be able to debug anything.

One trick is to kill the AudioContext right before the break point, like this:

context._kill()
debugger

that way the audio loop is stopped, and you can inspect your objects in peace.

Running the tests

Tests are written with mocha. To run them, install mocha with :

npm install -g mocha

And in the root folder run :

mocha

Manual testing

To test the sound output :

node test/manual-testing/AudioContext-sound-output.js

To test AudioParam against AudioParam implemented in a browser, open test/manual-testing/AudioParam-browser-plots.html in that browser.

Changelog

0.1.5

  • AudioNode and AudioContext bug fixes

0.1.4

  • audioports : bug fixes

0.1.3

  • audioports : implemented channelInterpretation 'speakers'
  • AudioContext : added support for mp3 to decodeAudioData

0.1.2

  • AudioBufferSourceNode : handler onended implemented
  • AudioContext : method decodeAudioData, support only for wav

0.1.1

  • ScriptProcessorNode

  • AudioBufferSourceNode

    • node is killed once it has finished playing
    • subsequent calls to start have no effect
  • AudioContext : method collectNodes

  • audioports : bug fixes

0.1.0

  • AudioContext (partial implementation)
  • AudioParam (missing unschedule)
  • AudioBufferSourceNode (missing onended)
  • GainNode

node-web-audio-api's People

Contributors

kirbysayshi avatar sebpiq avatar

Watchers

 avatar  avatar  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.