Package Exports
- sharp11-web-audio
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (sharp11-web-audio) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
sharp11-web-audio
A Sharp11 plugin for playing notes, scales, and chords with Web Audio.
Introduction
This module is designed for use with the Sharp11 library. It comes with a piano soundfont and a simple loader that exposes functions for playing notes, scales, and chords from Sharp11.
Install
npm install sharp11-web-audio
Usage
var s11 = require('sharp11');
var audio = require('sharp11-web-audio');
audio.init(function (err, fns) {
// Your code here
});fns.play(obj, start, duration, callback)
objmust be a note, scale, chord, or array of notes.startspecifies how many seconds after invocation the object should be played. It is0by default.durationspecifies how many seconds the object should be sustained for. It is0.3by default.- If a
callbackis given, it will be invoked each time a note in the object is played. It is given two parameters, the original object and the particular note being played.
Chords and arrays of notes are played all at once. Scales are played in succession, with the duration applying to each note individually.
fns.arpeggiate(obj, start, duration, callback)
objmust be a scale, chord, or array of notes.startspecifies how many seconds after invocation the object should be played. It is0by default.durationspecifies how many seconds each note should be sustained for. It is0.3by default.- If a
callbackis given, it will be invoked each time a note in the object is played. It is given two parameters, the original object and the particular note being played.
Scales, chords and arrays of notes are played in succession, with the duration applying to each note individually.
fns.stop()
Stops all objects scheduled to be played in the future and their callbacks.