Teensy 4.1 usb audio out. How?

Status
Not open for further replies.

flocked

Active member
I try to get my Teensy 4.1 to output audio to usb.

The following code doesn't work. Teensy appears as usb audio device on MacOS, but I can't hear any white noise when I select it's input.

Code:
#include <Audio.h>
#include <Wire.h>
//#include <SPI.h>
//#include <SD.h>
//#include <SerialFlash.h>

AudioSynthNoiseWhite     noise1;         //xy=164,557AudioOutputUSB
AudioOutputUSB           usb1;           //xy=370,519 
AudioConnection          patchCord1(noise1, 0, usb1, 0);
AudioConnection          patchCord2(noise1, 0, usb1, 1);

// GUItool: end automatically generated code
 
//used to blink the led to show that something is happening
int led=13;

void setup() {
  AudioMemory(80);


delay(500);
  pinMode(led, OUTPUT);     
}

void loop() {

}
 
You need to include at least one audio object that generates a clock, for instance AudioInputI2S or AudioOutputI2S.
Without a clocked object nothing ever happens.
 
Also, as I found out last night, you need to set the noise generator going by setting its amplitude to a non-zero value...
 
Status
Not open for further replies.
Back
Top