-
Notifications
You must be signed in to change notification settings - Fork 5
Audio Library internals
The Audio Library uses 44100Hz, 16BIT sampling.
On of the used inputs or outputs is responsible for the timing. Usually, this is one of the I2S interfaces.
On the Teensy 3.x models, there is no official way to change the Sampling frequency - On Teensy 4, this is partly supported.
The heart of the library, AudioStream, is part if the Teensy core (Teensy 3 AudioStream.h AudioStream.cpp / Teensy 4 AudioStream.h AudioStream.cpp).
The AudioStream is responsible to call all other parts (such as inputs, outputs, effects, etc)
By default, it uses blocks of 128 Samples. So the duration of block is (128 / 44100) = 0,0029 seconds, or 2.9 milliseconds. This also defines the latency.
If you want shorter blocks to reduce the latency, it is possible to reduce the blocksize on both, Teensy 3.x and Teensy 4.x - either by editing the #define AUDIO_BLOCK_SAMPLES to a multiple of 32 or by adding a define to your ID (Not possible with the Arduino-IDE) . Reducing the block size comes at the cost of higher computational overhead.
T4 allows to change the sample rate. This is, however, not officially supported, and not all parts of the library will work with a modified sample rate.
Things that will not work without additional modifications are USB-Audio and some of the effects.
...to be continued..
WIP
Teensy is a PJRC trademark. Notes here are for reference and will typically refer to the ARM variants unless noted.