Giter VIP home page Giter VIP logo

unitgen's Introduction

unitgen

unitgen is a Node.js powered unit-generator API, built using streams and the speaker bindings.

unitgen was built for a demo being given at Dance.js.

In a nutshell

Unit generators are best thought of as a graph of transformations applied to an audio-stream.

This can be used to:

  • apply effects (changing tempo, changing pitch, applying distortion).
  • mix together and pan-between multiple tracks.
  • pan between left and right stereo.

How does it work?

  • unitgen's speaker binding invokes a callback which samples from a stream 44100 times a second.
  • the stream takes a snapshot of the current state of all the unit-generators, and outputs a frame of audio.
  • a frame of audio consists of bytes indicating the speaker position for left and right audio.

Installing

npm install unitgen -g

Examples

So that you can get an idea of unitgen in action, we've provided a few sample unit-generator-graphs. For each example, use a and s to pan back and forth.

  • stereo.js: uses a function unit-generator to play a sine-wave which can be panned between the left and right speaker.
unitgen stereo
  • canceling.js: uses a combiner, and two function unit-generators to play two inverse sine-waves. Pan back and forth to hear them cancel out.
unitgen canceling
  • mixer.js: uses a combiner, and two sound-file unit-generators to pan between two songs.
unitgen mixer --track1=./foo.wav --track2=./foo2.wav

The future

unitgen is a rough proof of concept. Over time we'd love to see this grow into a full-featured API for building (as a practical example) mixers in JavaScript.

patches welcome!

unitgen's People

Contributors

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