Simplest Audio Out to speaker on Teensy 4

Status
Not open for further replies.

Robin_B

Member
I've been using the Teensy 3.2 in my experimental arcade game Line Wobbler (mostly just using the wave generator in various ways) and simply using a capacitor and the DAC pin to a small amplifier board, as recommended here.

I've been looking how to do this on a Teensy 4, and since there's no DAC on it, I've been looking for alternatives. So far, the simplest seems to be using two PWM pins, but that's seems to be more parts and less resolution. Are there other work-arounds? I'm also happy to spend 1-2 USD on a little board. Perhaps an I2S amplifier board? FWIW, I'm driving a 3W (mono) speaker.
 
I've been using the Teensy 3.2 in my experimental arcade game Line Wobbler (mostly just using the wave generator in various ways) and simply using a capacitor and the DAC pin to a small amplifier board, as recommended here.

I've been looking how to do this on a Teensy 4, and since there's no DAC on it, I've been looking for alternatives. So far, the simplest seems to be using two PWM pins, but that's seems to be more parts and less resolution. Are there other work-arounds? I'm also happy to spend 1-2 USD on a little board. Perhaps an I2S amplifier board? FWIW, I'm driving a 3W (mono) speaker.

I really wouldn't bother with the MQSL/R pins. A new definition of 'Medium Quality Audio' from NXP I'm afraid. Cheapest solution is probably to buy one of those $1 USB audio dongles and then rip off the USB - there's several article and Youtubes on doing this. Or you may even be able to make the Teensy talk to it through a USB hub but not sure of that.
 
For a video game, a single PWM output might give you a quality and flavor of sound that's desirable. If it doesn't sound great at first, try editing your audio in something like audacity to remove low and high frequencies, that would otherwise cause rumble, distortion, or aliasing. Then see if that works for you?
 
I created a simple drum synth on a Teensy 4.0 today. It has DIN MIDI in via a simple MIDI breakout board, and it uses simpledrum for a few sounds, and it plays wav files that I converted via wav2sketch. It uses the MQS (Medium Quality Sound) pins for output, though I only used one pin for one channel (pin 12 - MQSL). It works fine. The audio quality isn't super great, but it gets the job done for me until the new 4.0-compatible audio board comes out. You can download my code from here:
https://github.com/nshaver/teensy_4_drum_machine_test/
 
Robin_B you say in your 1st post......"Perhaps an I2S amplifier board? FWIW, I'm driving a 3W (mono) speaker."
Then why not use the....."Adafruit I2S 3W Class D Amplifier Breakout using MAX98357A"
Connect board input to Teensy I2S and connect your 3W speaker to board output.....and it works.
 
Status
Not open for further replies.
Back
Top