0.2.0 • Published 30 days ago

xen-midi v0.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
30 days ago

xen-midi

Free-pitch polyphonic MIDI I/O based on webmidi.js using multi-channel pitch-bend

Installation

npm i

Documentation

Documentation is hosted at the project Github pages.

To generate documentation locally run:

npm run doc

Example

import {WebMidi} from 'webmidi';
import {MidiOut} from 'xen-midi';

async function play() {
  await WebMidi.enable();

  // Set maximum microtonal polyphony to 4 (the number of channels reserved).
  const channels = new Set([1, 2, 3, 4]);
  const midiOut = new MidiOut(WebMidi.outputs[1], channels);

  // Play a just intonation 4:5:6 major chord.
  midiOut.playNotes([
    {
      frequency: 440,  // Frequency in Hz
      rawAttack: 80,   // Attack velocity from 0 to 127
      rawRelease: 80,  // Release velocity from 0 to 127
      time: "+0",      // Relative time starting from now
      duration: 500,   // Time is measured in ms
    },
    // Attack and release default to 64.
    {
      frequency: 550,
      time: "+100",
      duration: 500,
    },
    {
      frequency: 660,
      time: "+200",
      duration: 500,
    }
  ]);
}

play();
0.2.0

30 days ago

0.1.3

1 month ago

0.1.2

3 months ago

0.1.1

5 months ago

0.1.0

6 months ago

0.0.3

2 years ago