SimpleTune

A small library for playing single notes using the WebAudio API.

Try it out:

> var myTune = new SimpleTune('triangle');
myTune.playNote('A4', 50);

SimpleTune takes care of the tedious WebAudio API work for you. It's great for those times where you really just need to play a few notes on a page to provide feedback to the user.

Examples

You can specify frequency instead of a note, and also how long the note will be held.

> myTune.playNote(440, 1000);

Playing a note returns a Promise that resolves when the note finishes playing.

> myTune.playNote('G4', 1000).then(function() {
alert('Done!');
});

Download

To download SimpleTune and see more examples and documentation, visit the Github page.


By Chris Anselmo