diff --git a/examples/PassthroughF32/PassthroughF32.ino b/examples/PassthroughF32/PassthroughF32.ino index af12f2e..6373f60 100644 --- a/examples/PassthroughF32/PassthroughF32.ino +++ b/examples/PassthroughF32/PassthroughF32.ino @@ -10,17 +10,18 @@ #include "Audio.h" // Teensy I16 Audio Library #include "OpenAudio_ArduinoLibrary.h" // F32 library #include "AudioStream_F32.h" -/* -#include "Audio.h" // Teensy I16 Audio Library -#include "OpenAudio_ArduinoLibrary.h" // F32 library -#include "AudioStream_F32.h" */ -// AudioInputI2S_OA_F32 i2sIn; -AudioInputI2S_F32 i2sIn; -AudioAnalyzePeak_F32 peakL; -AudioAnalyzePeak_F32 peakR; -// AudioOutputI2S_OA_F32 i2sOut; -AudioOutputI2S_F32 i2sOut; +// T3.x supported sample rates: 2000, 8000, 11025, 16000, 22050, 24000, 32000, 44100, 44117, 48000, +// 88200, 88235 (44117*2), 95680, 96000, 176400, 176470, 192000 +// T4.x supports any sample rate the codec will handle. +const float sample_rate_Hz = 24000.0f ; // 24000, 44117, or other frequencies listed above +const int audio_block_samples = 32; +AudioSettings_F32 audio_settings(sample_rate_Hz, audio_block_samples); + +AudioInputI2S_F32 i2sIn(audio_settings); +AudioAnalyzePeak_F32 peakL(audio_settings); +AudioAnalyzePeak_F32 peakR(audio_settings); +AudioOutputI2S_F32 i2sOut(audio_settings); AudioConnection_F32 patchCord0(i2sIn, 0, peakL, 0); AudioConnection_F32 patchCord1(i2sIn, 1, peakR, 0); @@ -33,9 +34,7 @@ void setup() { delay(1000); Serial.println("OpenAudio_ArduinoLibrary - Passthrough Stereo"); - // Internally, I16 blocks are used Bob Fix sometime - // AudioMemory(4); // Needed or I/O - AudioMemory_F32(20); + AudioMemory_F32(20, audio_settings); codec1.enable(); // MUST be before inputSelect() codec1.inputSelect(AUDIO_INPUT_LINEIN); } diff --git a/readme.md b/readme.md index ae94875..b308434 100644 --- a/readme.md +++ b/readme.md @@ -3,7 +3,7 @@ OpenAudio Library for Teensy *** Special Note *** 6 January 2021- This library is undergoing revision to make Teensy 4.x compatible and to add functionality. The Tympan Library files and associated classes output_i2s_f32.h, output_i2s_f32.cpp, input_i2s_f32.h, input_i2s_f32.cpp are now -ready to be used for T3.x and T4.x. There are some restrictions, particularly this should be used with 16-bit I2S codec data. Codec sample rates can be varied. Block size needsto be left at 128 for now. Work on the F32 i/o routines is continuing. Thanks to Chip and @jcj83429 . +ready to be used for T3.x and T4.x. There are some restrictions, particularly this should be used with 16-bit I2S codec data. Codec sample rates can be varied. Variable block size is supported, but be sure the settings option is used. More on this to come. Work on the F32 i/o routines is continuing. Thanks to Chip and @jcj83429 . **Purpose**: The purpose of this library is to build upon the [Teensy Audio Library](http://www.pjrc.com/teensy/td_libs_Audio.html) to enable new functionality for real-time audio processing.