Jazz-Soft.net

We make it sound!

Home » Documentation » JZZ.js » JZZ.lib

JZZ.lib

Library for user-drfined modules

openMidiIn()

JZZ.lib.openMidiIn(name, engine) - open custom MIDI-In port.

Returns a MIDI-In port object and tries to initialize it by calling engine._openIn(port, name).

Use this call in your custom modules.

openMidiOut()

JZZ.lib.openMidiOut(name, engine) - open custom MIDI-Out port.

Returns a MIDI-Out port object and tries to initialize it by calling engine._openOut(port, name).

Use this call in your custom modules.

registerMidiIn()

JZZ.lib.registerMidiOut(name, engine) - register custom MIDI-Out port.

Registers engine to handle the custom MIDI-In port named name. It can be later opened by calling JZZ().openMidiIn(name).

Returns true if successful. If the custom port with the same name is already registered, returns false.

Use this call in your custom modules.

registerMidiOut()

JZZ.lib.registerMidiIn(name, engine) - register custom MIDI-In port.

Registers engine to handle the custom MIDI-Out port named name. It can be later opened by calling JZZ().openMidiOut(name).

Returns true if successful. If the custom port with the same name is already registered, returns false.

Use this call in your custom modules.

getAudioContext()

JZZ.lib.getAudioContext() - activate and return window.AudioContext on platforms that support it.

JZZ will take care about Gesture AudioContext activation and other platform-specific quirks.

Use this call in your custom modules.

toBase64()

JZZ.lib.toBase64(str) - encode string to Base64 format.

e.g. JZZ.lib.toBase64('MIDI') returns 'TUlESQ=='.

Can be used to save MIDI file as data URL.

fromBase64()

JZZ.lib.fromBase64(data) - decode Base64-encoded data.

e.g. JZZ.lib.fromBase64('TUlESQ==') returns 'MIDI'.

Can be used to read MIDI file from data URL.

toUTF8()

JZZ.lib.toUTF8(str) - convert string to UTF-8.

e.g. JZZ.lib.toUTF8('𝄞') returns '\xED\xA0\xB4\xED\xB4\x9E'.

Can be used to handle UTF-8 text in MIDI files.

fromUTF8()

JZZ.lib.fromUTF8(data) - decode string from UTF-8; if the input string is not valid UTF-8, return it as it is.

e.g. JZZ.lib.fromUTF8('\xF0\x9D\x84\x9E') and JZZ.lib.fromUTF8('\xED\xA0\xB4\xED\xB4\x9E') return '𝄞'.

Can be used to handle UTF-8 text in MIDI files.

See also