Debian Codegraph @

examples/midi/midiout2.ck

raw
1 //-----------------------------------------------------------------------------
2 // name: midiout2.ck
3 // desc: example of sending MIDI messages using MidiOut only
4 // requires: chuck-1.5.2.5 or higher | author: cviejo
5 // note: for a good explanation of how MIDI messages work and sending raw midi
6 // messages, see midiout.ck
7 //-----------------------------------------------------------------------------
8
9 // instantiate a MIDI out object
10 MidiOut mout;
11 // open a MIDI device for output
12 if( !mout.open(0) ) me.exit();
13
14 <<< "MIDI output device opened...", "" >>>;
15
16 // loop
17 while( true )
18 {
19 <<< "sending note on message...", "" >>>;
20 mout.noteOn( 0, 60, 127 );
21 1::second => now;
22
23 <<< "sending note off message...", "" >>>;
24 mout.noteOff( 0, 60, 0 );
25 1::second => now;
26
27 <<< "sending control change message...", "" >>>;
28 mout.controlChange( 0, 14, 127 );
29 1::second => now;
30
31 <<< "sending program change message...", "" >>>;
32 mout.programChange( 0, 6 );
33 1::second => now;
34
35 <<< "sending polyphonic key pressure (aftertouch)...", "" >>>;
36 mout.polyPressure( 0, 60, 127 );
37 1::second => now;
38
39 <<< "sending channel pressure (aftertouch)...", "" >>>;
40 mout.channelPressure( 0, 127 );
41 1::second => now;
42
43 <<< "sending pitch bend message...", "" >>>;
44 mout.pitchBend( 0, 96 ); // +50% or 1.00 semitone up
45 1::second => now;
46
47 <<< "sending fine resolution pitch bend message...", "" >>>;
48 mout.pitchBend( 0, 50, 96 ); // +51% or 1.01 semitone up
49 1::second => now;
50 }