Skip to content

MIDI implementation current state and usecases

Olivier Humbert edited this page Sep 22, 2018 · 29 revisions

This wiki page was created to list the complete midi behaviour of H2 and address the questions found in https://github.com/hydrogen-music/hydrogen/issues/63

Note that the MIDI-related feature-requests/bugs/... can be listed with the MIDI related label.

Table of content

Testing the current implementation :

  1. Test Setups
  1. Test Cases

How it should work :

Use cases - how it should work


Testing current implementation

Notes

  • sequencer notation :
    • 'dot-note' = the classic drum note (black dot)
    • 'bar-note' = note with well defined duration (black bar)
  • using jack audio server (jackdmp 1.9.11)
  • using 'jack_midi_dump -r' to monitor midi output
    • example output : +6144 : 90 0c 65 note on (channel 0): pitch 12, velocity 101
      • col1 (+6144) : relative time since previous midi messge
      • col2 (90 0c 65) : midi hex data
      • col3 (note on ... ) : human readable midi message

Test Setups

Test setup A :

  • default drumkit
  • 1 dot-note on the kick on beat '1'
  • set midi channel for Kick instrument to 1
  • instrument 'midi note' = 36 (=default value)
  • 1 pattern in the song, H2 in 'song mode', 'loop song' = off
  • lower tempo to 80

Test setup B :

  • same as setup A, but with these modifications :
  • pattern editor resolution : 32
  • 1 'bar-note' on the Kick on beat '1', duration : 1/32th

    this is the shortest 'bar-note' length possible and this is shorter that the duration of the Kick sample

Test setup C :

  • same as setup A, but with these modifications :
  • delete all samples (=all layers) of the Kick instruments making it a 'empty' instrument

Test setup D :

  • same as setup C, but with these modifications :
  • replace the 'dot-note' with a 'bar-note' with a duration if 1/32th note

Test setup E :

  • create a song with 1 pattern (song mode, not looped)
  • use a long sample (crash works fine)
  • place a dot on beat 1, and a second dot on beat 2
  • it is important that 'dot 2' is placed right after dot 1 so dot 2 can 'choke' the first dot
  • using 'piano roll editor' you can change the pitch of the second dot. This makes it easier to hear the difference between the 2 notes.
  • Also make the pitch of dot1 higher than dot 2. This ensures that the second note is longer than the first

Testcases

Each testcase consists of

  • a simple command
  • the midi output generated by H2
  • some remarks/observations

Test 1 : hit 'stop'

MIDI output Setup A, B, C, D

+11264: 80 24 00 note off (channel 0): pitch 36, velocity 0

Remarks:

  • Configured MIDI channel in H2 is '1' but here we see '0' > Seems that jack_midi_dump uses 0-based midi channels
  • GMIDImonitor reports '1' so this seems to confirm the above remark

Test 2 : hit 'play'

(pattern only plays 1 time since loop mode is off)

MIDI output Setup A

1)      0: 80 0c 00 note off (channel  0): pitch  12, velocity   0
2)     +1: 90 0c 65 note on  (channel  0): pitch  12, velocity 101
3) +19455: 80 0c 00 note off (channel  0): pitch  12, velocity   0
4) +64512: 80 24 00 note off (channel  0): pitch  36, velocity   0

Remarks Setup A:

  • message 1 and 2 are simultaneous when hitting 'play'
  • message 3 is sent at the end of the sample
  • message 4 is sent when the song ends

MIDI output Setup B

1)       0: 80 0c 00 note off (channel  0): pitch  12, velocity   0
2)      +1: 90 0c 65 note on  (channel  0): pitch  12, velocity 101
3)   +5119: 80 0c 00 note off (channel  0): pitch  12, velocity   0
4) +121856: 80 24 00 note off (channel  0): pitch  36, velocity   0

Remarks Setup B:

  • message 1 and 2 are simultaneous when hitting 'play'
  • message 3 is sent at the end of the 'bar-note'
  • message 4 is sent when the song ends

MIDI output Setup C & D

1)       0: 80 0c 00 note off (channel  0): pitch  12, velocity   0
2) +126976: 80 24 00 note off (channel  0): pitch  36, velocity   0

Remarks Setup C & D:

  • message 1 is generated when hitting 'play'
  • message 2 is sent when the song ends

