Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 9 of 9

Thread: Simplest Audio Out to speaker on Teensy 4

Hybrid View

  1. #1
    Junior Member
    Join Date
    Feb 2016
    Posts
    2

    Simplest Audio Out to speaker on Teensy 4

    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.

  2. #2
    Quote Originally Posted by Robin_B View Post
    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.

  3. #3
    Junior Member
    Join Date
    Aug 2019
    Posts
    1
    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?

  4. #4

  5. #5
    Junior Member
    Join Date
    Aug 2019
    Posts
    9
    pin7 works with the example sketches. sounds horrible, but works.

  6. #6
    Junior Member
    Join Date
    Feb 2016
    Posts
    2
    Quote Originally Posted by reaganr View Post
    pin7 works with the example sketches. sounds horrible, but works.
    As single-pin PWM, you mean?

  7. #7
    Junior Member
    Join Date
    Aug 2019
    Posts
    1
    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/

  8. #8
    Senior Member
    Join Date
    Apr 2014
    Posts
    318
    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.

  9. #9
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    3,166
    I posted a thread with similar questions, and I did tests using both a mono I2S amplifier/speaker and using MQS output:

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •