• Audio
  • Playing audio file and recording the echo simultaneously in Bela mini board

Hello everyone, thank you for taking the time to read my post and offering assistance!

I am currently engaged in an experiment where I play a pre-generated single-tone sound, specifically at 500 Hz, through a speaker, and simultaneously record a dual-channel audio sound file using the Bela mini board. However, upon inspecting the recorded signal, I've observed that it doesn't precisely match the 500 Hz frequency. As illustrated in the figure, the peaks of the sine wave exhibit slight shifts over time. This leads me to consider whether the discrepancy is attributed to clock drift between the playing device and the Bela board, given that their clocks may not be synchronized. Consequently, I am contemplating the idea of playing the sound and recording the echo both on the Bela board to address this issue.

I am currently able to utilize the code from \example Audio/sample-loader/render.cpp for the .wav file playback and \example Audio/record-audio/render.cpp for echo recording. I am seeking guidance on integrating these functionalities to achieve my objective. Can this integration be accomplished on the Bela mini board, and if so, are there potential implications for the sample rate or other indices? Any assistance or hints provided would be highly appreciated.

Best regards,
Laser

    LaserHu I am currently engaged in an experiment where I play a pre-generated single-tone sound, specifically at 500 Hz, through a speaker, and simultaneously record a dual-channel audio sound file using the Bela mini board. However, upon inspecting the recorded signal, I've observed that it doesn't precisely match the 500 Hz frequency. As illustrated in the figure, the peaks of the sine wave exhibit slight shifts over time. This leads me to consider whether the discrepancy is attributed to clock drift between the playing device and the Bela board, given that their clocks may not be synchronized

    A small clock difference between two audio systems with nominally identical sampling rate is surely to be expected. If you cannot tolerate any clock drift, then the simplest solution is to playback and record on the same device. An alternative would be to synchronise the audio bitclock of the two, but that's not straightforward.

    LaserHu Can this integration be accomplished on the Bela mini board,

    yes

    LaserHu are there potential implications for the sample rate or other indices?

    What do you mean?

    LaserHu Any assistance or hints provided would be highly appreciated.

    If you want to play back and record at the same time, try this:

    https://forum.bela.io/d/3905-issues-recording-wav-files-to-bela/23