Functions - Hekta/CHMIDI GitHub Wiki

CHMIDI functions:

string midi_play(file, location, [id, [playNow]]):

Creates a new MIDI sequence from the MIDI file that will be played at the given location, and returns the sequenceID. The block at the location must be a Note Block, the id must be unique, if it is not given or null, an unique id is created, playNow take a boolean, if false, the sequence is paused and it is not played immediatly, default to true. When a sequence is finished, it is removed. There are somes limitations imposed by Minecraft, the range of pitches is between F#3 to F#5 included, the pan, volume, sustain and others features are ignored, and Minecraft only contains four instruments. You can get more informations about the MIDI format here.

void midi_stop(sequenceID):

Stops the playing of the midi sequence and remove it.

boolean midi_exists(sequenceID):

Returns if the sequence with the given ID exists.

void midi_pause(sequencerID):

Pauses the playing of the midi sequence.

void midi_unpause(sequenceID):

Unpauses the playing of the midi sequence.

int midi_length(sequenceID):

Returns the length in microseconds of the MIDI sequence.

int midi_position(sequenceID):

Returns the current position in microseconds in the MIDI sequence.

void midi_set_position(sequenceID, position):

Sets the position in the midi sequence, position is in microseconds.

double midi_tempo(sequenceID):

Returns the tempo of the midi sequence, in BPM (Beats Per Minute).

void midi_set_tempo(sequenceID, tempo):

Sets the tempo of the midi sequence, a double, in BPM (Beats Per Minute).

int midi_repeat_count(sequenceID):

Returns the repeat count of the midi sequence. For example if count is 1 the sequence will be played twice.

void midi_set_repeat_count(sequenceID, count):

Sets the repeat count of the midi sequence, an integer. For example if count is 1 the sequence will be played twice.