1.0.5 • Published 7 years ago

sharp11-web-audio v1.0.5

Weekly downloads
4
License
BSD-2-Clause
Repository
github
Last release
7 years ago

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)

  • obj must be a note, scale, chord, or array of notes.
  • start specifies how many seconds after invocation the object should be played. It is 0 by default.
  • duration specifies how many seconds the object should be sustained for. It is 0.3 by default.
  • If a callback is 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)

  • obj must be a scale, chord, or array of notes.
  • start specifies how many seconds after invocation the object should be played. It is 0 by default.
  • duration specifies how many seconds each note should be sustained for. It is 0.3 by default.
  • If a callback is 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.

1.0.5

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

8 years ago

1.0.0

8 years ago