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

Thread: Teensy 3.6 versus 4.0 for audio processing

  1. #1

    Teensy 3.6 versus 4.0 for audio processing

    Hello everybody,

    I have a question concerning Teensy 3.6 vs 4.0 for audio processing. Which one should I buy?

    I have used the Arduino Uno for years. I really enjoy it and I have tried to do some audio.
    The best I have achieved on the Uno so far is to play audio using the 16 bit timer as a clock (at 16 kHz) and an external DAC with a 12 bit resolution (16 bit resolution DACs are really expensive in the DIP format).
    I have managed to play some audio either pre-loaded in the program memory (32kB, so less than 1 second) or using an SD card. But the size of the files is restricted.

    Therefore I want to buy a Teensy now.

    My question is which Teensy should I buy: 3.6 or 4.0? The 4.0 looks really cool, but I believe that the 3.6 is more documented?

    Since I might do some "heavy" computation such as FFTs, is the Teensy 4.0 a better choice?
    I have seen this graphic that seems to show the 4.0 is far better the other microcontrollers but I do not really understand what the graphic is related to.

    Also I have another motivation for buying a Teensy. iI would like to get familiar with 32 bit ARM MCUs. I have learned to program the Arduino Uno both in C and assembly language and I enjoy it. I want to learn to do so on a more complex microcontroller.

    Cheers,
    LaurentNorbert

  2. #2
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    9,919
    Hello LaurentNorbert!

    Indeed the "3.6 is more documented" and tested and evolved at this point. It also has two native DAC pins - though not 16 bit.

    The T4 has no DAC pins - but If you wanted 16 bits external would still be needed.

    The Audio library use as documented will be common and should be fully supported. And a T4 pinout specific PJRC Audio shield should be available soon so look for that if desired and going with the T4.

    The T_3.6 is very fast compared most everything but a Teensy 4 - even when overclocked to 256 MHz.

    T4 at 600 MHz not only has a RAW speed advantage - but code can be more readily placed in RAM { it is by default } - and the ARM core can also manage 2 instructions at once in cases. These and other enhancements are behind the dramatic benchmark improvements shown.

    T4 has float and double hardware support, not just float like the T_3.6. Both have the same USB Host hardware - though T_3.6 has onboard support and pins not pads for connectivity.

    Other obvious things you can see and consider are the needed number of pins and onboard SD card advantage T_3.6, but larger Flash and RAM and smaller size and lower cost go to the T4.

    T4 went came to Beta 9 months ago and is well functional - but still evolving

  3. #3
    Hello Defragster,

    Thank you for your quick reply.
    You almost convinced me to buy the T4.
    Because of the speed and the double hardware support which should make the FFT faster (for instance).
    I hesitate a bit because of the size and the builtin DACs on the Teensy 3.6.

    I think I will start the adventure with the T4. Pretty exciting!

  4. #4
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    9,919
    - either is a good choice - that's most of the high points - others or a PJRC.com page may fill in any key differences that might help choosing the best for use.

  5. #5
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    3,299
    The T4 has two separate I2S buses, the first having 4 outputs + 1 input, while the second just has 1 output + 1 input (note, if you need access to the master clock from the second i2s bus, you will need to solder a wire to bring out a pin on the bottom pad).

    I believe the T3.6 only has one I2S bus, and its pins are not documented on the standard pinout card, just on the audio board. In order to use I2S, you need to move two of the SPI pins because the I2S pins overlap with the SPI pins (pins 11 + 13, plus the first CS pin 10).

    The T3.6 has a micro SD card built-in, and more pins available. The T4 has the solder pads to add a micro SD (but these are hard to bring out -- there are breakout boards to make accessing these pins easier, one is more DIY that you can order the PCB, and the other which is under development will have the necessary components to bring out the pins). The audio board has a slower micro SD card slot that you can use (note, the current audio board will need to be jumper as the T4 has a different layout for the I2S and SPI pins, but a new T4 audio board is expected shortly).

    Similarly the T3.6 (but not the T3.5) has the breakout for the USB host adapter that you can attach a female header to bring out a USB controller, while the T4 you need to solder wires to pads for the D-/D+ (again the breakout boards will help access this). I don't know what the state of Teensy USB audio support is.

    While the T3.6 has two low quality DAC (digital to analog) ports that can be used for sound, the T4 does not have official DAC's. If you don't use the main SPI bus at all, the T4 does have two MQS pins that can act like DAC's.

  6. #6
    Senior Member
    Join Date
    May 2016
    Posts
    220
    A couple of minor things to think about:
    1) PJRC has announced a new revision of the Audio Board for T4 that will be released any day now. In the meantime you can still use the current boards, but they don't plug in piggy-back on top of the T4, so you have to wire to the correct pins manually. And you may have to add a 100 ohm resistor if you have a Rev B board.

    2) The small form-factor (28 pins) of the T4 without a breakout board makes it harder to allocate pins to connect other external devices.

  7. #7
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,677
    Quote Originally Posted by DerekR View Post
    1) PJRC has announced a new revision of the Audio Board for T4 that will be released any day now.
    The new audio shield, which is the same circuit at the old one but with pins routed for Teensy 4.0, will appear on the website later this weekend. The first of those shields completed production at the end of last week.


    Regarding which board to get now, Teesny 3.6 offers built in 12 bit DACs, the SD socket built in, much easier access to USB host, and a lot more I/O pins. If any of those matter for your needs, get Teensy 3.6. Today the software support and documentation for Teensy 3.x is much more mature, so if you're doing something with a hard deadline like an academic/school project or a proof-of-concept demo for a trade show, Teensy 3.6 is probably a lower risk path when it comes to whether or not you'll be able to meet an upcoming deadline.

    For FFT, either board is plenty fast enough. Even Teensy 3.2 can do 50% overlapped & windowed 1024 point FFTs in real time (starts a new 1024 sample FFT every 512 samples - giving you twice the temporal resolution), leaving plenty of CPU power left over for reading the SD card or doing other work. If you're used to Arduino Uno, FFT's CPU usage can seem like a huge challenge. All Teensy 3.x are fast enough that FFT just isn't a big problem. Well, not unless you want to do FFT simultaneously on several audio channels. But for just running FFT to get the spectrum of an audio stream, Teensy 3.6 is plenty fast enough.

    Of course Teensy 4.0 is much faster. With today's audio library feature set, you'd be challenged to really use even half of its capability. But over the next year, so much more will be added to the software side to leverage that incredible CPU power... features like machine learning sound recognition, real-time beat detection, more sophisticated effects and synthesis. That incredible CPU power can also be quite handy if you're planning to write your own DSP algorithms inside the audio library. Getting DSP algorithms to work is much easier if you start with simple but very inefficient code. But if the most demanding use you'll need is real-time FFT, Teensy 4.0's CPU power is massively overkill. Then again, if you need low power (a feature not yet well supported by the software), Teensy 4.0 will offer the possibility to keep up FFT analysis in real time even when running at slow clock speeds.

  8. #8
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    3,299
    Quote Originally Posted by PaulStoffregen View Post
    The new audio shield, which is the same circuit at the old one but with pins routed for Teensy 4.0, will appear on the website later this weekend. The first of those shields completed production at the end of last week.

    I see the audio page now has both the rev D (Teensy 4.0) and C (Teensy 3.x) versions on it.

    Some minor nits:

    On the first table, the column entries for the pins for the SD card and for flash memory are reversed. I.e. for the SD card, it should list pins 10-13 are Teensy 4.0 while for 3.x they 7, 10, 12, 14.

    The picture showing the layout for revision D is actually the revision C picture.

    I assume at some point schematics for the revision C and D boards will be added (or possibly just D, and updating the B/C schematic to indicate C had the 100 ohm resistor for MCLK.

    At some point, you will likely need to split the current status table to have a status for the C board and for the D boards.

  9. #9
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,677
    Quote Originally Posted by MichaelMeissner View Post
    Some minor nits:
    Thanks!

    I've fixed the first table and added schematics for rev C and rev D.

    Not quite sure what you meant about the layout pictures. But I rearranged the 4 PCB images so rev D are both on the left and rev C are both on the right, to be consistent with the tables.

  10. #10
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    3,299
    Quote Originally Posted by PaulStoffregen View Post
    Thanks!

    I've fixed the first table and added schematics for rev C and rev D.

    Not quite sure what you meant about the layout pictures. But I rearranged the 4 PCB images so rev D are both on the left and rev C are both on the right, to be consistent with the tables.
    I probably didn't see the titles, and mentally assumed the D board was always the first column. The new page looks great.

  11. #11
    Junior Member
    Join Date
    Sep 2019
    Posts
    3
    Quick question, is the S/PDIF out on Teensy 4.0 working with the Audio library? If so, do we just need to add an RCA jack to it, and use an optical cable to get audio out? Thanks!

  12. #12
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    3,299
    Quote Originally Posted by NuWaveIT View Post
    Quick question, is the S/PDIF out on Teensy 4.0 working with the Audio library? If so, do we just need to add an RCA jack to it, and use an optical cable to get audio out? Thanks!
    As of teensydunio 1.47, S/PDIF did not work on the Teensy 4.0. There was no indication that the support was added in teensydunio 1.48 beta 1. So for now, I would assume it is not working. I don't know where it is on Paul's list of priorities.

  13. #13
    Senior Member
    Join Date
    Jul 2014
    Posts
    2,365
    I'm happy to report a typo "locatoins" below the signals table.

  14. #14
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,677
    Quote Originally Posted by WMXZ View Post
    I'm happy to report a typo "locatoins" below the signals table.
    Opps, fixed.


    Quote Originally Posted by NuWaveIT View Post
    Quick question, is the S/PDIF out on Teensy 4.0 working with the Audio library?
    No, not yet.

  15. #15
    Junior Member
    Join Date
    Sep 2019
    Posts
    3
    Quote Originally Posted by PaulStoffregen View Post
    No, not yet.
    OK thanks!

  16. #16
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    9,919
    Still an issue on T4 Rev D image note :: pjrc.com/store/teensy3_audio.html

    Back Side
    Rev D (for Teensy 3.x)

  17. #17
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,677
    Quote Originally Posted by defragster View Post
    Still an issue on T4 Rev D image note
    Fixed. Thanks.

  18. #18
    It is looking interesting Mr Stoffregen. I wonder why you changed the pinout arrangement towards incompatibility with the old audio board and what the "Digital Audio" pins on the pinout map are intended to be used for. While I am at it, could there be a 32bit version of the libraries in the future for this brute of a Teensy or possibly even more powerful audio boards?

    Hope you are enjoying the rollout of the 4.

  19. #19
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    3,299
    Quote Originally Posted by RogerD View Post
    It is looking interesting Mr Stoffregen. I wonder why you changed the pinout arrangement towards incompatibility with the old audio board and what the "Digital Audio" pins on the pinout map are intended to be used for. While I am at it, could there be a 32bit version of the libraries in the future for this brute of a Teensy or possibly even more powerful audio boards?

    Hope you are enjoying the rollout of the 4.
    I'm not Paul, but I suspect it has to do with the underlying bits of the M4 (Teensy 3.x) vs. M7 (Teensy 4.0). I.e. any particular pin can only have so many settings, and NXP may have changed things internally, that it was impossible to render the old pinouts.

    Yeah, I hate incompatible flag days where things change, but I really, really did not like the old setup where the SPI pins had to be changed because the I2S pins could only go on top of the main SPI pins. This way, it doesn't matter whether you have the prop shield, the audio shield, or no shield mounted, the main SPI pins are the same. I tend to use Teensys like legos, plugging in bits here and there as needed. I don't have to wire up separate prototype boards, one for using the shield card and one not.

    While the main I2S pins do share pins with some of the serial ports, there are enough serial ports to go around that you can have the audio shield (I2S, I2C), a display screen (SPI), and a serial UART all with standard pins. Of course if you want two SPI buses using the fast display pin for each display, two I2S buses, and multiple serial UARTs, things get messy.

  20. #20
    Quote Originally Posted by MichaelMeissner View Post
    I'm not Paul, but I suspect it has to do with the underlying bits of the M4 (Teensy 3.x) vs. M7 (Teensy 4.0). I.e. any particular pin can only have so many settings, and NXP may have changed things internally, that it was impossible to render the old pinouts.

    Yeah, I hate incompatible flag days where things change, but I really, really did not like the old setup where the SPI pins had to be changed because the I2S pins could only go on top of the main SPI pins. This way, it doesn't matter whether you have the prop shield, the audio shield, or no shield mounted, the main SPI pins are the same. I tend to use Teensys like legos, plugging in bits here and there as needed. I don't have to wire up separate prototype boards, one for using the shield card and one not.

    While the main I2S pins do share pins with some of the serial ports, there are enough serial ports to go around that you can have the audio shield (I2S, I2C), a display screen (SPI), and a serial UART all with standard pins. Of course if you want two SPI buses using the fast display pin for each display, two I2S buses, and multiple serial UARTs, things get messy.
    I was thinking down the same path as you I suspect. Still, I am still stumped as to why he doesn't put out a decent PDF manual on the essentials of these boards. You know, pinout descriptions, more detailed specs for us plebs and details about any additions made to the Arduino language. He could probably spit out something very workable in a day to a week and he would save himself months of time wasting text time answering the same daft questions again and again. As for me there is nothing more frustrating with these things than spending weeks of free time designing and building code and hardware only to find that there is a mostly undocumented command that would do it all way more efficiently and simply. (I'm also a bit precious about losing access to analog inputs and more probably a bit peeved about the throwback to the v3.2 scale of things.) I assumed a while back that a spaceship was in the works with way more grunt. Just a shame to see that it is a tightly crammed ship. We'll get used to it though as things evolve.

    At least the Teensy 3.6 motivated me to build an analog modular system. Still want my tiny portable semi-analog synth though. A modular analog system can be very difficult to compose with through headphones in the park.

  21. #21
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    9,919
    There was great deal of effort by Paul before first beta boards shipped to get the best fit of the 1052 pins on the 1.4" board. There was a 'what if' thread before the Beta thread trying to solve some of the selection issues and choices. Then on page 76/77 of the T4_beta thread further refinement and selection had to be to maximize utility of the for the T4 in the end.

    The 1062 MCU -IIRC- has some half of the usable pins not connected because there are so many on this denser chip. Having numerous pins gave NXP the option of multiplexing them differently from the T3.x family because there were extra pins for extra functions - and fewer shared functions. So starting with the required primary and essential functions determined what if any alternate functions were also present on those pins. Even if another 20 pins were there - that wouldn't have allowed similar functional stacking/multiplexing of the prior T_3.x layout - because they would have needed to be on unique pins.

    Keeping a small number of stocked unit types is one of PJRC's noted goals - and from Beta 1 breakout design and shipment it was known he was breaking his own Audio board's utility and had to make a new one only for altered pin locations different from the updated T_3.x audio board - so that wasn't done by choice, but by the desire to make the Teensy 4 the most it could be with the newest most powerful chip … that wasn't even available, the 1062 - or perhaps public - when the Beta started.

  22. #22
    Like I said, we'll get used to it and adapt and new users will simply be blown away with the new capabilities the same way most are when they meet first meet Teensy. (There was an 800Mhz Arm CPU from several years ago I was thinking of tracking down. I'm a little surprised that no-one has done anything with that one.)

  23. #23
    Hello everyone,
    Thank you all for the answers.
    I did not expect that my question would be the starting point for a long discussion!
    Finally I chose the Teensy 3.6 because of the layout (no soldering needed, easier to use) and the SD card slot.
    It is coherent with my evolution from the Arduino world to Teensy. I will begin to work using the 12-bit DACs (Lo-Fi).
    If I understand correctly the power of T3.6 is sufficient for signal processing including the Fourier transform and this is cool.
    The audio library looks great!

    I have many things to test and learn right now!
    Thank you all for your comments

Posting Permissions

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