相关文章推荐
聪明伶俐的大象  ·  Notify Update·  4 月前    · 
要出家的鞭炮  ·  Uncaught ...·  8 月前    · 
冲动的香槟  ·  reactjs - Typescript ...·  1 年前    · 
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

Want to improve this question? Update the question so it focuses on one problem only by editing this post .

Closed 4 years ago .

i'am looking for a way to attune a song to the heart rate of someone. I have a song in mp3 or wav format and i want to accelerate the speed of it while playing it. Or playing it in loop and between each loop accelerate it or slow it. Ideally it will be in python. Do you know a way to do that ?

Regards and thanks.

Bussiere

Wow... how do you even get the BPM for a song in MP3/WAV? That alone sounds non-trivial, unless you've found a library that does that already. Maybe if it's in an ID3 tag you could do it... Other than that I think this would be a lot easier if your program was also generating the music. FrustratedWithFormsDesigner Oct 26, 2010 at 14:13

There are a few different pieces here, each of which needs to be solved. None of them are trivial and require a decent amount of signal processing knowledge, so you'll probably want to look for libraries to handle that part of the heavy lifting.

  • Cardiac beat detection . This is outside my area of knowledge, but let's assume that you can access this somehow.

  • Music beat detection There are several libraries available for this, both commercial and open source. You may want to look at http://aubio.org/ -- it already has python bindings available.

  • Tempo Change -- Once you know the target BPM and the current BPM, you need another library that can be used to change the tempo of your audio track to match (without changing the pitch). A few to look at are Rubber Band and SoundTouch

  • Googling will find other libraries for these manipulations (and other pieces that you'll need, something like PyMedia to open and playback the sounds, etc.)

    maybe one piece of software that can allow you to control the tempo of some ongoing audio using another input is "Puredata" --

    It is a very complete, although complicated, node based software aimed to deal with various multimidia transformations from visual node connections - but it can also be programed through a Python API

    http://crca.ucsd.edu/~msp/Pd_documentation/index.htm

    Python bindings:

    http://mccormick.cx/projects/PyPd/