Teensy USB audio not working

Status
Not open for further replies.

CWashburn

Active member
Hello everyone,

I'm having trouble getting my Teensy 3.2 to play any audio at all, either through the DAC or USB (I don't have the audio shield, so I can't test that). Here's a super simple proof-of concept sketch that's supposed to synthesize a sine wave and white noise and send it to my PC via USB. The sketch uploads fine and the teensy shows up as an audio input, so it's not a connection problem. I'm using Windows 10, Arduino 1.8.3, and Teensy Loader 1.40.


Code:
#include <Audio.h>

// GUItool: begin automatically generated code
AudioSynthWaveformSine   sine1;          //xy=265.0000305175781,430.0000629425049
AudioSynthNoiseWhite     noise1;         //xy=265.00000762939453,480.00001525878906
AudioOutputUSB           usb1;           //xy=454.0000114440918,462.00001430511475
AudioConnection          patchCord1(sine1, 0, usb1, 0);
AudioConnection          patchCord2(noise1, 0, usb1, 1);
// GUItool: end automatically generated code



void setup() {
  sine1.frequency(400);
  sine1.amplitude(0.5);
  noise1.amplitude(0.5);

}

void loop() {

}


I did a google search, but didn't find anything. It seems like I'm missing something, but I can't figure out what it is.
 
I've had mixed results on various OS's in trying to get audio out from USB in. Audacity usually works for me. Can you run audacity on your PC and see if it is seeing the USB audio? if you have an SD hooked to T3.2 you could try the Audio example WavFilePlayerUSB

EDIT: You definitely need AudioMemory(12), and to your declarations add
AudioOutputI2S out1;
 
Last edited:
Thanks for the help guys. It shows up as an audio device in Audacity, but doesn't show any input. Does the audio source on the teensy (like synth vs. wav player) matter?

Edit: Oops, I didn't see your edit.
 
Last edited:
I think he was wondering about why you need to declare this: AudioOutputI2S out1

I've been confused by this as well. I'm not sure he does need that declaration.
 
it reads "USB input & output does not cause the Teensy Audio Library to update. At least one non-USB input or output object must be present for the entire library to update properly."

AudioOutputI2S is one example of a non-USB output object
 
Last edited:
Ahhh, I was thinking he already had an input, but I guess it was just outputting a sine wave so it wasn't. Thanks.
 
Status
Not open for further replies.
Back
Top