0

I have been using sd.playrec() to play and record a sine-sweep in a room at the same time. This happens as part of a python script. However, there is a delay between when the recording starts, and when the sine-sweep starts playing. This delay is around 13000 samples, or a quarter of a second at 48kHz. For my purposes, I need the recording and the playing of the audio to be synchronized.

Is there any way around this? Another python package that might do better? A way to solve this delay?

Thanks.

Mason Wang
  • 165
  • 1
  • 9
  • start recording first, then play? – dankal444 Apr 13 '23 at 09:22
  • also, you can check `blocksize` parameter, by default its 2048 (lower it to 512?), but it will not change the delay by much compared to starting 13000 – dankal444 Apr 13 '23 at 09:30
  • Ok, but how do I know when "play" is hit? – Mason Wang Apr 13 '23 at 20:26
  • That will be more difficult. If you wanna measure room response, you will need some kind of calibration. There always will be some delay due to audio card, speakers, mic, etc. What you could try is put mic next to speaker and check if this delay is constant. If it is, just subtract it. Note I studied acoustics 10 years ago and maybe missing something important. – dankal444 Apr 13 '23 at 21:07
  • I think the way to go is measure response of your whole audio track impulse response (pc, card, speakers, mic, card, pc) in some anechoic chamber and use this as calibration. It is important to have good audio card and pc software to have repeatable measurements (minimize randomness). – dankal444 Apr 13 '23 at 21:10
  • I suppose it's ok to have some delay, but we just need to know how to correct for it so that the recorded files are lined up. – Mason Wang Apr 14 '23 at 03:40

0 Answers0