I understand this is a common issue with people first using their teensy. I'm not experiencing the same circumstance. Let me explain. I've been using my Teensy 3.2 for several months to make music. I am using the Audio library. I had been having no issues with loading my sketches onto the Teensy. The computer I am using to upload the sketches is a 2013 MacBook.
A few days ago I read somewhere on the Audio tutorial I think, that one can use the Teensy as a MIDI (instrument/device?) by going to the Arduino Tool bar, selecting Tools, going down to USB type and clicking Audio. I then uploaded the sketch to the Teensy. I used Sound Preferences on my Mac to turn the Teensy (called Teensy Audio on my Mac) as an input device. I did the same on Garageband--->Preferences---> Audio/MIDI---->Input Device--->Teensy Audio. From here I was able to play the Teensy as an input on garageband as a MIDI instrument without any problems.
The issue comes now. I played around with the Teensy on garageband, was able to record some tunes. Then I decided to add an extra sine wave to my sketch. So I did the usual, using the Audio tool to create the Audio sketch header and uploaded the sketch to Teensy. This time, however, Teensy does not show up under the ports. I usually see /dev/tty.usbmodem1411 and Bluetooth-Incoming-Port. Now I only see the bluetooth-Incoming-Port, whether the Teensy is plugged into the USB or not.
Now the technical stuff: I have been using the same USB port, the one on the left side of my mac to power and upload sketches to Teensy. I tried the other port on the right side of the mac. Still the usb port does not show. I have changed cables to no avail. I have plugged in different devices with either USB cables and all work fine and upload fine. I have updated Arduino from 1.6.8 to 1.6.10 to no avail. I have updated Teensyduino from 1.26 to 1.29 to no avail. I have tried this exact set up on someone else's mac and still the Teensy does not show on their mac either or allow sketches to upload.
I have updated my mac from OS Capitan to OS Sierra and still no luck. I tried using the Teensy troubleshooting guide on the PJRC website (turning the MAc off, restarting, unplugging the teensy, pressing the button to manually upload the program) none of which worked. Interestingly enough, the Mac still registers the teensy is plugged in when I plug it in. In particular when I connect the Teensy to my mac, Garageband indicates that the "Teensy Audio Device is connected" and when unplugged "Teensy Audio device is disconnected". Moreover I can still play the teensy on garageband so I know the Teensy works fine with respect to the sketch that has been uploaded.
I was pointed in a direction to look in the Mac's library, since there is a way to remove Audio devices from the Mac (extensions library folder) but could not find anything related to Teensy (or Arduino) there. I also read on this forum that the Teensy does not make its own drivers for USB but rather, modifies Arduino's existing drivers. I didn't have to install a driver when I first ran the Arduino software, so I would not know where to look for the Arduino driver.
Please let me know if you have any suggestions. From what I know so far, it seems as if I have made the Teensy unable to be located by uploading that one sketch with the USB Type as "Audio" rather than "Serial". Thank you!
Here is code:
A few days ago I read somewhere on the Audio tutorial I think, that one can use the Teensy as a MIDI (instrument/device?) by going to the Arduino Tool bar, selecting Tools, going down to USB type and clicking Audio. I then uploaded the sketch to the Teensy. I used Sound Preferences on my Mac to turn the Teensy (called Teensy Audio on my Mac) as an input device. I did the same on Garageband--->Preferences---> Audio/MIDI---->Input Device--->Teensy Audio. From here I was able to play the Teensy as an input on garageband as a MIDI instrument without any problems.
The issue comes now. I played around with the Teensy on garageband, was able to record some tunes. Then I decided to add an extra sine wave to my sketch. So I did the usual, using the Audio tool to create the Audio sketch header and uploaded the sketch to Teensy. This time, however, Teensy does not show up under the ports. I usually see /dev/tty.usbmodem1411 and Bluetooth-Incoming-Port. Now I only see the bluetooth-Incoming-Port, whether the Teensy is plugged into the USB or not.
Now the technical stuff: I have been using the same USB port, the one on the left side of my mac to power and upload sketches to Teensy. I tried the other port on the right side of the mac. Still the usb port does not show. I have changed cables to no avail. I have plugged in different devices with either USB cables and all work fine and upload fine. I have updated Arduino from 1.6.8 to 1.6.10 to no avail. I have updated Teensyduino from 1.26 to 1.29 to no avail. I have tried this exact set up on someone else's mac and still the Teensy does not show on their mac either or allow sketches to upload.
I have updated my mac from OS Capitan to OS Sierra and still no luck. I tried using the Teensy troubleshooting guide on the PJRC website (turning the MAc off, restarting, unplugging the teensy, pressing the button to manually upload the program) none of which worked. Interestingly enough, the Mac still registers the teensy is plugged in when I plug it in. In particular when I connect the Teensy to my mac, Garageband indicates that the "Teensy Audio Device is connected" and when unplugged "Teensy Audio device is disconnected". Moreover I can still play the teensy on garageband so I know the Teensy works fine with respect to the sketch that has been uploaded.
I was pointed in a direction to look in the Mac's library, since there is a way to remove Audio devices from the Mac (extensions library folder) but could not find anything related to Teensy (or Arduino) there. I also read on this forum that the Teensy does not make its own drivers for USB but rather, modifies Arduino's existing drivers. I didn't have to install a driver when I first ran the Arduino software, so I would not know where to look for the Arduino driver.
Please let me know if you have any suggestions. From what I know so far, it seems as if I have made the Teensy unable to be located by uploading that one sketch with the USB Type as "Audio" rather than "Serial". Thank you!
Here is code:
Code:
// Advanced Microcontroller-based Audio Workshop
//
// [url]https://github.com/PaulStoffregen/AudioWorkshop2015/raw/master/workshop.pdf[/url]
// [url]https://hackaday.io/project/8292-microcontroller-audio-workshop-had-supercon-2015[/url]
//
// Part 2-8: Oscillators
#include <Bounce.h>
Bounce button0 = Bounce(0, 15);
Bounce button1 = Bounce(1, 15); // 15 = 15 ms debounce time
Bounce button2 = Bounce(2, 15);
Bounce button3 = Bounce(3, 15);
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>
// GUItool: begin automatically generated code
AudioSynthWaveform waveform1; //xy=64,30
AudioSynthWaveform waveform2; //xy=64,246
AudioInputI2S i2s2; //xy=79,462
AudioSynthNoiseWhite noise1; //xy=85,383
AudioSynthWaveformSine sine1; //xy=87,122
AudioSynthNoisePink pink1; //xy=90,168
AudioSynthKarplusStrong string1; //xy=123,332
AudioFilterStateVariable filter1; //xy=167,289
AudioFilterStateVariable filter2; //xy=198,65
AudioEffectDelay delay1; //xy=291,502
AudioSynthWaveformSineModulated sine_fm2; //xy=296,312
AudioSynthWaveformSineModulated sine_fm1; //xy=346,71
AudioMixer4 mixer2; //xy=433,328
AudioMixer4 mixer5; //xy=467,533
AudioMixer4 mixer4; //xy=472,439
AudioMixer4 mixer1; //xy=500,84
AudioEffectEnvelope envelope1; //xy=559,345
AudioMixer4 mixer6; //xy=644,480
AudioMixer4 mixer3; //xy=700,270
AudioOutputUSB usb1; //xy=844,277
AudioConnection patchCord1(waveform1, 0, filter2, 0);
AudioConnection patchCord2(waveform1, 0, filter2, 1);
AudioConnection patchCord3(waveform1, 0, mixer1, 0);
AudioConnection patchCord4(waveform2, 0, filter1, 0);
AudioConnection patchCord5(waveform2, 0, filter1, 1);
AudioConnection patchCord6(waveform2, 0, mixer2, 0);
AudioConnection patchCord7(i2s2, 1, delay1, 0);
AudioConnection patchCord8(noise1, 0, mixer2, 3);
AudioConnection patchCord9(sine1, 0, mixer1, 2);
AudioConnection patchCord10(pink1, 0, mixer1, 3);
AudioConnection patchCord11(string1, 0, mixer2, 2);
AudioConnection patchCord12(filter1, 0, sine_fm2, 0);
AudioConnection patchCord13(filter2, 0, sine_fm1, 0);
AudioConnection patchCord14(delay1, 0, mixer4, 0);
AudioConnection patchCord15(delay1, 1, mixer4, 1);
AudioConnection patchCord16(delay1, 2, mixer4, 2);
AudioConnection patchCord17(delay1, 3, mixer4, 3);
AudioConnection patchCord18(delay1, 4, mixer5, 0);
AudioConnection patchCord19(delay1, 5, mixer5, 1);
AudioConnection patchCord20(delay1, 6, mixer5, 2);
AudioConnection patchCord21(delay1, 7, mixer5, 3);
AudioConnection patchCord22(sine_fm2, 0, mixer2, 1);
AudioConnection patchCord23(sine_fm1, 0, mixer1, 1);
AudioConnection patchCord24(mixer2, 0, mixer3, 1);
AudioConnection patchCord25(mixer2, envelope1);
AudioConnection patchCord26(mixer5, 0, mixer6, 1);
AudioConnection patchCord27(mixer4, 0, mixer6, 0);
AudioConnection patchCord28(mixer1, 0, mixer3, 0);
AudioConnection patchCord29(envelope1, 0, mixer3, 2);
AudioConnection patchCord30(mixer6, 0, mixer3, 3);
AudioConnection patchCord31(mixer3, 0, usb1, 0);
AudioConnection patchCord32(mixer3, 0, usb1, 1);
AudioControlSGTL5000 sgtl5000_1; //xy=630,620
// GUItool: end automatically generated code
void setup() {
Serial.begin(9600);
AudioMemory(160);
sgtl5000_1.enable();
sgtl5000_1.volume(0.5);
sgtl5000_1.inputSelect(AUDIO_INPUT_MIC);
sgtl5000_1.micGain(36);
pinMode(0, INPUT_PULLUP);
pinMode(1, INPUT_PULLUP);
pinMode(2, INPUT_PULLUP);
pinMode(3, INPUT_PULLUP);
//mixer 1
mixer1.gain(0, 0.50);
mixer1.gain(1, 0.0);
mixer1.gain(2, 0.0);
mixer1.gain(3, 0.0);
waveform1.begin(WAVEFORM_SAWTOOTH);
waveform1.amplitude(0.75);
waveform1.frequency(50);
waveform1.pulseWidth(0.50);
sine_fm1.frequency(440);
sine_fm1.amplitude(0.75);
sine1.frequency(200);
sine1.amplitude(0.75);
pink1.amplitude(0.75);
//Mixer 2
mixer2.gain(0, 0.50);
mixer2.gain(1, 0.0);
mixer2.gain(2, 0.0);
mixer2.gain(3, 0.0);
waveform2.begin(WAVEFORM_SAWTOOTH);
waveform2.amplitude(0.75);
waveform2.frequency(50);
waveform2.pulseWidth(0.50);
sine_fm2.frequency(440);
sine_fm2.amplitude(0.75);
noise1.amplitude(0.75);
//mixer 3
mixer3.gain(0, 0.33);
mixer3.gain(1, 0.33);
mixer3.gain(2, 0.0);
mixer3.gain(3, 0.33);
//mixer 4 & 5
mixer4.gain(0, 0.2);
mixer4.gain(1, 0.2);
mixer4.gain(2, 0.2);
mixer4.gain(3, 0.2);
mixer5.gain(0, 0.2);
mixer5.gain(1, 0.2);
mixer5.gain(2, 0.2);
mixer5.gain(3, 0.2);
//mixer 6
mixer6.gain(0, 0.5);
mixer6.gain(1, 0.5);
//delay channels
delay1.delay(0, 400);
delay1.delay(1, 400);
delay1.delay(2, 400);
delay1.delay(3, 400);
delay1.delay(4, 400);
delay1.delay(5, 400);
delay1.delay(6, 400);
delay1.delay(7, 400);
delay(1000);
}
int waveform_type = WAVEFORM_SAWTOOTH;
int mixer1_setting = 0;
int mixer2_setting = 0;
elapsedMillis timeout = 0;
void loop() {
/* int volKnob = analogRead(A0); // knob = 0 to 1023
float vol = (float)volKnob / 1023.0;
sgtl5000_1.volume(vol);*/
// use the knobs to adjust parameters
float knob2 = (float)analogRead(A2) / 1023.0; //freq waveform1
float knob3 = (float)analogRead(A3) / 1023.0; //freq waveform2
//float knob4 = (float)analogRead(A4) / 1023.0; //amp
waveform1.frequency(360 * knob2 + 0.25);
sine_fm1.frequency(knob2 * 1500 + 50);
sine1.frequency(knob2 * 1500 + 50);
waveform2.frequency(360 * knob3 + 0.25);
sine_fm2.frequency(knob3 * 1500 + 50);
/*// adjust amplitude with knob 4 of both waves
waveform1.amplitude(knob4);
sine_fm1.amplitude(knob4);
sine1.amplitude(knob4);
waveform2.amplitude(knob4);*/
button0.update();
button1.update();
button2.update();
button3.update();
// Left changes the type of control waveform
if (button0.fallingEdge()) {
Serial.print("Control waveform: ");
if (waveform_type == WAVEFORM_SAWTOOTH) {
waveform_type = WAVEFORM_SINE;
Serial.println("Sine");
} else if (waveform_type == WAVEFORM_SINE) {
waveform_type = WAVEFORM_SQUARE;
Serial.println("Square");
} else if (waveform_type == WAVEFORM_SQUARE) {
waveform_type = WAVEFORM_TRIANGLE;
Serial.println("Triangle");
} else if (waveform_type == WAVEFORM_TRIANGLE) {
waveform_type = WAVEFORM_PULSE;
Serial.println("Pulse");
} else if (waveform_type == WAVEFORM_PULSE) {
waveform_type = WAVEFORM_SAWTOOTH;
Serial.println("Sawtooth");
}
waveform1.begin(waveform_type);
}
// left center button switch which source we hear from mixer1
if (button1.fallingEdge()) {
if (mixer1_setting == 0) {
mixer1.gain(0, 0.50);
mixer1.gain(1, 0.0);
mixer1.gain(2, 0.0);
mixer1.gain(3, 0.0);
mixer3.gain(0, 1.0);
mixer3.gain(1, 1.0);
mixer3.gain(2, 0.0);
mixer3.gain(3, 1.0);
Serial.println("Mixer1: Filtered Control oscillator (Low Pass)");
mixer1_setting = 1;
} else if (mixer1_setting == 1) {
mixer1.gain(0, 0.0);
mixer1.gain(1, 0.50);
mixer1.gain(2, 0.0);
mixer1.gain(3, 0.0);
mixer3.gain(0, 1.0);
mixer3.gain(1, 1.0);
mixer3.gain(2, 0.0);
mixer3.gain(3, 1.0);
Serial.println("Mixer1: Filtered Frequency Modulated Oscillator (Band Pass)");
mixer1_setting = 2;
} else if (mixer1_setting == 2) {
mixer1.gain(0, 0.0);
mixer1.gain(1, 0.0);
mixer1.gain(2, 0.50);
mixer1.gain(3, 0.0);
mixer3.gain(0, 1.0);
mixer3.gain(1, 1.0);
mixer3.gain(2, 0.0);
mixer3.gain(3, 1.0);
Serial.println("Mixer1: Regular Sine Wave Oscillator");
mixer1_setting = 3;
} else if (mixer1_setting == 3) {
mixer1.gain(0, 0.0);
mixer1.gain(1, 0.0);
mixer1.gain(2, 0.0);
mixer1.gain(3, 0.50);
mixer3.gain(0, 1.0);
mixer3.gain(1, 1.0);
mixer3.gain(2, 0.0);
mixer3.gain(3, 1.0);
Serial.println("Mixer1: Pink Noise");
mixer1_setting = 0;
}
else if (mixer1_setting == 4) {
mixer2.gain(0, 0.0);
mixer2.gain(1, 0.0);
mixer2.gain(2, 0.0);
mixer2.gain(3, 0.0);
mixer3.gain(0, 0.0);
mixer3.gain(1, 0.0);
mixer3.gain(2, 0.0);
mixer3.gain(3, 1.0);
Serial.println("Mixer3: Mic Delay Only");
mixer1_setting = 0;
}
}
// Right-center button changes the type of control waveform
if (button2.fallingEdge()) {
Serial.print("Control waveform: ");
if (waveform_type == WAVEFORM_SAWTOOTH) {
waveform_type = WAVEFORM_SINE;
Serial.println("Sine");
} else if (waveform_type == WAVEFORM_SINE) {
waveform_type = WAVEFORM_SQUARE;
Serial.println("Square");
} else if (waveform_type == WAVEFORM_SQUARE) {
waveform_type = WAVEFORM_TRIANGLE;
Serial.println("Triangle");
} else if (waveform_type == WAVEFORM_TRIANGLE) {
waveform_type = WAVEFORM_PULSE;
Serial.println("Pulse");
} else if (waveform_type == WAVEFORM_PULSE) {
waveform_type = WAVEFORM_SAWTOOTH;
Serial.println("Sawtooth");
}
waveform2.begin(waveform_type);
}
// middle button switch which source we hear from mixer1
if (button3.fallingEdge()) {
if (mixer2_setting == 0) {
mixer2.gain(0, 0.50);
mixer2.gain(1, 0.0);
mixer2.gain(2, 0.0);
mixer2.gain(3, 0.0);
mixer3.gain(0, 1.0);
mixer3.gain(1, 1.0);
mixer3.gain(2, 0.0);
mixer3.gain(3, 1.0);
Serial.println("mixer2: Filtered Control oscillator (low Pass)");
mixer2_setting = 1;
} else if (mixer2_setting == 1) {
mixer2.gain(0, 0.0);
mixer2.gain(1, 0.50);
mixer2.gain(2, 0.0);
mixer2.gain(3, 0.0);
mixer3.gain(0, 1.0);
mixer3.gain(1, 1.0);
mixer3.gain(2, 0.0);
mixer3.gain(3, 1.0);
Serial.println("mixer2: Filtered Frequency Modulated Oscillator (High Pass)");
mixer2_setting = 2;
} else if (mixer2_setting == 2) {
mixer2.gain(0, 0.0);
mixer2.gain(1, 0.0);
mixer2.gain(2, 0.5);
mixer2.gain(3, 0.0);
//float lowFq = 360 * knob3 + 0.25;
//float highFq = knob2 * 1500 + 50;
//tonesweep1.play(.7, lowFq, highFq, 100000);
mixer3.gain(0, 0.0);
mixer3.gain(1, 1.0);
mixer3.gain(2, 0.0);
mixer3.gain(3, 1.0);
float guiFr = 360 * knob3 + 0.25;
string1.noteOn(guiFr, 0.6);
delay(3000);
string1.noteOff(0.4);
Serial.println("mixer2: Sine with Mic Delay");
mixer2_setting = 3;
} else if (mixer2_setting == 3) {
mixer2.gain(0, 0.0);
mixer2.gain(1, 0.0);
mixer2.gain(2, 0.0);
mixer2.gain(3, 0.50);
mixer3.gain(0, 1.0);
mixer3.gain(1, 1.0);
mixer3.gain(2, 0.0);
mixer3.gain(3, 1.0);
Serial.println("mixer2: White Noise with Mic Delay");
mixer2_setting = 4;
} else if (mixer2_setting == 4) {
mixer2.gain(0, 0.0);
mixer2.gain(1, 0.0);
mixer2.gain(2, 0.0);
mixer2.gain(3, 0.0);
mixer3.gain(0, 1.0);
mixer3.gain(1, 0.0);
mixer3.gain(2, 0.0);
mixer3.gain(3, 1.0);
Serial.println("Mixer3: Mic Delay Only");
mixer2_setting = 0;
}
}
}
Last edited: