So I'm having a couple of thoughts...
Here I am testing instances of AudioInputI2S and AudioInputI2S2 for capturing samples in a queue and printing them(mostly copy code from recording example). But this is all gonna take place at 16bit @44.1KHz while I want 24bit@48KHz So...
Code:#include <Audio.h> AudioInputI2S i2s1; AudioInputI2S2 i2s2; AudioRecordQueue queue1; AudioRecordQueue queue2; AudioConnection patchCord1(i2s1, 0, queue1, 0); AudioConnection patchCord2(i2s2, 0, queue2, 0); void setup() { Serial.begin(115200); AudioMemory(60); queue1.begin(); queue2.begin(); } void loop() { byte buffer1[512]; byte buffer2[512]; memcpy(buffer1, queue1.readBuffer(), 256); queue1.freeBuffer(); memcpy(buffer1 + 256, queue1.readBuffer(), 256); queue1.freeBuffer(); memcpy(buffer2, queue2.readBuffer(), 256); queue2.freeBuffer(); memcpy(buffer2 + 256, queue2.readBuffer(), 256); queue2.freeBuffer(); for (int i = 0; i < 512; i++) { Serial.println(buffer1[i]); } for (int i = 0; i < 512; i++) { Serial.println(buffer2[i]); } }
I think what I might do is inside the "audio_block_struct" in AudioStream.h,
View attachment 18260
change the data[AUDIO_BLOCK_SAMPLES] data type from int16_t to int32_t and change the
#define AUDIO_SAMPLE_RATE_EXACT 44100.0f
to
#define AUDIO_SAMPLE_RATE_EXACT 48000.0f
I don't know how deep the implications of this might be.
What do you folks think?
I'm creating this new thread because it can be a topic on its own I think..
Original source is https://forum.pjrc.com/threads/58474-2x-PCM1808-ADCs-recording-LR-ch-each-(I2S-quad-input-)-on-T4-and-also-1-DAC-UDA1334