J. Dvoršak
J. Dvoršak

Reputation: 11

Sound recognition of beep to start and stop recording MP3 stream

I'm trying to make a Python script, that would record local news from internet radio (MP3) stream like this one. The news segment starts and ends whit two different distinct beeps.

Until now, my solution was extremely slow and unoptimized:

  1. Use crontab to start the script (news are brodcasted every hour).
  2. Record the stream for fixed amount of time.
  3. Convert the recording from MP3 to WAV.
  4. Use Pearson correlation on downsampled set of data (for quicker execution) to compare recorded WAV file to WAV file of beep.
  5. Search for the highest Pearson correlation coefficient and calculate the time at which beep occures in the recorded file.
  6. Cut the recorded audio file at the calculated time.

Needless to say that my solution is terrible.

The ideal solution would be to always listen to the stream and start/stop recording only when beeps are heard.

Any idea how I could accomplish that?

PS: When I searched Google almost all articles deal with speech recognition and other use AI classificators (like Tensorflow), which I think is a bit overkill to recognize a simple beep.

Thanks for all hints and/or suggestions.

Upvotes: 1

Views: 578

Answers (0)

Related Questions