简体   繁体   中英

python extract songs from radio streaming

My task is to extract full songs from radio streaming using python 2.7. I have managed to record radio streaming, but I can't find a good way to detect if the audio that I record is music, ads, or just talking. I tried to detect by threshold, but it wasn't good because there are not enough silence between the talking or the ads to the songs. If someone knows a good solution for me I would love to hear about it.

import pydub streamAudio = pydub.AudioSegment.from_mp3("justRadioStream.mp3") listMp3 = pydub.silence.detect_silence(streamAudio, min_silence_len=400, silence_thresh=-38) print listMp3

I tried to play with the min_silence_len and silence_thresh, but there is not enough time of silence between songs and ads or talking, or louder voice to detect properly

thanks a lot!

This is not the kind of problem that will be solved in a couple of lines of Python. The problem is under-specified - there's no guarantee that there will even be silence between songs, ads and announcers on any given radio stream, as they try to make it harder to usefully record full songs from their streams for piracy purposes.

To do this robustly, it's likely that you'll need to apply AI / deep learning techniques to distinguish music from ads and announcements. Even then it's tricky, as some music will have regular talking in it, some songs are short, and some ads are long and contain music.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM