// CCRMA Mobile Synths II Summer Workshop 2017 // Simple Teensy program to control the duet.dsp SmartKeyb app #include int ccFreqSaw = 10; // MIDI CC for the pitch of the sawtooth int ccFreqTri = 11; // MIDI CC for the pitch of the triangle int ccSwitch = 12; // MIDI CC to switch between the saw and the tri int midiChannel = 0; int sawNotes[] = {64,65,67}; // MIDI notes for the saw int triNotes[] = {80,78,77}; // MIDI notes for the tri void setup() { } void loop() { // Switching between tri, saw, or both int instrSwitch = random(3); usbMIDI.sendControlChange(ccSwitch,instrSwitch,midiChannel); for(int i=0; i<3; i++){ // Reading and sending notes if(instrSwitch == 0 || instrSwitch == 2){ usbMIDI.sendControlChange(ccFreqSaw,sawNotes[i],midiChannel); } if(instrSwitch == 1 || instrSwitch == 2){ usbMIDI.sendControlChange(ccFreqTri,triNotes[i],midiChannel); } delay(500); } }