marin-m / SongRec

An open-source Shazam client for Linux, written in Rust.
GNU General Public License v3.0
1.34k stars 101 forks source link

calling from python with chunks of sets #11

Open LeanderK opened 3 years ago

LeanderK commented 3 years ago

Great Project!

I want to use this to get the ids of track from sets. So let's say I have the audio file of a set, how would I approach it? I would like to have something like a sliding window over the set and use songrec on each window so that I get the time-stamps where the songs change.

I would write a small python scripts which calls SongRec (I don't know any rust).

Does this code just take the raw 12s PCM signals of the middle of the song and return it? Does the algorithm always expect 12s of pcm-data?

https://github.com/marin-m/SongRec/blob/59246d69648032dc4f5817eb3575e550f22d65fc/src/fingerprinting/algorithm.rs#L37

marin-m commented 3 years ago

Hello,

I took the approach of extracting 12-second samples out of the middle of files/out of the recent microphone input because it seemed to be a value that provided very good results compared to shorter window sizes, without taking too much processing time.

The core algorithm may look for for frequency peaks over any amount of spectrogram, but if you put more audio into it obviously it will take longer (it performs sliding Fourier transforms over fixed intervals).

Regards,

LeanderK commented 3 years ago

ok, then I think I will just experimentally decide how long the samples should be and how fast I should slide the window over. I just noticed I wasn't clear, I was talking about DJ-Sets. So I have 2/3 hours long of music and I want to find every song in the set. I'll just try, thanks!

sebbean commented 5 months ago

ok, then I think I will just experimentally decide how long the samples should be and how fast I should slide the window over. I just noticed I wasn't clear, I was talking about DJ-Sets. So I have 2/3 hours long of music and I want to find every song in the set. I'll just try, thanks!

Would love to know if you've accomplished this!

Doing the same myself

youtube.com/@beanradio