Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- desc:HX Stomp CC Controller
- author:Rymix
- version:1.0
- about:
- Converts MIDI notes to CC messages for HX Stomp control.
- CC Control Notes (draw blocks to show effect duration):
- C3 (note 60) -> CC101
- C#3 (note 61) -> CC102
- D3 (note 62) -> CC103
- D#3 (note 63) -> CC104
- E3 (note 64) -> CC105
- F3 (note 65) -> CC106
- F#3 (note 66) -> CC107
- G3 (note 67) -> CC108
- Note-on sends CC value 127 (effect ON)
- Note-off sends CC value 0 (effect OFF)
- Program Change:
- B2 (note 59) -> Program Change
- Velocity determines program number (0-127)
- slider1:1<1,16,1>MIDI Output Channel
- slider2:10<1,100,1>Sample Spacing (anti-congestion)
- @init
- msg_count = 0;
- @block
- msg_count = 0;
- while (midirecv(offset, msg1, msg2, msg3)) (
- status = msg1 & 0xF0;
- note = msg2;
- velocity = msg3;
- out_channel = slider1 - 1;
- handled = 0;
- // Note on with velocity > 0
- (status == 0x90 && velocity > 0) ? (
- // CC control notes: C3 (60) to G3 (67) -> CC101-108
- (note >= 60 && note <= 67) ? (
- cc_num = 101 + (note - 60);
- out_offset = offset + (msg_count * slider2);
- midisend(out_offset, 0xB0 + out_channel, cc_num, 127);
- msg_count += 1;
- handled = 1;
- );
- // Program change: B2 (59), velocity = program number
- (note == 59) ? (
- out_offset = offset + (msg_count * slider2);
- midisend(out_offset, 0xC0 + out_channel, velocity, 0);
- msg_count += 1;
- handled = 1;
- );
- );
- // Note off (status 0x80 or note-on with velocity 0)
- ((status == 0x80) || (status == 0x90 && velocity == 0)) ? (
- // CC control notes: send CC value 0 (effect OFF)
- (note >= 60 && note <= 67) ? (
- cc_num = 101 + (note - 60);
- out_offset = offset + (msg_count * slider2);
- midisend(out_offset, 0xB0 + out_channel, cc_num, 0);
- msg_count += 1;
- handled = 1;
- );
- // Ignore note-off for PC note (program change is momentary)
- (note == 59) ? (
- handled = 1;
- );
- );
- // Pass through any unhandled MIDI messages
- !handled ? midisend(offset, msg1, msg2, msg3);
- );
Advertisement
Add Comment
Please, Sign In to add comment