Teensy 4 audio - ADC input not working


New member
Hi everyone,

I got trouble to get the audio ADC input working with a teensy 4.1. I have tried the PeakMeterMono example in combination with the ADC example circuit (https://www.pjrc.com/teensy/gui/img/adccircuit.png)
void loop() {
 // if (fps > 24) {
    if (peak1.available()) {
      fps = 0;
      int monoPeak = peak1.read() * 30.0;
      for (int cnt=0; cnt<monoPeak; cnt++) {
 // }
My hardware setup works fine with this code when I use a Teensy 3.2. However, with a Teensy 4 simply nothing happens. Apparently peak1.available() is never true. I suspect the initialisation of the ADC failed somehow. Has anyone an idea how to resolve this?

So far, I have tried a fresh Arduino 1.8.19 and Teensyduino 1.56 installation. I have read here that the "ADC does not work good", but does it work at all?

Best regards,
I bought a few audio adaptor boards and added an electret microphone (adafruit 1064). With this setup, the PassThroughStereo example worked out of the box.
I bought a few audio adaptor boards and added an electret microphone (adafruit 1064). With this setup, the PassThroughStereo example worked out of the box.

Seems the i2S board you got made it work.

There is an update to the library (beta). I'll be checking it out.
If you use the latest from github, remember to have at least 1 other input or output with "update responsibility", as the ADC input can't do that on Teensy 4. Any I2S or MQS works, even if unused.
Update: just got it working on a Teensy 4, unplugged from audio shield, USB Audio removed. There's something else going wrong.
Anyway the tip with the update responsibility is important.

I'm jumping in here because I was trying that using an unused I2S port, but without an audio board. We thought about recording some piezo sensors in the next rocket.
Is there a trick or a small sample how to arrange ADC input, FFT and I2S output, AudioMemory to make it work?
I've only success with the Audio shield, but this wouldn't fit in the experiment unfortunately.

Thanks and best regards,
Last edited:
Tracked down the issue, removing the following line brings ADC and FFT/peak to live:

set_arm_clock(528'000'000); // reduce speed to 528 MHz (NXP default)

We need to adjust the clock and slow down the RT1062 a bit because in micro gravity environment / space there is no atmosphere to convect and transport heat away from the chip and PCB.

Are there any ideas or options how to solve this (we dynamically change the clock speed atm)?
Or any already known boundaries of CPU speed and audio functionality? 150, 240 and 396MHz do not work as well.
But 450, 600, 816 do. Are there any options for frequencies <450 MHz?

I'm surprised to hear 396 MHz isn't working for audio.

I tried the WavFilePlayer and Synth > Guitar examples at 396 and 150 and 24 MHz. All 6 cases sound fine when I listen to the audio shield output. I really didn't expect 24 MHz to work, but I'm listening to the WAV files playing right now as I type this message, on a Teensy 4.1 running at 24 MHz and a 8GB SD card in the audio shield's socket.

We may indeed have a problem with any of the other inputs or output types, or perhaps some combination of them when used at lower CPU frequency. But since those 2 examples work fine with the audio shield even at 24 MHz, I really need you to give a (hopefully small) test program which demonstrates the problem.
Hi Paul,
the setup is completely without audio shield using the on-chip ADC for recording with an unused I2S / SPDIF output for update responsibility.
I chose SPDIF to reduce the amount of pins eventually interfering. I'll check with a single Teensy 4 after flight sim and post a reduced example what I did there for reference. For now we give it a try at 450 MHz and sacrificing FFT above 80 °C chip temperature by forcefully slowing down.
Please see the example, below. Just verified. Choose the frequency to test from set_arm_clock(...). The setting 396 MHz produces 1 "FFT available" on start and then only "FFT unavailable".

/// Do not remove the include below
#include "T4SX.h"

#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>

const int ANALOG_INPUT_PIN = A12;

AudioAnalyzeFFT256 a12FFT;
AudioAnalyzePeak a12Peak;
AudioInputAnalog a12In(ANALOG_INPUT_PIN);
AudioOutputSPDIF3 spdifOut;

AudioConnection patch01(a12In, 0, a12FFT, 0);
AudioConnection patch02(a12In, 0, a12Peak, 0);

extern "C" uint32_t set_arm_clock(uint32_t frequency);

FLASHMEM void setup() {
    digitalWrite(LED_BUILTIN, HIGH);


    while (!Serial) {


    //set_arm_clock(240'000'000); // no audio
    set_arm_clock(396'000'000);   // no audio
    //set_arm_clock(450'000'000); // OK
    //set_arm_clock(528'000'000); // no audio
    //set_arm_clock(600'000'000); // OK
    //set_arm_clock(816'000'000); // OK

uint32_t fftAvailable = 0, fftUnavailable = 0;

void loop() {
    if (a12FFT.available()) {
    } else {

    Serial.printf("FFT: available: %i - unavailable: %i\r", fftAvailable, fftUnavailable);