Need help for getting started with first audio project

Windorey

Active member
Hello, I got my Teensy 4.1 board and experimented a little running display and nice UIs from it, but I have decided to try out some audio.
I have an Adafruit DAC, type UDA1334A. My goal is to use this DAC with my computer, using the Teensy as a USB audio device.
The Teensy does get recognized by the computer, but I have no sound output. Here is my code:
Code:
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>

// GUItool: begin automatically generated code
AudioInputUSB            usb1;           //xy=560,391
AudioOutputI2S           i2s1;           //xy=772,392
AudioConnection          patchCord1(usb1, 0, i2s1, 0);
AudioConnection          patchCord2(usb1, 1, i2s1, 1);
// GUItool: end automatically generated code

void setup() {
  AudioMemory(12);
}

My wiring:
https://imgur.com/a/stqtxNP (Sorry for the link, the photos didn't want to upload)
 
There are some limitations on file size and type - screen clip of the linked image as PNG works here
AudioImage.jpg

There are helpful notes on each item in the right pane like: File > Examples > Audio > HardwareTesting > PassThroughUSB
This example relies on "AudioControlSGTL5000 sgtl5000_1; " that will cause updates that may be missing as indicated below.

This note on USB may apply, though maybe i2s1 should qualify?
Code:
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.

Though the right pane indicated list doesn't seem to include the AdaF 1334 DAC in use:
Code:
Compatible DAC Chips:

PCM5102A
PCM1808
PCM5242
CS4344
 
Hello, I got it working. I used an example to create a sine wave and it works just fine, I can hear the sine wave on the output clearly and adjust its frequency with the potentiometer I have connected, the issue here is the USB.
 
the issue here is the USB.
If you want your setup to be recognized as a USB audio device for your computer, you need to set the USB type to "Audio":

Untitled.png

Then this code will do the trick:
Code:
// set Tools > USB Type: to "Audio"

#include <Audio.h>

AudioInputUSB            usb1;   
AudioOutputI2S           i2s1;      
AudioConnection          patchCord1(usb1, 0, i2s1, 0);
AudioConnection          patchCord2(usb1, 1, i2s1, 1);

void setup(){
  AudioMemory(12);
}

void loop(){
}

Paul
 
Did you tell Windows or Mac to use the Teensy audio device instead of the default audio device?

Paul
 
That is strange. Hooked up a UDA1334A board to a Teensy 4.1:

T41plusUDA1334A.jpg

and uploaded this code:
Code:
// UDA1334A bd  Teensy 4.x
// VIN          3V3           
// GND          GND          
// WSEL         20                  
// DIN          7 
// BCLK         21             
// set Tools > USB Type: to "Audio"

#include <Audio.h>

AudioInputUSB            usb1;   
AudioOutputI2S           i2s1;      
AudioConnection          patchCord1(usb1, 0, i2s1, 0);
AudioConnection          patchCord2(usb1, 1, i2s1, 1);

void setup(){
  AudioMemory(12);
}

void loop(){
}

Set my PC to use the Teensy audio device:

Untitled.png

Sound is playing on my speakers as I'm writing this message...

Could you show me your setup? Please doublecheck the wiring.

Paul
 
It turns out it's from the wiring.
The connections weren't making a good contact, I switched to a new breadboard, new wires and it started working correctly without holding it.
Also, if you know, for me there is a popping sound every-so-often while using this. Is there any way to eliminate that popping?
 
Good to hear it's working now!
About the popping sound - this not something I heard before and should not be there. Could it be the amplifier your using?
You could try to power the UDA1334A board from the 3V3 Teensy pin like I did. Although I doubt whether that will avoid the every-so-often popping sound.

Paul
 
Back
Top