Testing funky drummer midi output for cubase test
Dependencies: USBDevice mbed-src
main.cpp@0:d4cee525061a, 2015-08-17 (annotated)
- Committer:
- GonzoBurns
- Date:
- Mon Aug 17 23:30:32 2015 +0000
- Revision:
- 0:d4cee525061a
initial funky drummer MIDI Output for testing
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
GonzoBurns | 0:d4cee525061a | 1 | #include "mbed.h" |
GonzoBurns | 0:d4cee525061a | 2 | |
GonzoBurns | 0:d4cee525061a | 3 | #include "USBMIDI.h" |
GonzoBurns | 0:d4cee525061a | 4 | |
GonzoBurns | 0:d4cee525061a | 5 | // GM standard drum map, see: http://commons.wikimedia.org/wiki/File:GMStandardDrumMap.gif |
GonzoBurns | 0:d4cee525061a | 6 | #define C1 36 // bass drum |
GonzoBurns | 0:d4cee525061a | 7 | #define Cis1 37 // side stick |
GonzoBurns | 0:d4cee525061a | 8 | #define D1 38 // acoustic snare |
GonzoBurns | 0:d4cee525061a | 9 | #define Dis1 39 // hand clap |
GonzoBurns | 0:d4cee525061a | 10 | #define E1 40 // electric snare |
GonzoBurns | 0:d4cee525061a | 11 | #define F1 41 // low floor tom |
GonzoBurns | 0:d4cee525061a | 12 | #define Fis1 42 // closed hi-hat |
GonzoBurns | 0:d4cee525061a | 13 | #define G1 43 // high floor tom |
GonzoBurns | 0:d4cee525061a | 14 | #define Gis1 44 // pedal hi-hat |
GonzoBurns | 0:d4cee525061a | 15 | #define A1 45 // low tom |
GonzoBurns | 0:d4cee525061a | 16 | #define Ais1 46 // open hi-hat |
GonzoBurns | 0:d4cee525061a | 17 | #define B1 47 // low-mid tom |
GonzoBurns | 0:d4cee525061a | 18 | #define C2 48 // hi-mid tom |
GonzoBurns | 0:d4cee525061a | 19 | #define Cis2 49 // crash cymbal |
GonzoBurns | 0:d4cee525061a | 20 | #define D2 50 // hi tom |
GonzoBurns | 0:d4cee525061a | 21 | #define Dis2 51 // ride cymbal |
GonzoBurns | 0:d4cee525061a | 22 | #define E2 52 // chinese cymbal |
GonzoBurns | 0:d4cee525061a | 23 | #define F2 53 // ride bell |
GonzoBurns | 0:d4cee525061a | 24 | #define Fis2 54 // tamburine |
GonzoBurns | 0:d4cee525061a | 25 | #define G2 55 // splash cymbal |
GonzoBurns | 0:d4cee525061a | 26 | #define Gis2 56 // cowbell |
GonzoBurns | 0:d4cee525061a | 27 | #define A2 57 // crash cymbal 2 |
GonzoBurns | 0:d4cee525061a | 28 | #define Ais2 58 // vibraslap |
GonzoBurns | 0:d4cee525061a | 29 | #define B2 59 // ride cymbal 2 |
GonzoBurns | 0:d4cee525061a | 30 | #define C3 60 |
GonzoBurns | 0:d4cee525061a | 31 | #define Cis3 61 |
GonzoBurns | 0:d4cee525061a | 32 | #define D3 62 |
GonzoBurns | 0:d4cee525061a | 33 | #define Dis3 63 |
GonzoBurns | 0:d4cee525061a | 34 | #define E3 64 |
GonzoBurns | 0:d4cee525061a | 35 | #define F3 65 |
GonzoBurns | 0:d4cee525061a | 36 | #define Fis3 66 |
GonzoBurns | 0:d4cee525061a | 37 | #define G3 67 |
GonzoBurns | 0:d4cee525061a | 38 | #define Gis3 68 |
GonzoBurns | 0:d4cee525061a | 39 | #define A3 69 |
GonzoBurns | 0:d4cee525061a | 40 | #define Ais3 70 |
GonzoBurns | 0:d4cee525061a | 41 | #define B3 71 |
GonzoBurns | 0:d4cee525061a | 42 | #define C4 72 |
GonzoBurns | 0:d4cee525061a | 43 | #define Cis4 73 |
GonzoBurns | 0:d4cee525061a | 44 | #define D4 74 |
GonzoBurns | 0:d4cee525061a | 45 | #define Dis4 75 |
GonzoBurns | 0:d4cee525061a | 46 | #define E4 76 |
GonzoBurns | 0:d4cee525061a | 47 | #define F4 77 |
GonzoBurns | 0:d4cee525061a | 48 | #define Fis4 78 |
GonzoBurns | 0:d4cee525061a | 49 | #define G4 79 |
GonzoBurns | 0:d4cee525061a | 50 | #define Gis4 80 |
GonzoBurns | 0:d4cee525061a | 51 | #define A4 81 |
GonzoBurns | 0:d4cee525061a | 52 | #define Ais4 82 |
GonzoBurns | 0:d4cee525061a | 53 | #define B4 83 |
GonzoBurns | 0:d4cee525061a | 54 | |
GonzoBurns | 0:d4cee525061a | 55 | #define HIHAT_CLOSED Fis1 |
GonzoBurns | 0:d4cee525061a | 56 | #define HIHAT_OPEN Ais1 |
GonzoBurns | 0:d4cee525061a | 57 | #define HIHAT_PEDAL Gis1 |
GonzoBurns | 0:d4cee525061a | 58 | #define BASEDRUM C1 |
GonzoBurns | 0:d4cee525061a | 59 | #define SNARE E1 |
GonzoBurns | 0:d4cee525061a | 60 | |
GonzoBurns | 0:d4cee525061a | 61 | #define TEMPO 0.2 |
GonzoBurns | 0:d4cee525061a | 62 | |
GonzoBurns | 0:d4cee525061a | 63 | #define FULL 127 |
GonzoBurns | 0:d4cee525061a | 64 | #define NORMAL 100 |
GonzoBurns | 0:d4cee525061a | 65 | #define BLUENOTE 70 |
GonzoBurns | 0:d4cee525061a | 66 | |
GonzoBurns | 0:d4cee525061a | 67 | |
GonzoBurns | 0:d4cee525061a | 68 | USBMIDI midi; |
GonzoBurns | 0:d4cee525061a | 69 | DigitalOut myled(LED1); |
GonzoBurns | 0:d4cee525061a | 70 | |
GonzoBurns | 0:d4cee525061a | 71 | void beat_1() { |
GonzoBurns | 0:d4cee525061a | 72 | midi.write( MIDIMessage::NoteOn( HIHAT_CLOSED, NORMAL ) ); |
GonzoBurns | 0:d4cee525061a | 73 | midi.write( MIDIMessage::NoteOn( BASEDRUM , NORMAL ) ); |
GonzoBurns | 0:d4cee525061a | 74 | } |
GonzoBurns | 0:d4cee525061a | 75 | |
GonzoBurns | 0:d4cee525061a | 76 | void beat_1_E () { |
GonzoBurns | 0:d4cee525061a | 77 | midi.write( MIDIMessage::NoteOn( HIHAT_CLOSED, NORMAL ) ); |
GonzoBurns | 0:d4cee525061a | 78 | } |
GonzoBurns | 0:d4cee525061a | 79 | |
GonzoBurns | 0:d4cee525061a | 80 | void beat_1_AND () { |
GonzoBurns | 0:d4cee525061a | 81 | midi.write( MIDIMessage::NoteOn( HIHAT_CLOSED, NORMAL ) ); |
GonzoBurns | 0:d4cee525061a | 82 | midi.write( MIDIMessage::NoteOn( BASEDRUM , NORMAL ) ); |
GonzoBurns | 0:d4cee525061a | 83 | } |
GonzoBurns | 0:d4cee525061a | 84 | |
GonzoBurns | 0:d4cee525061a | 85 | void beat_1_A () { |
GonzoBurns | 0:d4cee525061a | 86 | midi.write( MIDIMessage::NoteOn( HIHAT_CLOSED, NORMAL ) ); |
GonzoBurns | 0:d4cee525061a | 87 | } |
GonzoBurns | 0:d4cee525061a | 88 | |
GonzoBurns | 0:d4cee525061a | 89 | void beat_2() { |
GonzoBurns | 0:d4cee525061a | 90 | midi.write( MIDIMessage::NoteOn( HIHAT_CLOSED, NORMAL ) ); |
GonzoBurns | 0:d4cee525061a | 91 | midi.write( MIDIMessage::NoteOn( SNARE , FULL ) ); |
GonzoBurns | 0:d4cee525061a | 92 | } |
GonzoBurns | 0:d4cee525061a | 93 | |
GonzoBurns | 0:d4cee525061a | 94 | void beat_2_E () { |
GonzoBurns | 0:d4cee525061a | 95 | midi.write( MIDIMessage::NoteOn( HIHAT_OPEN , BLUENOTE ) ); |
GonzoBurns | 0:d4cee525061a | 96 | } |
GonzoBurns | 0:d4cee525061a | 97 | |
GonzoBurns | 0:d4cee525061a | 98 | void beat_2_AND () { |
GonzoBurns | 0:d4cee525061a | 99 | midi.write( MIDIMessage::NoteOn( HIHAT_OPEN , BLUENOTE ) ); |
GonzoBurns | 0:d4cee525061a | 100 | midi.write( MIDIMessage::NoteOn( HIHAT_PEDAL , NORMAL ) ); |
GonzoBurns | 0:d4cee525061a | 101 | midi.write( MIDIMessage::NoteOff( HIHAT_OPEN , BLUENOTE ) ); |
GonzoBurns | 0:d4cee525061a | 102 | } |
GonzoBurns | 0:d4cee525061a | 103 | |
GonzoBurns | 0:d4cee525061a | 104 | void beat_2_A () { |
GonzoBurns | 0:d4cee525061a | 105 | midi.write( MIDIMessage::NoteOn( HIHAT_CLOSED, NORMAL ) ); |
GonzoBurns | 0:d4cee525061a | 106 | midi.write( MIDIMessage::NoteOn( SNARE , BLUENOTE ) ); |
GonzoBurns | 0:d4cee525061a | 107 | } |
GonzoBurns | 0:d4cee525061a | 108 | |
GonzoBurns | 0:d4cee525061a | 109 | void beat_3() { |
GonzoBurns | 0:d4cee525061a | 110 | midi.write( MIDIMessage::NoteOn( HIHAT_CLOSED, NORMAL ) ); |
GonzoBurns | 0:d4cee525061a | 111 | } |
GonzoBurns | 0:d4cee525061a | 112 | |
GonzoBurns | 0:d4cee525061a | 113 | void beat_3_E () { |
GonzoBurns | 0:d4cee525061a | 114 | midi.write( MIDIMessage::NoteOn( HIHAT_CLOSED, NORMAL ) ); |
GonzoBurns | 0:d4cee525061a | 115 | midi.write( MIDIMessage::NoteOn( SNARE , BLUENOTE ) ); |
GonzoBurns | 0:d4cee525061a | 116 | } |
GonzoBurns | 0:d4cee525061a | 117 | |
GonzoBurns | 0:d4cee525061a | 118 | void beat_3_AND () { |
GonzoBurns | 0:d4cee525061a | 119 | midi.write( MIDIMessage::NoteOn( HIHAT_CLOSED, NORMAL ) ); |
GonzoBurns | 0:d4cee525061a | 120 | midi.write( MIDIMessage::NoteOn( BASEDRUM , NORMAL ) ); |
GonzoBurns | 0:d4cee525061a | 121 | } |
GonzoBurns | 0:d4cee525061a | 122 | |
GonzoBurns | 0:d4cee525061a | 123 | void beat_3_A () { |
GonzoBurns | 0:d4cee525061a | 124 | midi.write( MIDIMessage::NoteOn( HIHAT_CLOSED, NORMAL ) ); |
GonzoBurns | 0:d4cee525061a | 125 | midi.write( MIDIMessage::NoteOn( SNARE , BLUENOTE ) ); |
GonzoBurns | 0:d4cee525061a | 126 | } |
GonzoBurns | 0:d4cee525061a | 127 | |
GonzoBurns | 0:d4cee525061a | 128 | void beat_4() { |
GonzoBurns | 0:d4cee525061a | 129 | midi.write( MIDIMessage::NoteOn( HIHAT_CLOSED, NORMAL) ); |
GonzoBurns | 0:d4cee525061a | 130 | midi.write( MIDIMessage::NoteOn( SNARE , FULL ) ); |
GonzoBurns | 0:d4cee525061a | 131 | } |
GonzoBurns | 0:d4cee525061a | 132 | |
GonzoBurns | 0:d4cee525061a | 133 | void beat_4_E () { |
GonzoBurns | 0:d4cee525061a | 134 | midi.write( MIDIMessage::NoteOn( HIHAT_OPEN , BLUENOTE ) ); |
GonzoBurns | 0:d4cee525061a | 135 | midi.write( MIDIMessage::NoteOn( BASEDRUM , NORMAL ) ); |
GonzoBurns | 0:d4cee525061a | 136 | } |
GonzoBurns | 0:d4cee525061a | 137 | |
GonzoBurns | 0:d4cee525061a | 138 | void beat_4_AND () { |
GonzoBurns | 0:d4cee525061a | 139 | midi.write( MIDIMessage::NoteOn( HIHAT_OPEN , BLUENOTE ) ); |
GonzoBurns | 0:d4cee525061a | 140 | midi.write( MIDIMessage::NoteOn( HIHAT_PEDAL , NORMAL ) ); |
GonzoBurns | 0:d4cee525061a | 141 | midi.write( MIDIMessage::NoteOff( HIHAT_OPEN , BLUENOTE ) ); } |
GonzoBurns | 0:d4cee525061a | 142 | |
GonzoBurns | 0:d4cee525061a | 143 | void beat_4_A () { |
GonzoBurns | 0:d4cee525061a | 144 | midi.write( MIDIMessage::NoteOn( HIHAT_CLOSED, NORMAL ) ); |
GonzoBurns | 0:d4cee525061a | 145 | midi.write( MIDIMessage::NoteOn( SNARE , BLUENOTE ) ); |
GonzoBurns | 0:d4cee525061a | 146 | } |
GonzoBurns | 0:d4cee525061a | 147 | |
GonzoBurns | 0:d4cee525061a | 148 | |
GonzoBurns | 0:d4cee525061a | 149 | |
GonzoBurns | 0:d4cee525061a | 150 | |
GonzoBurns | 0:d4cee525061a | 151 | |
GonzoBurns | 0:d4cee525061a | 152 | int main() { |
GonzoBurns | 0:d4cee525061a | 153 | while(1) { |
GonzoBurns | 0:d4cee525061a | 154 | |
GonzoBurns | 0:d4cee525061a | 155 | myled = 1; |
GonzoBurns | 0:d4cee525061a | 156 | beat_1(); |
GonzoBurns | 0:d4cee525061a | 157 | wait( TEMPO ); |
GonzoBurns | 0:d4cee525061a | 158 | myled = 0; |
GonzoBurns | 0:d4cee525061a | 159 | beat_1_E(); |
GonzoBurns | 0:d4cee525061a | 160 | wait( TEMPO ); |
GonzoBurns | 0:d4cee525061a | 161 | myled = 1; |
GonzoBurns | 0:d4cee525061a | 162 | beat_1_AND(); |
GonzoBurns | 0:d4cee525061a | 163 | wait( TEMPO ); |
GonzoBurns | 0:d4cee525061a | 164 | myled = 0; |
GonzoBurns | 0:d4cee525061a | 165 | beat_1_A(); |
GonzoBurns | 0:d4cee525061a | 166 | wait( TEMPO ); |
GonzoBurns | 0:d4cee525061a | 167 | |
GonzoBurns | 0:d4cee525061a | 168 | myled = 1; |
GonzoBurns | 0:d4cee525061a | 169 | beat_2(); |
GonzoBurns | 0:d4cee525061a | 170 | wait( TEMPO ); |
GonzoBurns | 0:d4cee525061a | 171 | myled = 0; |
GonzoBurns | 0:d4cee525061a | 172 | beat_2_E(); |
GonzoBurns | 0:d4cee525061a | 173 | wait( TEMPO ); |
GonzoBurns | 0:d4cee525061a | 174 | myled = 1; |
GonzoBurns | 0:d4cee525061a | 175 | beat_2_AND(); |
GonzoBurns | 0:d4cee525061a | 176 | wait( TEMPO ); |
GonzoBurns | 0:d4cee525061a | 177 | myled = 0; |
GonzoBurns | 0:d4cee525061a | 178 | beat_2_A(); |
GonzoBurns | 0:d4cee525061a | 179 | wait( TEMPO ); |
GonzoBurns | 0:d4cee525061a | 180 | |
GonzoBurns | 0:d4cee525061a | 181 | myled = 1; |
GonzoBurns | 0:d4cee525061a | 182 | beat_3(); |
GonzoBurns | 0:d4cee525061a | 183 | wait( TEMPO ); |
GonzoBurns | 0:d4cee525061a | 184 | myled = 0; |
GonzoBurns | 0:d4cee525061a | 185 | beat_3_E(); |
GonzoBurns | 0:d4cee525061a | 186 | wait( TEMPO ); |
GonzoBurns | 0:d4cee525061a | 187 | myled = 1; |
GonzoBurns | 0:d4cee525061a | 188 | beat_3_AND(); |
GonzoBurns | 0:d4cee525061a | 189 | wait( TEMPO ); |
GonzoBurns | 0:d4cee525061a | 190 | myled = 0; |
GonzoBurns | 0:d4cee525061a | 191 | beat_3_A(); |
GonzoBurns | 0:d4cee525061a | 192 | wait( TEMPO ); |
GonzoBurns | 0:d4cee525061a | 193 | |
GonzoBurns | 0:d4cee525061a | 194 | myled = 1; |
GonzoBurns | 0:d4cee525061a | 195 | beat_4(); |
GonzoBurns | 0:d4cee525061a | 196 | wait( TEMPO ); |
GonzoBurns | 0:d4cee525061a | 197 | myled = 0; |
GonzoBurns | 0:d4cee525061a | 198 | beat_4_E(); |
GonzoBurns | 0:d4cee525061a | 199 | wait( TEMPO ); |
GonzoBurns | 0:d4cee525061a | 200 | myled = 1; |
GonzoBurns | 0:d4cee525061a | 201 | beat_4_AND(); |
GonzoBurns | 0:d4cee525061a | 202 | wait( TEMPO ); |
GonzoBurns | 0:d4cee525061a | 203 | myled = 0; |
GonzoBurns | 0:d4cee525061a | 204 | beat_4_A(); |
GonzoBurns | 0:d4cee525061a | 205 | wait( TEMPO ); |
GonzoBurns | 0:d4cee525061a | 206 | } |
GonzoBurns | 0:d4cee525061a | 207 | } |