1. IMPORTANT:
    We launched a new online community and this space is now closed. This community will be available as a read-only resources until further notice.
    JOIN US HERE

How to implement a beat slicer?

Discussion in 'REAKTOR' started by Goofi, Aug 16, 2004.

Thread Status:
Not open for further replies.
  1. Goofi

    Goofi NI Product Owner

    Messages:
    4
    Hi everyone out there,

    I would like to implement a sampler that has beat-slicing capabilities (you know, just like in the BeatSlicer ensemble), but I don't really know how. If somebody could explain the (mathematical) ideas behind it that would be very helpful. I would then try to build one and upload it as generic macro.

    Thanks in advance!

    Yozzari
     
  2. toto le robot

    toto le robot NI Product Owner

    Messages:
    663
    look at the muse in the UL
     
  3. Goofi

    Goofi NI Product Owner

    Messages:
    4
    I took a look at the 'la muse beat' ensemble, but to be honest its sclicing didn't work very good for me. I am looking more for a slicing like ReCycle or BeatSlicer does. I want to detect the single beats of a drum loop. The ReCycle and BeatSlicer both use some kind of sensitvity threshold for it.
    Anyone ideas of the concept/algorithm behind this magic?
     
  4. peterbing

    peterbing NI Product Owner

    Messages:
    123
    that sounds tricky. ni's answer would probably be "buy intakt"...

    just like with fft, my suspicion is that ni has left the low level sampler functions on reaktor somewhat bare to avoid undercutting their sampler line.

    if you were l33t enough you may be able to load a loop into an audio table and work some fancy magic on it that way, but it would be tricky.

    tricky.
     
  5. CList

    CList Moderator

    Messages:
    3,299
    It's very complicated. I did a complete breakdown of the logic in BeatSlicer last fall for an ensemble I was working on that does real-time beat-slicing of audio being written to an audio table.

    Not only do you need to do beat detection, you also need to store the various times in an event table - two values for each "slice" - a start and a length.

    There's no simple answer to doing all of this - as you can tell from the structure of the beat-slicer. At the lowest level, I didn't even understand the whole thing - like the "weighted delta" macro. I know it accumlates the values of the samples every 25 milliseconds, and compares them with the prior value, and does some other stuff that I didn't have to understand to get it to work. Finding the peaks, however, is not really the hard part - it's all the *other stuff* that's tricky. In fact, it's so intimately tied to the whole rest of the instrument that i don't know that a useful "generic macro" could even be made. It would depend a lot on whether the sample was stored in an audio table or a sample-player.

    The Pos output of the sample-player may not refresh fast enough to get good slices, but maybe it'd be OK. You also want the ability to "knudge" the start and end of slices to make then fit better if they aren't right where you want them.

    Have you made many other instruments? If not, I'd say start with something *much* simpler than this.

    Basically if you can't reverse-engineer how JWH did it in the beat-slicer, then you will probably get too bogged down with *any* description of how to do it posted here. Additionally, any description would be almost like writing a book because there's so many different parts to describe (as I've already alluded to).

    I don't want to sound too discouraging, though. I figured out how to get it to work for my application based on JHW's design, but it was not easy. I suggest readin the tips about how to reverse-engineer an instrument here:
    http://www.semaforte.com/reaktor/faq.htm#3.5

    You may find it easier to dissect my structure, as I simplified some stuff from James'. I'd say this is about as close to a generic beat-slice detection macro as you can get:
    http://semaforte.com/reaktor/files/SliceDetect.zip

    - CList
     
  6. selector

    selector NI Product Owner

    Messages:
    101
    Hi

    Can you explain a little of how to connect the different In and Out's...Or an instrument I can have a look at ?

    Friendly
    thomas (new into reaktor)
     
  7. Goofi

    Goofi NI Product Owner

    Messages:
    4
    Thanks for all your answers, especially CList!

    I will certainly have a good look at your macro Mr List! I already dared a short glance and I have to say it looks much more structured. That brings me to a point where I always getting a little bit upset about reaktor: it's so damn bad readable! I mean it is possible to reverse-engineer all the ensembles, but it is much more tedious than understanding (well commented) sourcecode!
    I REALLY wish NI would do something about that, I mean adding features that help structuring the whole stuff a lot more...
    Now back to the 'SliceDetect'-macro...
     
  8. gorgoglionemeister

    gorgoglionemeister Forum Member

    Messages:
    39
    I can be wrong but, according to me, the Beat Slicer processes
    a value every millisecond of the audio file, not a value every 25 milliseconds... In fact, the original audio size is about 3750. The
    Beat Slicer process 3952 events with their relative values...
     
  9. gorgoglionemeister

    gorgoglionemeister Forum Member

    Messages:
    39
    Sorry, the original audio file size (chrome-mono4.wav)is long about 3750 ms...
     
  10. CList

    CList Moderator

    Messages:
    3,299
    Just to make sure we're on the same page, the version I'm looking at - which is NOT BeatSlicer2 from the R5 library, I'm not sure where it's from! says the following in the instrument properties:
    --------------------------------------
    BeatSlicer: creative slicing tool

    Version 2.0

    Instrument: James Walker-Hall
    Documentation: James Walker-Hall
    www.lost-online.com

    Sounds: NI

    www.native-instruments.de
    ---------------------------------------

    Unfortunately, the only copy I have of this instrument is one that I've already modified, so I can't tell if it's the same as yours, and mine seems to be pretty torn up to the point that it doesn;t really work anymore. I don't seem to have my R4 library around anywhere, and I've thrown away my CD.

    Perhaps you could email me your copy (clist@mindspring.com)

    Note that it may *read* more samples than one every 25ms, but 25ms windows are what it looks at to determine if there's a transient - that's the amount of time's worth of audio that gets summed up to determine the average volume for that little slice. Not 100% sure about this, but I do a 25 in your GetAverage macro that you posted a pic of in the other thread (your macro is different from mine).

    Did you try working with the file that I posted the link for (above)?

    Cheers,
    CList
     
  11. kid_sputnik

    kid_sputnik NI Product Owner

    Messages:
    3,552
    Beatslicer 1 comes with Reaktor 4 library. if it is not in Classics, it will be located on the R5 disc.

    Beatslicer 2 has a few macros that are locked by NI. all event stuff. i hear there is a way to unlock these macros (wink), but i also seen, er, heard from an independant source (wink wink) that the innards are not that fascinating.

    i would probably start with CList's version anyways (thanks for that link btw Chris) - James' work is amongst the best Reaktor coding i have ever seen ever, and clean, but often very difficult to decode. Chris' stuff tends to be very well documented and geared towards reuse.
     
  12. kid_sputnik

    kid_sputnik NI Product Owner

    Messages:
    3,552
    also...

    sorry if i missed it, but what is your intended audio source? an audio table, core array, or (possibly) a sample lookup is really your only choice, i dont think you can do this on a normal sampler module in a sane manner.

    i ask because, if you are using an audio table, it would try just modifying beatslicer instead.
     
  13. kid_sputnik

    kid_sputnik NI Product Owner

    Messages:
    3,552
    one more thing:

    if you making a beatslicer with an audio table that records, and you dont have to change any WAV file loaded into the table, you can try a little trick: you can have an audio table and an event table share the same buffer. just save the audio table to a WAV or NTF. then, open an event table and load the same file.

    then, you can read thru nthe table using an iterator, which might help.

    like is said this may not work if you have to change the WAV file in the audio table, but will help for a recorder version.
     
  14. gorgoglionemeister

    gorgoglionemeister Forum Member

    Messages:
    39
    Beat Slicer is located in the R4 library, in the Ensembles\Samplers and Transformers folder.
     
  15. gorgoglionemeister

    gorgoglionemeister Forum Member

    Messages:
    39
    I'm sorry but I don't understand what you mean...
     
  16. kid_sputnik

    kid_sputnik NI Product Owner

    Messages:
    3,552
    sorry, i meant are you planning on recording live audio, or loading WAV files (like beatslicer).
     
  17. gorgoglionemeister

    gorgoglionemeister Forum Member

    Messages:
    39
    Oops, I'm building nothing, I'm only trying to understand how the James Walker-Hall's Beat Slicer works... :D
     
Thread Status:
Not open for further replies.