TeensyPhonon
Active member
I am trying to do a synchronized emission and reception between two teensy 4.1 (I use the SPH0645 as the microphone and the MAX98357A as an amplifier for the speakers).
Here is my code for recording :
And for playing :
So for triggering, the teensy which is recording put, it's pin 1 on LOW (it was previously on HIGH) and the second teensy is waiting for it.
This approximatively works... but I have a random variation of delay in the recordings. So, I performed 50 measures for a pure sin wave at 1000Hz and it Seems VERY random :
Here is my code for recording :
C++:
digitalWrite(1,LOW);
Q_in_L.clear();
for (i = 0; i < nfor; i++) {
while(Q_in_L.available() < 1);
sp_L = Q_in_L.readBuffer();
arm_q15_to_float (sp_L, &float_buffer_L[partitionsize * i], partitionsize);
Q_in_L.freeBuffer();
}
And for playing :
C++:
while(digitalRead(0) == HIGH);
for(i=0;i<nc;i++){
arm_float_to_q15(&signal[i],&conv_floatint,1);
Q_out_L.play(conv_floatint);
}
So for triggering, the teensy which is recording put, it's pin 1 on LOW (it was previously on HIGH) and the second teensy is waiting for it.
This approximatively works... but I have a random variation of delay in the recordings. So, I performed 50 measures for a pure sin wave at 1000Hz and it Seems VERY random :