Fluid(Buf)OnsetSlice: calculating time between impulses?

Hello all,

i was wondering whether it’d be possible to obtain the length between two impulses that demarcate Onsets? Would it be possible for example to create an envelope that corresponds to that length?


It is indeed but I wonder what is your environment? Pd Max or SuperCollider?

Sorry, forgot to mention it is supercollider!:slight_smile:

Another question: the difference between the buf version and the live version of onset is quite something.

  1. if buf, I’d use buffer.getToFloatArray (for a small buffer of less than 1000 onsets) and get the buffer sampling rate. The language is very well equiped then to do differential between consecutive items.
  2. if in RT then you can use the clicks as triggers on a clock.

I hope this helps?

Thanks, it already does help!
What i was trying to figure is, given the usage case in RT, what UGens could receive the Onset triggers in a way as to make possible the envelope synchronization (closing it before a new trigger is received)?

The problem you have in your idea is that you’ll always be late. One cannot close an envelop before knowing it has to be closed. there are 2 ways forward for you:

  1. latency: you induce the delay in the signal that will be the length of the closing envelop. as soon as you get a click, you close it (and potentially change voice). This is the way I do delays changing lengths without pitch shifting (2 delays in parallel, only one working at a time, the other changing length once it is faded out)

  2. making an envelop from the last 2 attacks. that is not hard (using a trigger to take a snapshot of a counter that is reset with the same trigger) but has the conceptual problem of expecting the future to be like the past… for a steady beat with steady detection (neither of which are trivial) that is not a problem but it is a very rare situation in music technology: syncopation and groove move around and algo detection of attacks might miss some… but it is still fun to try :slight_smile:

I see, yes the aspect of predictability is what i was trying to get around:) I am actually working with NRT, still im using the RT Onset Detector aswell to avoid analysis… The latency inducing seems quite promising ill try that!
What you mentioned regarding the buf version would be to get the “difference” between each sampled value as a length estimation, if i understood right?

yes. so you import the buffer of indicies in the language and from then you get an array which you can request the pairwise subtraction (check the differentiate method) and then divide by the sampling rate to know in seconds.

Ok i see, thank you!!