I am having a most perplexing problem with USB MIDI that I'm attempting to solve over video chat for my marketing partner who is a few thousand miles away from me.
The problem:
The serial is printing when the device receives a midi note, but there is no audio, which is odd because I used that prototype for a month without this issue cropping up.
Products in use: Teensy 3.6, PT8211
Wiring details: the DAC is wired the same as Paul's PT8211 Kit.
Software setup: Arduino IDE on OSX Mojave with Italian character mapping
Repro steps: unfortunately, I can't reproduce
what I've discerned so far to be working:
- This sketch plays a sine as expected Examples/Audio/HardwareTesting/PT8211Sine, so hardware is presumably okay
- He downloaded the current Arduino and Teensyduino .dmgs, so the IDE is up to date
- his configuration matches mine exactly in Arduino's "Tools" menu
- he can upload sketches successfully
- his audio and USB cables seem to be fine and we've tried others
I gave him a stripped down sketch(works for me) to play notes in response to USB MIDI and this is where he hit problems.
It's almost as if
isn't doing anything.
To make matters trickier, he doesn't have access to the Teensy's programming button, so he can't do a hard reset.
I've tried everything that came to mind to no avail and now I'm reaching out in case this issue is familiar to anyone. Any thoughts or ideas would be greatly appreciated.
Here's a picture of the device for reference:
The problem:
The serial is printing when the device receives a midi note, but there is no audio, which is odd because I used that prototype for a month without this issue cropping up.
Products in use: Teensy 3.6, PT8211
Wiring details: the DAC is wired the same as Paul's PT8211 Kit.
Software setup: Arduino IDE on OSX Mojave with Italian character mapping
Repro steps: unfortunately, I can't reproduce
what I've discerned so far to be working:
- This sketch plays a sine as expected Examples/Audio/HardwareTesting/PT8211Sine, so hardware is presumably okay
- He downloaded the current Arduino and Teensyduino .dmgs, so the IDE is up to date
- his configuration matches mine exactly in Arduino's "Tools" menu
- he can upload sketches successfully
- his audio and USB cables seem to be fine and we've tried others
I gave him a stripped down sketch(works for me) to play notes in response to USB MIDI and this is where he hit problems.
Code:
#include <Audio.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>
// GUItool: begin automatically generated code
AudioSynthWaveform waveform1; //xy=398,195
AudioEffectEnvelope envelope1; //xy=568,200
AudioMixer4 mixer1; //xy=709,125
AudioOutputPT8211 pt8211; //xy=844,309
AudioConnection patchCord1(waveform1, envelope1);
AudioConnection patchCord2(envelope1, 0, mixer1, 0);
AudioConnection patchCord3(mixer1, 0, pt8211, 0);
AudioConnection patchCord4(mixer1, 0, pt8211, 1);
// GUItool: end automatically generated code
void setup() {
Serial.begin(115200);
usbMIDI.setHandleNoteOn(myNoteOn);
usbMIDI.setHandleNoteOff(myNoteOff);
AudioMemory(20);
waveform1.begin(WAVEFORM_SINE);
waveform1.amplitude(1);
}
void loop() {
usbMIDI.read();
}
void myNoteOn(byte channel, byte note, byte velocity) {
float freq = 440.0 * powf(2.0, (float)(note - 69) * 0.08333333);
waveform1.frequency(freq);
envelope1.noteOn();
Serial.print("note on:");
Serial.print("frequency = ");
Serial.println(freq);
}
void myNoteOff(byte channel, byte note, byte velocity) {
envelope1.noteOff();
}
It's almost as if
Code:
envelope1.noteOn();
To make matters trickier, he doesn't have access to the Teensy's programming button, so he can't do a hard reset.
I've tried everything that came to mind to no avail and now I'm reaching out in case this issue is familiar to anyone. Any thoughts or ideas would be greatly appreciated.
Here's a picture of the device for reference: