new MidiIn( dhc, midi )

Description

The MidiIn class.

Manage MIDI input messages.

Parameters
Name Type Description
dhc HUM.DHC

The DHC instance to which it belongs

midi HUM.midi.MidiHub

The MidiHub instance to which it belongs

Details

Members


dhc :HUM.DHC

Description

The DHC instance

Details

midi :HUM.midi.MidiHub

Description

The MidiHub instance

Details

midiPassThrough :Array.<OtherMidiMsg>

Description

Output queue buffer for MIDI messages that must pass through and go out
(used as logger at the moment)

Details
Array.<OtherMidiMsg>

- Pass through for most of the MIDI messages


uiElements :Object

Description

UI HTML elements

Properties
Name Type Description
fn Object.<string, HTMLElement>

Functional UI elements

in Object.<string, HTMLElement>

Input UI elements

out Object.<string, HTMLElement>

Output UI elements

Details
Object

notes_on :Object.<number, Object.<midinnum, MidiInNoteOn>>

Description

Register of the MIDI Note-On inputs by channel.
Actually it's common to all input ports.

Examples
// An example of structure of .notes_on[0]
			0: {                                   // MIDI Channel
			    39: {                              // External MIDI note number (on the instrument)
			        keymapped: 56,                 // Internal MIDI note number (on the keymap)
			        midievent: {MIDIMessageEvent}  // The original `MIDIMessageEvent`
			    }
			}
Details
Object.<number, Object.<midinnum, MidiInNoteOn>>

Dynamic, one for each imput port. Now two in ports can conflicts if use the same channels.

Methods


updatesFromDHC( msg )

Description

Manage and route an incoming message

Parameters
Name Type Description
msg HUM.DHCmsg

The incoming message

Details

allNotesOff()

Description

Clear the HUM.midi.MidiIn#notes_on register

Details

midiMessageReceived( midievent [, deSnapped ] )

Description

Handle the incoming MIDI messages

Parameters
Name Type Attributes Default Description
midievent MIDIMessageEvent

The MIDI message from HUM.midi.MidiPorts#midiAccess

Name Type Description
data Uint8Array

The data array (each entry is a 8bit integer)

timeStamp number

The Time-stamp of the message in milliseconds (floating-point number)

deSnapped boolean <optional>
false

If the Note-Off comes from de-snapping action, by the T-Snap receive mode.

false: (default) The note will be turned-off deleted from the HUM.midi.MidiIn#notes_on register
true: (default) The note will be turned-off but still remains in the HUM.midi.MidiIn#notes_on register


playTone( ctrlNum, velocity, statusByte, timestamp, piper, tsnap )

Description

Send a Note-ON over the app

Parameters
Name Type Description
ctrlNum midinnum

MIDI note number of the incoming MIDI message

velocity velocity

Velocity of the incoming MIDI message

statusByte number

Status Byte of the incoming MIDI message

timestamp number

Timestamp of the incoming MIDI message (currently not used)

piper boolean

If is a note generated by the Piper feature:
false: it's not Piper;
true: it's Piper.

tsnap boolean

If is a note translated by the T-Snap receive mode:
false: it's not T-snapped;
true: it's T-snapped.

Details

muteTone( ctrlNum, velocity, statusByte, timestamp [, panic ] )

Description

Send a Note-OFF over the app

Parameters
Name Type Attributes Default Description
ctrlNum midinnum

MIDI note number of the incoming MIDI message

velocity velocity

Velocity of the incoming MIDI message

statusByte number

Status Byte of the incoming MIDI message

timestamp number

Timestamp of the incoming MIDI message (currently not used)

panic boolean <optional>
false

It tells that the message has been generated by a "hard" All-Notes-Off request.

Details

tsnapUpdateHT()

Description

Updates the status of the keys pressed on the controller when the T-Snap is active.
It should be invoked when the HTs table at HUM.DHC#tables changes.
Allows you to play only the keys that match the HTs frequencies.
If a key on the controller remains pressed, it will be dynamically switched on or off when the HTs table is updated.

Details

tsnapFindCtrlNoteNumber( midi_note_number, type ) → {false|midinnum}

Description

Check if a frequency of a MIDI Note Number corresponds to a Harmonic (or Subharmonic) in the HT table under HUM.DHC#tables

Parameters
Name Type Description
midi_note_number midinnum

The MIDI Note Number to be found in the reverse table

type tonetype

The type of tone (FT or HT)

Returns
  • Returns the keymapped MIDI Note Number that match the nearest HT to the incoming Note; if nothing is found, returns false
Details

tsnapChannel( midi_note_number, channel, hancock ) → {false|midinnum}

Description

Tone Snap Channel receive mode router. Route messages accordingly to the MIDI Channel.

Parameters
Name Type Description
midi_note_number midinnum

The MIDI Note Number to be found in the reverse table

channel midichan

The MIDI Channel from which the message is coming from

hancock boolean

If the message comes from the Hancock virtual MIDI input (if it's true ignore and don't apply T-Snap)

Returns
  • Returns the keymapped MIDI Note Number that match the nearest HT to the incoming Note; if nothing is found, returns false
Details

tsnapDivider( midi_note_number, channel, hancock ) → {false|midinnum}

Description

Tone Snap Divider receive mode router. Route messages accordingly to the divider MIDI Note Number.

Parameters
Name Type Description
midi_note_number midinnum

The MIDI Note Number to be found in the reverse table

channel midichan

The MIDI Channel from which the message is coming from

hancock boolean

If the message comes from the Hancock virtual MIDI input (if it's true ignore and don't apply T-Snap)

Returns
  • Returns the keymapped MIDI Note Number that match the nearest HT to the incoming Note; if nothing is found, returns false
Details

switchReceiveModeUI( receive_mode )

Description

Switch the MIDI INPUT RECEIVING MODE (called when UI is updated)

Parameters
Name Type Description
receive_mode 'keymap' | 'tsnap-channel' | 'tsnap-divider'

FT/HT controller note receiving mode

Details

monitorMidiIN( noteNumber, velocity, channel, portName )

Description

MIDI-IN MONITOR

Parameters
Name Type Description
noteNumber midinnum

MIDI Note number (or conversion string if the Tone snapping receiving mode is active)

velocity velocity

MIDI Velocity amount

channel midichan

MIDI Channel number

portName string

MIDI Port name

Details

logMidiEvent( midievent )

Description

MIDI event log for debug purposes

Parameters
Name Type Description
midievent MIDIMessageEvent

The MIDI message event

Details

_initUI()

Description

Initialize the UI of the MidiIn instance

Details