sharp11-web-audio

1.0.5 • Public • Published

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.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.5
    0
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.5
    0
  • 1.0.3
    0
  • 1.0.2
    0
  • 1.0.1
    0

Package Sidebar

Install

npm i sharp11-web-audio

Weekly Downloads

0

Version

1.0.5

License

BSD-2-Clause

Last publish

Collaborators

  • jsrmath