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

Thread: What is the current state of Audio Library support for the Teensy 4.0?

  1. #1
    Junior Member
    Join Date
    Dec 2019
    Posts
    15

    What is the current state of Audio Library support for the Teensy 4.0?

    Howdy everyone,

    I've been doing a bit of digging on the forums and am a bit confused by the extent of the Audio Library I can utilize with my Teensy 4.0 with the Audio Shield.

    Is there any up to date documentation about which parts of the library I can use with my current hardware and which aren't supported yet?

  2. #2
    dito......

  3. #3
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    6,107
    Note: I don't do very much Audio stuff. Mostly simple sounds from time to time...

    But I believe that most of the Audio library is working fine on T4... However the IO pin hookups are different, which is why PJRC now sells a different audio Adapter for the T4.

    More details on the adapters are up at: https://www.pjrc.com/store/teensy3_audio.htm You can hook up a T3.x version Audio adapter to T4, but you need to change the wiring. That is you can not simply plug a T4 into the T3.x version.

    Obviously there are some differences, like the T4 does not have any DACs so code setup to use those are not applicable. Not sure if there is support yet for MQS pins...

    Again hopefully someone who uses more of the Audio stuff can give you a more complete answer.

  4. #4
    Senior Member+ manitou's Avatar
    Join Date
    Jan 2013
    Posts
    2,339
    the first page of the T4 beta test thread (HUGE) describes audio things that are working and not.
    https://forum.pjrc.com/threads/54711...irst-Beta-Test

  5. #5
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    21,353
    Everything that's pure DSP, all the functions that aren't hardware inputs or outputs, work fine on Teensy 4.0 and run much faster, so you can do much more. A couple of them with hardware-specific memory limits, like the delay effect, got a minor update. Use 1.49-beta3 for the latest code.

    I2S (stereo) and TDM master mode input & output work great. The Rev D Audio Shield is the best supported hardware. It works very well.

    I2S slave mode might work, but I'm not sure.

    I believe PT8211 works, but it's on my list to check soon. This PCB arrived from OSH Park just yesterday.

    USB and ADC and PWM are not yet working on Teensy 4.0. These are on my list to do, but I can't promise a time frame.

    I2S quad channel isn't working yet. Neither is 6 or 8 channel, which aren't even possible on Teensy 3.x. I worked with this just a couple days ago, but didn't get it running yet. If you want more than stereo, for now plan on using TDM.

    Teensy 4.0 doesn't have the 12 bit DACs of Teensy 3.x, so the DAC output will never be supported.

    ADAT hasn't been tested. Unless someone with this hardware steps up, it seems unlikely we'll ever get this niche application well supported on Teensy 4.0.

    While not technically part of the audio library, USB MIDI was recently added in 1.49-beta2. Many people use this together with the audio lib. It's working now, if you use the latest beta. Of course, regular serial MIDI and USB host MIDI have been working on Teensy 4.0 since its release in August.

  6. #6
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    6,230
    Last time I tested them all SPDIFs in and out, PT8211s or simple I2Ss and MQS worked. But that's a while ago (some months) when I modified/wrote them for T4. Idon't know the current state, because I was away for quite some time. I remember not to have done I2S slaves, ADAT and analog input. Maybe somebody else had?
    Last edited by Frank B; 12-20-2019 at 10:59 PM.

  7. #7
    Junior Member
    Join Date
    Dec 2019
    Posts
    15
    Quote Originally Posted by Frank B View Post
    Last time I tested them all SPDIFs in and out, PT8211s or simple I2Ss and MQS worked. But that's a while ago (some months) when I modified/wrote them for T4. Idon't know the current state, because I was away for quite some time. I remember not to have done I2S slaves, ADAT and analog input. Maybe somebody else had?
    Quote Originally Posted by PaulStoffregen View Post
    Everything that's pure DSP, all the functions that aren't hardware inputs or outputs, work fine on Teensy 4.0 and run much faster, so you can do much more. A couple of them with hardware-specific memory limits, like the delay effect, got a minor update. Use 1.49-beta3 for the latest code.

    I2S (stereo) and TDM master mode input & output work great. The Rev D Audio Shield is the best supported hardware. It works very well.

    I2S slave mode might work, but I'm not sure.

    I believe PT8211 works, but it's on my list to check soon. This PCB arrived from OSH Park just yesterday.

    USB and ADC and PWM are not yet working on Teensy 4.0. These are on my list to do, but I can't promise a time frame.

    I2S quad channel isn't working yet. Neither is 6 or 8 channel, which aren't even possible on Teensy 3.x. I worked with this just a couple days ago, but didn't get it running yet. If you want more than stereo, for now plan on using TDM.

    Teensy 4.0 doesn't have the 12 bit DACs of Teensy 3.x, so the DAC output will never be supported.

    ADAT hasn't been tested. Unless someone with this hardware steps up, it seems unlikely we'll ever get this niche application well supported on Teensy 4.0.

    While not technically part of the audio library, USB MIDI was recently added in 1.49-beta2. Many people use this together with the audio lib. It's working now, if you use the latest beta. Of course, regular serial MIDI and USB host MIDI have been working on Teensy 4.0 since its release in August.
    Quote Originally Posted by manitou View Post
    the first page of the T4 beta test thread (HUGE) describes audio things that are working and not.
    https://forum.pjrc.com/threads/54711...irst-Beta-Test
    Quote Originally Posted by KurtE View Post
    Note: I don't do very much Audio stuff. Mostly simple sounds from time to time...

    But I believe that most of the Audio library is working fine on T4... However the IO pin hookups are different, which is why PJRC now sells a different audio Adapter for the T4.

    More details on the adapters are up at: https://www.pjrc.com/store/teensy3_audio.htm You can hook up a T3.x version Audio adapter to T4, but you need to change the wiring. That is you can not simply plug a T4 into the T3.x version.

    Obviously there are some differences, like the T4 does not have any DACs so code setup to use those are not applicable. Not sure if there is support yet for MQS pins...

    Again hopefully someone who uses more of the Audio stuff can give you a more complete answer.
    hey thanks everyone for all the info

  8. #8
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    21,353
    Quote Originally Posted by Frank B View Post
    I remember not to have done I2S slaves, ADAT and analog input. Maybe somebody else had?
    I worked on the I2S code while you were away. I got I2S slave working at one point, but haven't tested it much since then. Hardly anyone uses slave mode. The main work I did in I2S was getting simultaneous transmit and receive working. Since then, my attention got pulled away from coding for several weeks, mostly by mundane manufacturing & business issues. Now I'm back to developing, but right now focusing mostly on the USB device code. Planning to work on USB audio soon...

    I haven't touched ADC or ADAT. I don't even have any ADAT hardware for testing, so I'll probably never get that working.

  9. #9
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    6,107
    Quote Originally Posted by PaulStoffregen View Post
    ...

    I believe PT8211 works, but it's on my list to check soon. This PCB arrived from OSH Park just yesterday.
    Just ordered... Not sure if there is special one for T4? If so would be great if I could get at least one specific that way...

    Now back to diversions.

  10. #10
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    6,230
    I don't have ADAT hardware, too

  11. #11
    So far all audio tutorial material runs fine. Running Teensyduino beta v3 I am running midi through usb no problem. After I route the MIDI in to soundfont I am going to attempt i2s communications between my 4.0 w/ shield to an ASUS tinkerboard. I'll post my results.

  12. #12
    Senior Member vjmuzik's Avatar
    Join Date
    Apr 2017
    Location
    Florida
    Posts
    467
    I have some ADAT hardware I just to don’t have the right LEDs to test it with since I’ve never had the need to hook up a Teensy to my audio equipment.

  13. #13
    On iMX RT1060 it is possible to use AD_B1_07 pin as SPDIF_EXT_CLK (currently mapped to digital pin 16/AD2) as input (via a mux, that's referred as tx_clk2 in RM) for the MCLK3 source in SA1-SAI3. That would give us possibility to sync the internal clock generation to an external MCLK. For generating the MCLK from word clock there are special chips containing the PLL, I guess also any S/PDIF receiver could work there. I haven't tested that though, and the RM is little bit unclear and uses mixed names for the ext clock signal. However, I can't find how the SPDIF in (Rx) clock could be used as MCLK. Anyway, that way two clock domains could be synced without need for slave mode, but I don't know if it can be used to actually replace that. At least you can use an external clock with possibly less jitter and with integer ration to Fs to avoid jitter caused by clock generation in case non-integer rations.

  14. #14
    It's hard to tell. It's frustrating to have spent hours using provided tools and audio code examples only to find that none of the features I want to use are implemented yet in 4.0 or have no plans to be implemented.

  15. #15
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    10,633
    Quote Originally Posted by pimp cauldron View Post
    It's hard to tell. It's frustrating to have spent hours using provided tools and audio code examples only to find that none of the features I want to use are implemented yet in 4.0 or have no plans to be implemented.
    Welcome - with this being initial post. Added information and posts with regard to problems or the missing features are not clear.

  16. #16
    Senior Member
    Join Date
    Feb 2015
    Posts
    168
    Quote Originally Posted by pimp cauldron View Post
    It's hard to tell. It's frustrating to have spent hours using provided tools and audio code examples only to find that none of the features I want to use are implemented yet in 4.0 or have no plans to be implemented.
    Are you referring to ADAT or other features? The community can help if you provide some more info.

  17. #17
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    21,353
    The only 2 features which aren't planned for Teensy 4.0 are DAC and ADAT. Everything else Teensy 3.x supports will eventually happen on Teensy 4.0.

    ADAT could be done, if someone with ADAT hardware wanted to take on that task. I personally do not have any ADAT hardware, nor do I plan to buy any ADAT gear, so I will not be working on ADAT.

    Obviously we can't do DAC on Teensy 4.0, since NXP didn't put the 12 bit DAC hardware into these chips.

    Since this thread started (about 2 weeks ago), I2S slave mode has been added for Teensy 4.0, and I2S2 (which does not exist on Teensy 3.x) got improved to allow using both input and output simultaneously. Progress is being made. I also spent about 2 days without success on Quad I2S, so I decided to put it off until 1.50.

    However, Teensy 4.0 has much more than just audio. Right now, I'm working on improving the Wire library to more robustly handle rare but very troublesome error conditions. That is currently the only thing holding up a 1.49 software release, so it's considered quite urgent.

    In recent months, quite a lot of work had gone into the USB device code, to greatly speed up USB serial and to add MIDI and the various HID devices. A whole week went into supporting the new MacOS. Many other things have been done, on audio and non-audio stuff. Many things are all improving. Work is happening, at a pretty good pace, but there are only so many hours in each day. Not everything can all be done immediately. I hope you can try to understand this?

    Here are the lists of changes from the 4 betas for 1.49, and another short list will soon be added.


    Optimize USB serial on Teensy 4.0
    Move USB serial buffers from ITCM to OCRAM on Teensy 4.0
    Fix stalled USB serial transmit if multiple of 64 bytes on Teensy 4.0
    Support different USB descriptors for 12 vs 480 speed on Teensy 4.0
    Add FLASHMEM keyword
    Arduino memory usage for Teensy 4.0 shows only RAM1 (512K) bank usage
    Fix Audio lib delay effect maximum (2.4 sec) on Teensy 4.0
    Fix missing ITCM padding from Teensy 4.0 memory usage
    Fix empty code on Teensy 3.x if yield() overridden and no core lib functions used
    Reduce DTCM memory usage by USB descriptors on Teensy 4.0
    Fix USB transfer complete callbacks on Teensy 4.0
    Fix Audio lib memory limit on Teensy 4.0
    WS2812Serial add functions for better compatibility with Adafruit_NeoPixel
    Windows teensy_serialmon (hopefully) doesn't lock up (but still too much buffering!)

    Add Teensy 4.0 USB MIDI, Keyboard, Mouse, Joystick
    Support for MacOS Catalina
    Port WS2812Serial to Teensy 4.0 (KurtE)
    AVR register emulation on Teensy 4.0 (KurtE)
    Fix serial DMA def on Teensy 4.0 (KurtE)
    Improve ADC & XBAR defs on Teensy 4.0 (KurtE)
    Improve quadrature encoder defs on Teensy 4.0 (mjs513)
    Add Teensy 4.0 USB Touchscreen, not finished... work in progress
    Remove serial monitor debug messages on Arduino 1.8.9

    Fix delay() and micros() on Teensy 4.0 at 24 MHz
    Fix USB touchscreen
    Fix serial receive at very high baud rates on Teensy 4.0
    Fix MIDI+Serial on Teensy 4.0
    Fix USB Keyboard sending "garbage" in long strings on Teensy 4.0
    Fix analogWrite for values >= 2^res on certain Teensy 4.0 pins
    Wire only clear FIFO with bus is idle on Teensy 4.0 (KurtE)
    Wire use open drain pin config on Teensy 4.0
    Update ST7735_t3 library
    SPI optimize usingInterrupt() on Teensy 4.0 (FrankB)
    SPI allow faster clock speeds on Teensy 4.0 (KurtE)
    Fix daylight saving time issue with automatic RTC set on Teensy 4.0
    Add Makefile for Teensy 4.0
    Add main.cpp for Teensy 4.0 (KurtE)
    Fix compiler warnings on Teensy 2.0

    Audio fix simultaneous input & output on I2S2
    Audio allow larger queue & delay effect on Teensy 4.0
    FastLED updated to allow WS2812Serial driver on Teensy 4.0 (KurtE)
    PulsePosition support for Teensy 4.0 (mjs513)
    TimerOne & TimerThree updates & fixes for Teensy 4.0 timers
    Update ADC library (pedvide)
    Update RA8875 for Teensy 4.0 (mjs513)
    Add QuadTimer library (mjs513)
    Add FlexCAN_T4 (tonton81)
    Add ILI9488_t3 (mjs513)
    Port ssd1351 to Teensy 4.0 (KurtE)
    Port SoftPWM to Teensy 4.0
    Add ADC_ETC definitions to imxrt.h (KurtE)
    Adjust Wire library pin drive strenth on Teensy 4.0
    Optimize Ethernet CS on Teensy 4.0 (Remo Jongeneelen)
    Include stdbool.h - needed by Temboo library
    Fix micros() non-monotonic output on Teensy 4.0 with slow CPU speeds
    Optimize micros() on Teensy 4.0
    ST7735_t3 & WS2812Serial minor cleanup

  18. #18
    Quote Originally Posted by defragster View Post
    Welcome - with this being initial post. Added information and posts with regard to problems or the missing features are not clear.
    I realize I'm being terse and disparaging. But there is no specific problem. I put together a basic circuit and code to input audio with a bare Teensy 4.0 only to discover that AnalogInputAudio is not supported (yet?). Next I tried to do DAC audio output to discover obviously that 4.0 has no DAC. Finally I thought I might try PWM audio, and discover that it isn't implemented (yet?). I'm left to purchase an older board (which I did) or an audio shield. I don't know what I can expect to do as far as audio with a bare 4.0. Most of the info and documentation available for audio is for previous boards, and I didn't expect none of the features I would try work on the latest version of this board. I hope you can understand my frustration.

    Thanks all for your efforts. I'm looking forward to making some great projects with the Teensys

  19. #19
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    6,230
    Quote Originally Posted by pimp cauldron View Post
    I realize I'm being terse and disparaging. But there is no specific problem. I put together a basic circuit and code to input audio with a bare Teensy 4.0 only to discover that AnalogInputAudio is not supported (yet?). Next I tried to do DAC audio output to discover obviously that 4.0 has no DAC. Finally I thought I might try PWM audio, and discover that it isn't implemented (yet?). I'm left to purchase an older board (which I did) or an audio shield. I don't know what I can expect to do as far as audio with a bare 4.0. Most of the info and documentation available for audio is for previous boards, and I didn't expect none of the features I would try work on the latest version of this board. I hope you can understand my frustration.

    Thanks all for your efforts. I'm looking forward to making some great projects with the Teensys
    Don't know wether PWM for audio is planned or not - From my point of view, PWM is not needed, because T4 has the better MQS ("Medium Quality sound") - which- at least for audio -, is almost as good as the old DAC.
    Of course, the shield is better - or - if you want it cheap - add a 50 cent PT8211.

Posting Permissions

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