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

Thread: PDM for simple audio ouput (no i2s DAC)

  1. #1
    Junior Member
    Join Date
    Sep 2019
    Posts
    14

    PDM for simple audio ouput (no i2s DAC)

    Based on an idea from here:

    https://www.hackster.io/janost/audio...esp8266-fa9464

    I've just built a filter you can place in front of an AudioInterfaceI2S object that converts a single AudioStream stream to a PDM modulated stream with half the bits on one and half the bits on the other output channel.

    When used with an i2s DAC this of course produces some fairly horrible noises, but when your DAC is replaced with a simple RC low-pass filter the output is passable audio.

    Could this be useful for low-component-count Teensy 4.0 projects or for any Teensy unable to use a 12bit DAC for audio output?

    It basically makes a pretend mono 16-bit DAC with a single resistor and capacitor directly connected to the i2s output.

  2. #2
    Senior Member+ Theremingenieur's Avatar
    Join Date
    Feb 2014
    Location
    Colmar, France
    Posts
    2,540
    The Teensy 4.0 has already something like that integrated. The internal SAI3 can be combined with a so-called Medium Quality Audio Output which works based on PWM/PDM with internal oversampling and filtering.

  3. #3
    Junior Member
    Join Date
    Sep 2019
    Posts
    14
    Quote Originally Posted by Theremingenieur View Post
    The internal SAI3 can be combined with a so-called Medium Quality Audio Output which works based on PWM/PDM with internal oversampling and filtering.
    Sorry wasn't aware of MQS or the output_mqs class in the audio library (it's not in the audio design tool).
    I keep on finding useful things that I wish I knew about!
    Might still be useful for two-channel output (1 via MQS, 1 via i2s) but you're right, it's redundant.

    Dirk

  4. #4
    Junior Member
    Join Date
    Sep 2019
    Posts
    14
    Can confirm that MQS works nicely, but there still may be a use for the PDM Filter: the MQS pins are the same as the hardware SPI so unless those can be remapped, this could allow the use of SPI at the same time.

  5. #5
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    3,310
    Quote Originally Posted by dirkenstein View Post
    Can confirm that MQS works nicely, but there still may be a use for the PDM Filter: the MQS pins are the same as the hardware SPI so unless those can be remapped, this could allow the use of SPI at the same time.
    Or use the other 2 SPI buses.

    To use SPI1, you need to connect pads for pins #26-27 from underneath the Teensy 4.0 (and use pins 0/1, which means you can't use Serial1). Note, the pinout card unfortunately does not show that pin 1 is MISO1 and pin 0 is CS1.

    To use SPI2, you need to solder the 1mm pads for pins #34-39.

    Over in the 'General Discussion' forum there are discussions about several different breakout boards to access some/all of the underneath pads.

    At some point in the future, pins 14/15 might be used for S/PDIF in/out. However, the Teensy 4.0 software is not written for that yet.

Posting Permissions

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