h-audio

    0.1.11 • Public • Published

    Library for playing notes in the browser using webaudio.

    Build Status

    Example

    http://rsk7.github.io/h/

    Usage

    Require:

    var h = require("h-audio");

    To play notes:

    // if octaves are not specified, the default is 4
    h.play("C,E,G");
    h.play("D2,F#3,A4");
    h.play("G1,B,D4");

    To stop notes:

    h.stop("E");
    h.stop("D2,F#3,A4");

    To stop all notes:

    h.stop();

    To get notes that are currently playing:

    h.getActiveNotes();
    h.getActiveNoteIds();

    Configuration

    The configure method takes an object of the following type. Allowing changes to gain, attack, release and wave parameters. Configuration changes effect all notes immediately.

    To set the configuration object:

    h.configure({
      gain: 0.15,
      attack: 0.1,
      release: 0.1,
      wave: {
        type: "sine",
        data: null
      }
    });

    To get the current configuration:

    var currentConfiguration = h.configuration;

    Install

    npm i h-audio

    DownloadsWeekly Downloads

    12

    Version

    0.1.11

    License

    MIT

    Last publish

    Collaborators

    • avatar