-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestMidi.ck
More file actions
44 lines (38 loc) · 888 Bytes
/
testMidi.ck
File metadata and controls
44 lines (38 loc) · 888 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
//Written by Colton Arnold Fall 2025
// instantiate a MIDI out object
MidiOut mout;
// a message to work with
MidiMsg msg;
// open a MIDI device for output
if( !mout.open(1) ) me.exit();
<<< "MIDI output device opened...", "" >>>;
// loop
while( true )
{
// MIDI note on message
// 0x90 + channel (0 in this case)
0x90 => msg.data1;
// pitch
0 => msg.data2;
// velocity
127 => msg.data3;
// print
<<< "sending NOTE ON message...", "" >>>;
// send MIDI messageß
mout.send( msg );
// let time pass
1::second => now;
// MIDI note off message
// 0x80 + channel (0 in this case)
0x80 => msg.data1;
// pitch
0 => msg.data2;
// velocity
0 => msg.data3;
// print
<<< "sending NOTE OFF message...", "" >>>;
// send MIDI message
mout.send( msg );
// let time pass
1::second => now;
}