r/pythonhelp • • Mar 17 '22

Program that matches the BPM of two audio files with Dynamic Time Warping

Hello,

I have been trying to execute the program detailed in this thread to no avail. I was wondering if another feasible method exists to:

  • Input two songs

  • Calculate the bpm of each one (down to the induvidual beat, not an average)

  • Match the BPM of both audio files with Dynamic Time Warping

  • Output the two audio files now with identical BPMs

If you know of one or how I would write one, let me know. Thanks

2 Upvotes

4 comments sorted by

1

u/throwaway8u3sH0 Mar 17 '22

Maybe this?

It looks like that's pretty close to what you're going for, so I'd start with that code -- get it working exactly as they show it and with their example music -- then modify it for your purposes.

1

u/B3nthony Mar 17 '22

I've tried that but I don't see that it actually outputs any audio files. How would I go about modifying it?

1

u/throwaway8u3sH0 Mar 17 '22

Read the docs. Librosa uses soundfile under the hood, so you can make it write out with that.

This means:

  • get it working with no modifications (don't skip this step! Extremely important!)

  • swap out librosa.load with a call to soundfile. Make sure it still works.

  • add a call using soundfile.write

Make small changes each time. Keep it working and use version control (ie: git) so you don't lose your progress.

1

u/B3nthony Mar 17 '22

Ok, I'll check this out, thanks