Has anyone figured out a way to do BPM/Tempo detection of loops in Reaktor?

Options

Title asks the question...


I'm working on a beat slicer looper type system where I need to know the BPM of the original sample so I can use that to calculate some ratios that relate to playback speed and time.


I don't know of anyway to make reaktor scan a sample on import and do tempo detection on the loop.


I looked inside of the factory beat looper macro and it doesn't quite have what I need, any ideas?

«13

Comments

  • Sunborn
    Sunborn NKS User Library Mod Posts: 2,602 mod
    Options

    If you have Traktor, load your samples there and analyze them, it will find you the exact BPM.

    If you don't, then most DAWs have some kind of BPM calculator.

    Otherwise, you can find a lot of BPM calculators online, most of them are free. Below, is just a random one (from Google search)


  • Michael O'Hagan
    Michael O'Hagan Member Posts: 98 Helper
    Options

    I really want to have tempo detection in reaktor, it has to do with how the beat looper works and some new add on features I'm working on.

  • Studiowaves
    Studiowaves Member Posts: 478 Advisor
    edited January 2023
    Options

    Check the midi library, it's easy to calculate the current tempo. I've done it several times over. Unless your using a wave file with or something. I have a tempo tap finder too, it works by ear ,, just tap to the music. It's easy, make a sample ramp that resets when you tape. Grab the current ramp value when a button is pressed and do the math to find the tempo. Then reset the sample ramp, easy as pie. Also rig it so the ramp doesn't self start and holds at zero samples until your first tap. If you do that, it makes it easy to average your tap readings once you start tapping. I use it to find the tempo of a song for setting the daw tempo. Same principles apply if your analyzing a wave file. Sensing the beat of something to replace the button might be a problem if you need to do it in real time though.

  • colB
    colB Member Posts: 864 Guru
    Options

    Google autocorrelation tempo detection. Autocorrelation seems a likely option combined with some sort of envelope follower.

    Basically you compare (envelope of?) the audio data with a shifted version of itself. With a steady beat, the strongest correlation will be when the offset is some integer multiple of the tempo. Then you can probably discard the crazy fast or crazy slow results...

    Maybe with some sort of binary search mechanism...

    there will be papers out there to research with all sorts of tricks and optimisations. Please post your results ;)

    Not going to be 'easy'. Implementation and tuning will likely be tricky in Reaktor.

    Might be sensible to use partials framework iteration system for something like this...

  • Michael O'Hagan
    Michael O'Hagan Member Posts: 98 Helper
    Options


    It's intended to be used with pre recorded loops as a part of a time stretching sample player built on the beat looper factory macro.


    It works about %70 of the time right now based on sample rate and sample length to average and estimate the number of bars in a loop, but at slower tempos it gets it wrong.


    4 bar loop at 90BPM shows 4 bars, 4 bar loop at 60BPM shows 8 bars at 120BPM, so I'm trying to find ways to improve it's accuracy.

  • Michael O'Hagan
    Michael O'Hagan Member Posts: 98 Helper
    Options
  • colB
    colB Member Posts: 864 Guru
    edited January 2023
    Options

    Another thing might be to envelope follow then downsample a lot, then use a long fft... but not tell the fft that the data is downsampled. .. then decode/select the loudest frequency... then scale that to get the tempo. That might get you in a good ballpark to make the auto correlation quicker... dunno... might even be an alternative...

  • Studiowaves
    Studiowaves Member Posts: 478 Advisor
    Options

    I don't know Michael, but I think the loops already have a time length. If this is one of those deals that time stretch a loop and try to keep the pitch the same then use the loop times for your tempo. It sure beats trying to detect amplitudes of the sounds in the loop and converting that into a tempo. Just use the new length of the loop itself to determine the new tempo.

  • Studiowaves
    Studiowaves Member Posts: 478 Advisor
    Options

    Michael, do they tell you the length of the loops? Are you aware of the song position pointer?

  • Michael O'Hagan
    Michael O'Hagan Member Posts: 98 Helper
    Options

    What do you mean that loops already have a time length?

  • Studiowaves
    Studiowaves Member Posts: 478 Advisor
    Options

    Well, they're loops aren't they. So the play for a certain amount of time then start over. If you know the length of time you can calculate the tempo. One beat per second is tempo of 60 beats per minuter. So if the loop last for one second before looping it's tempo is 60. Maybe a loop last for 4 seconds, So is it still a tempo of 60? Maybe, if the loop is four beats long. Seems to me loops should already have a tempo and the number of beats included with the loop meta data.

  • Michael O'Hagan
    Michael O'Hagan Member Posts: 98 Helper
    Options

    I already does that but it's not a perfect method, 4 seconds can be 4 beats at 60 bpm or 8 at 120, not it's just not a precise enough approach.

  • colB
    colB Member Posts: 864 Guru
    Options

    hmm... that's going to be tricky. Depending on the feel, where the kick is, double time... whatever. To be 100% accurate, you would maybe need to create an AI and teach it to recognise genre, then get into arguments with it when it still gets it wrong... at least in your opinion ;)

  • Paule
    Paule Member Posts: 1,327 Expert
    edited January 2023
    Options

    Here is an online Automatic BPM Detector

    Analyzes the tempo of your files locally without sending them to a remote server.

    ---

    In my small daw MMM is an analyzer also.

    ---

    Or BRP Detector - Audioalter:


  • Studiowaves
    Studiowaves Member Posts: 478 Advisor
    Options

    Is there any meta data on those loops? Maybe convert the loop file into a text file and read it. They way I see it, it almost has to be there in order to be imported into different tempo's. I know Chet Singer said he once imported wave files but had to strip off the header. I'm pretty sure he imported them into a read only memory module and not the reactor player. Perhaps you should take his approach and do the same. It will give you precise control, you'll be able to calculate the tempo too. However as I said before, sadly I don't have a clue what you are trying to do. Can you help me out here. The only beat slicer I know of is some video game that throws balls or something at your sword and when you chop em they make some wild sound. A lot of people really like that game but being a musician I don't think it would be very impressive. Believe me, I'd like to help out but without knowing what you're doing it's impossible. I do feel there's a better approach. Are you simply trying to find the tempo of a loop? If so, just play it and while it loops tap a button in time with it. Average the time between taps and you get your tempo. I doubt making a tap tempo in core will be difficult. It's possible your daw already has one.

Back To Top