Coder Social home page Coder Social logo

baudio's Introduction

baudio

generate audio streams with functions

example

var baudio = require('baudio');

var n = 0;
var b = baudio(function (t) {
    var x = Math.sin(t * 262 + Math.sin(n));
    n += Math.sin(t);
    return x;
});
b.play();

methods

var baudio = require('baudio')

var b = baudio(opts, fn)

Return a readable stream of raw audio data based on the channel functions provided. Passing fn is a short-hand for b.push(fn).

The opts.rate is the rate of the output stream in Hz, default 44000.

The opts.size is the size of data chunks to emit, default 1024.

b.push(ix=0, fn)

Push a new track onto the channel at index ix with the function fn(t, i) for the time in seconds t and a counter i.

b.addChannel(type, fn)

Push a new audio channel of type, optionally initializing the channel with a function fn(t, i).

type defaults to 'float' which expects inputs in the range [-1,1] and clips higher and lower values.

type can also be a power of 2 number of bits to use for each sample which expects an integer output value in [0,Math.pow(2,type)-1].

b.play(opts)

Play the audio demo with the play command.

You can also call b.pipe() to handle the output stream yourself.

opts are passed directly through to sox.

b.record(file, opts)

Save the audio stream to file using the sox command.

You can also call b.pipe() to handle the output stream yourself.

opts are passed directly through to sox.

install

With npm do:

npm install baudio

license

MIT

baudio's People

Stargazers

 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.