timbre.js

JavaScript Library for Objective Sound Programming


The project page has been moved.

I started working on timbre.js successor, v13.xx.
It's almost a full rewrite, so this project page is no longer recent working.
The new project page is here: http://mohayonao.github.com/timbre.js/

CAUTION!!

The new timbre.js(v13.xx) is not compatible old timbre.js(v12.xx), but you may approve the new version, because that is truly convenient and super awesome than old.

See Also: Overview of what's new and changed from old timbre.js v12.XX


Latest Version

System Requirements

  • Chrome 14.0- (Web Audio API)
  • Safari 6.0- (Web Audio API)
  • Firefox 4.0- (Audio Data API)
  • Mobile Safari for iOS 6

Documents

Examples

01 - 02 - 03 - 04

Overview

Timbre.js is so easy. Open the WebConsole and run the below code or push [Play] button.

Play Pause
// Generate a 523.25Hz(C4) sinewave
T("sin", 523.25).play();

It's useful and powerful.

Play Pause
// generate a chord C-major            
T("+", T("sin", 523.35),
       T("sin", 659.25),
       T("sin", 783.99)).set({mul: 0.25}).play();
Play Pause
// tremolo & decay            
T("*", T("+", T("sin", 523.35),
              T("sin", 659.25),
              T("sin", 783.99)).set({mul: 0.25}),
       T("+tri", 2),
       T("perc", 15000)).play();

And Awesome!!

Play Pause
var mml   = T("mml", "t116 o3 $ l2 g l1 <b0<d0f+>> l2 d l1 <a0<c+0f+>>");
            
mml.synth = T("efx.reverb");
mml.synthdef = function(freq, opts) {
    var synth = T("*", T("+", T("tri", freq + 1, 0.25),
                              T("tri", freq - 1, 0.25)),
                       T("adsr", "24db", 100, 2500, 0.6, 1500));
    synth.keyon = function(opts) {
        synth.args[1].bang();
    };
    synth.keyoff = function(opts) {
        synth.args[1].keyoff();
    };
    return synth;
};

mml.synth.onplay = function() {
    mml.on().bang();
};
mml.synth.onpause = function() {
    mml.off();
};

return mml.synth;
Fork me on GitHub