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

Status
Not open for further replies.

bigtony

Active member
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?
 
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.
 
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.
 
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:
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?

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.

the first page of the T4 beta test thread (HUGE) describes audio things that are working and not.
https://forum.pjrc.com/threads/54711-Teensy-4-0-First-Beta-Test

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 :)
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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
 
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 :)
 
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.
 
Hi, I wanted to ask what the state of the quad audio output is?
Also, what needs to be done if I want to stack two audioshields on top of each other?
From the example I saw on the sparkfun page (https://www.sparkfun.com/news/2055) certain traces need to cut and other ones need to be jumpered, but I wasn't able to find these informations for the teensy 4.0 and the rev d audio shield.
Thanks :)
 
ADAT possible testing here. I have ADAT gear, just need to get some optical interface to the T4. Grr... This freaking virus brings everything to halt, so it may take a while.
 
Hi!

Has anyone had any luck getting I2S quad to run on the Teensy 4?

Last fall, I2S_quad wasn't supported yet on the T4, but the T4 was brand new so that's totally understandable! I also see (in the posts above) that as of January, there still wasn't I2S_quad on T4, despite some good effort. Bummer!

It's been a few months since then (with one on-going worldwide pandemic). Might someone have cracked the tough nut that is I2S_quad on T4? (Alternatively, did I hear something about I2S2 for T4? What's that?)

Chip
 
Hi!

Has anyone had any luck getting I2S quad to run on the Teensy 4?

Last fall, I2S_quad wasn't supported yet on the T4, but the T4 was brand new so that's totally understandable! I also see (in the posts above) that as of January, there still wasn't I2S_quad on T4, despite some good effort. Bummer!

It's been a few months since then (with one on-going worldwide pandemic). Might someone have cracked the tough nut that is I2S_quad on T4? (Alternatively, did I hear something about I2S2 for T4? What's that?)

Chip
The release notes for Teensydunio 1.52 beta 1 state:
  • USB Audio support for Teensy 4.0
  • OctoWS2811 ported to Teensy 4.0
  • WS2812Serial support for RGBW SK6812 LEDs
  • FreqMeasureMulti ported to Teensy 4.0 (KurtE)
  • Dual & Triple USB Serial (Geert Uytterhoeven)
  • Audio support for 4,6,8 channel I2S on Teensy 4.0
  • Audio support for SPDIF input on Teensy 4.0 (FrankB)
  • Audio DAC support for Teensy LC (Ben Kurtz)
  • Audio PWM output for Teensy 4.0 (FrankB) (Note, FrankB later in the thread says it doesn't work)
  • Fix Serial.print() conflict with USB Touchscreen
  • Fix contact count on USB Touchscreen (purple-ben)
  • Defined FLASHMEM on Teensy 3.x, for compatibility with Teensy 4 code (FrankB)
  • Fix cache handling in I2S audio input on Teensy 4.0 (Frank B)
  • Fix numerous iMXRT register field defines
  • MTP USB descriptors on Teensy 4.0 - actual MTP support still WIP
  • Libraries updated: FlexCAN_t4, ST7735_t3, RA8875

The release notes for 1.52 beta 2 states:
  • Fix USB RawHID on Teensy 4.0 (KurtE)
  • Fix USB audio+midi+serial descriptor on Teensy 4.0 (widdly)
  • Add ADK to USBHost_t36 (Matt Bergman)
  • Fix USB Host MIDI transmit race condition (essej)
  • Optimize USB interrupt on Teensy 4.0 (Frank B)
  • Arduino compatibility of digitalWrite control pullups (FrankB)
  • Add missing MPU traps on Teensy 4.0 (FrankB)
  • Fix SGTL5000 clock ratio setting (FrankB)
  • Fix I2S slave on Teensy 4.0 (widdly)
  • Add DMAMEM & fix warnings in I2S on Teensy 4.0 (FrankB)
  • Improve SPI use by SD on Teensy LC (rutmarti)
  • Support alternate SPI pins on Teensy 4.1 (KurtE)
  • Support alternate Teensy 4.1 CS pins on ILI9341_t3 (KurtE)
  • Fix Teensy Loader on MacOS 10.13 with Catalina version
  • Fix teensy_serialmon 100% CPU on Linux if Arduino process killed
  • Workaround for rare Windows Defender flase positive when installing Java classes

The release notes for 1.52 beta 3 states:
  • Support for Teensy 4.1 - still in beta testing
  • Allow SD.begin() to be called more than once
  • Support hardware serial CTS pins on Teensy 4.1 (KurtE)
  • Fix double float promotion (Frank B)
  • Fix I2S input use of cache (Frank B)
  • Fix installer crash on Jetson Nano
  • Update libs: RA8875, ILI9844_t3, QuadEncoder, ST7735_t3

I believe I2S2 works as well. You only have the 1 input and 1 output pin, unlike I2S1 that has 5 pins. The last I checked, the audio gui designer tool did not know about I2S2. Also, the audio shield only uses I2S1. Using a non-audio shield external I2S device, I was able to use I2S2 some time ago. If you are using something that needs a master clock, you will need to solder a wire to pad #33 under the Teensy. Otherwise, it uses pins 2-5 for OUT2, LRCLK2, BCLK2, and IN2.
 
Thanks for the quick reply!

Where do I learn which pins the i2s_quad class uses when using with teensy 4? The example sketches (when I looked) provide no hookup guidance.

Or, to ask a maybe easier form of the question...

The first two channels of i2s_quad presumably use in1 and out1, but what do the second two channels use? With T4 there are many choices!

Chip
 
Thanks for the quick reply!

Where do I learn which pins the i2s_quad class uses when using with teensy 4? The example sketches (when I looked) provide no hookup guidance.

Or, to ask a maybe easier form of the question...

The first two channels of i2s_quad presumably use in1 and out1, but what do the second two channels use? With T4 there are many choices!

Chip

Well ultimately there is going to the 1062 reference manual, pages 2065 through 2150, but that can be pretty daunting. I recall Paul may have posted a setup guide.
 
Status
Not open for further replies.
Back
Top