Possible issues for all Setups:

  • Why is message 1 sent out? Maybe it is a 'clean up' to make sure the note is not playing any more before starting it (dont think this is a problem)
  • Only the last message uses the correct pitch (=key 36), all other messages use an incorrect value of 12 (?)

Test 3 : play/pauze

hit play, wait for sample to play completely, hit pause and finally hit play and let the song finish

MIDI output Setup A & B

1)      0: 80 0c 00 note off (channel  0): pitch  12, velocity   0
2)     +1: 90 0c 65 note on  (channel  0): pitch  12, velocity 101
3) +19455: 80 0c 00 note off (channel  0): pitch  12, velocity   0  (for setup A)
3)  +5119: 80 0c 00 note off (channel  0): pitch  12, velocity   0  (for Setup B)
4) +55296: 80 24 00 note off (channel  0): pitch  36, velocity   0
5) +14848: 80 24 00 note off (channel  0): pitch  36, velocity   0

Remarks setup A & B:

  • message 1 and 2 are simultaneous when hitting 'play'
  • message 3 is sent at the end of the sample (or bar-note for Setup B)
  • message 4 is sent when you hit 'pause'
  • message 5 is sent when the song ends

MIDI output Setup C & D

1)       0: 80 0c 00 note off (channel  0): pitch  12, velocity   0
2)  +53248: 80 24 00 note off (channel  0): pitch  36, velocity   0
3) +224256: 80 24 00 note off (channel  0): pitch  36, velocity   0

Remarks setup C & D:

  • message 1 is generated when hitting 'play'
  • message 2 is sent when you hit 'pause'
  • message 3 is sent when the song ends

Possible issues:

  • incorrect note 36<>12 for first 3 messages
  • the messages that are triggered by the transport buttons use the correct note 36

Test 4 : place 'dot-note'

Place a 'dot-note' on the Kick by clicking on the Kick sequence line in the pattern editor

MIDI output setup A & B

1)      0: 80 0c 00 note off (channel  0): pitch  12, velocity   0
2)     +1: 90 0c 65 note on  (channel  0): pitch  12, velocity 101
3) +19455: 80 0c 00 note off (channel  0): pitch  12, velocity   0

Remarks for setup A & B:

  • message 1 and 2 are sent out simultaneously when you place the 'dot-note'
  • message 3 is sent out when the sample stops playing
  • the same midi output is generated when you play the note using the PC keyboard (key Z for Kick)

MIDI output setup C & D

  : 80 0c 00 note off (channel  0): pitch  12, velocity   0

Possible issues for all setups:

  • wrong note (should be 36)

Test 5 : hit F12

Hitting F12 pauses playback and should mute all playing sounds

MIDI output (Setup A-D)

1)     0: 80 24 00 note off (channel  0): pitch  36, velocity   0

Remarks: none

Possible issues: none


Test 6 : test 'auto stop note' function

Hit play. the song (containing only 1 pattern) plays and stops at the end of the song.

MIDI output (Setup E)

1)       : 80 19 00 note off (channel  0): pitch  25, velocity   0
2)     +1: 90 19 65 note on  (channel  0): pitch  25, velocity 101
3)  +5375: 80 18 00 note off (channel  0): pitch  24, velocity   0
4)     +1: 90 18 65 note on  (channel  0): pitch  24, velocity 101
5) +93695: 80 19 00 note off (channel  0): pitch  25, velocity   0
6) +11520: 80 18 00 note off (channel  0): pitch  24, velocity   0
7) +61952: 80 31 00 note off (channel  0): pitch  49, velocity   0

Remarks:

  • dot note 1 = pitch 25, dot note 2 = pitch 24
  • message 1 and 2 are sent out simultaneously when you hit play
  • message 3 and 4 are sent out simultaneously when dot note 2 is played
  • message 5 = dot note 1 end
  • message 6 = dot note 2 end
  • message 7 = song end

Possible issues:

  • there is no difference in output if you check 'auto stop note' or not
  • expected is to see a note off for dot note 1 when dot note 2 is played > this is not the case (or simply a 'mute all' on that midi channel just before a new note is played to ensure that all samples stop playing)

Use cases

H2 as pure sequencer (Elpescado)

My use case is using Hydrogen as pure sequencer in tandem with external sampler, so sound is generated solely by second application. In that case, I'd like to create a drumkit, assign MIDI notes to instruments but not load any sample sounds.

However, Hydrogen refuses to play MIDI notes unless there's at leas one sample assigned to instrument.

Clone this wiki locally