-
Notifications
You must be signed in to change notification settings - Fork 0
/
teensy-vult-example.ino
44 lines (33 loc) · 990 Bytes
/
teensy-vult-example.ino
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
#include <Wire.h>
#include <SPI.h>
#include <Audio.h>
#include "SynthTest.h"
AudioOutputI2S i2s1; //xy=565,241
AudioControlSGTL5000 audioShield; //xy=586,175
SynthTest voice;
AudioConnection patchCord1(voice, 0, i2s1, 0);
AudioConnection patchCord2(voice, 0, i2s1, 1);
// Handles the ontrol change
void OnControlChange(byte channel, byte control, byte value){
voice.controlChange(control,value,channel);
}
// Handles note on events
void OnNoteOn(byte channel, byte note, byte velocity){
voice.noteOn(note,velocity,channel);
}
// Handles note on events
void OnNoteOff(byte channel, byte note, byte velocity){
voice.noteOff(note,velocity,channel);
}
void setup() {
AudioMemory(8);
audioShield.enable();
audioShield.volume(0.7);
voice.begin();
usbMIDI.setHandleControlChange(OnControlChange);
usbMIDI.setHandleNoteOn(OnNoteOn);
usbMIDI.setHandleNoteOff(OnNoteOff);
}
void loop() {
usbMIDI.read();
}