0

I've been searching for a long time but came up with nothing that actually worked.
The idea is that I have a music mix (mostly .mp3) of which I'm trying to make the tracklist using pyechonest to identify the tracks. However this will only identify single tracks (correct me if I'm wrong), so I would like to have another module that could split up the mix in it's seperate tracks.

I looked into pydub for audio splitting, but having troubles with the detection still.

Thanks in advance.

Edit: So, I found a way to cut the files, but now pyechonest is returning the name of the podcast instead of tracknames it self, my code (for say 5 parts):

>>> from pyechonest import track
>>> resultlist = []
>>> path = "C:\\WinPython\\OwnScripts\\Convert"
>>> for i in range(0, 5, 1):
       #for file parts I tried 25-30 second long, 128k mp3 and wav
...    filename = path+"\\unleashed16_part"+str(i+1)+".wav"
...    resultlist.append(track.track_from_filename(filename))
>>> resultlist
[<track - 001 Digital Punk - Unleashed>, <track - 001 Digital Punk - Unleashed>, <track - 001 Digital Punk - Unleashed>, <track - 001 Digital Punk - Unleashed>, <track - Defqon.1 2013 Continuous mix by Frontliner>]

Clearly not what I want... Is there any way to force echonest to not look into podcasts, or to return multiple possibilities or something like that?

CounterFlame
  • 1,612
  • 21
  • 31
  • I think you can break up the mix into 30 s or 1 min segments (i.e. audio[startsample:endsample]), then use echonest identify method on each part, then remove repeated track ID returns. – dpwe Jun 22 '14 at 16:52
  • Hmm yes, I did think about that, but the problem is the standard echonest API only allows for 20 calls/minute, which I'm afraid would give problems if I cut 'm in those parts. That's why I thought it would be best to first identify different tracks, and then cut parts out. If that isn't possible, I guess I am forced to use your idea yes. – CounterFlame Jun 23 '14 at 13:12

1 Answers1

0

If you can set a reasonable minimum song length, you can use CounterFlame's idea without sending every second of audio to their API.

For instance if you know the shortest song is at least 3 minutes you can send a 30 second chunk every 2 minutes to echo nest

 14 minutes: ("=" is 15 seconds)
|===|===|===|===|===|===|===|===|===|===|===|===|===|
 song 1 (3:00)   song 2 (5:15)     song 3 (4:30)
|============|====================|=================|
 ^^        ^^        ^^        ^^        ^^        ^^   <-- send these chunks

the math works like this:

# everything in seconds
minimum_song_length = 3 * 60

chunk_size_to_send = 30

throw_away_between_chunks = minimum_song_length - (2 * chunk_size_to_send)

basically you want the shortest song to have 2 chunks sent to be identified so that at least one will not overlap the song before/after

Jiaaro
  • 74,485
  • 42
  • 169
  • 190
  • Okay thanks, I did decide to write my own ffmpeg wrapper, as I had serious memory issues loading pydub's audio, so switched to command line to cut the audio files. Now I do have the problem that echonest quite often returns the name of the podcast instead of the trackname itself, any idea how to circumvent this? I updated my post how I send it to echonest. – CounterFlame Jun 26 '14 at 12:00