Class: Output

Output

Provides a MIDI realtime or file output to play/write a Song.

Constructor

new Output()

Source:

Methods

(static) select(constructorOptions) → {Promise}

Select the MIDI output interactively, or via a command line argument or environment variable.

Parameters:
Name Type Description
constructorOptions

options object passed to the constructor.

Source:
Returns:

a Promise object that resolves to a MidiOut instance

Type
Promise
Example
# chorus-script.js
const { Song } = require('chorus');
const { MidiOut } = require('chorus/midi');
const song = new Song(...);
MidiOut.select().then(midiOut => midiOut.play(song));

____________________________________________________
# command line usage

# realtime output with the given port:
node chorus-script.js -p midiPortName

# or via an environment variable:
CHORUS_OUTPUT_PORT=midiPortName node chorus-script.js

# file output:
node chorus-script.js -f midiFileName