Techniques for subdividing time recursively

Off and on with different coded music environments (SC, Overtone and SP) I’ve enjoyed the challenge of unrolling time linearly whilst from my music background I treat time more as a constraint satisfaction problem with recursive subdivisions: however many notes might be in the fill, you still have to nail the downbeat on the next measure, etc, and when I’m playing a physical instrument, I either feel the downbeat coming and hit or I don’t and miss. With SP, I always calculating times which correspond to the layout in time.

This reminds me of the GUI layout problem: in old school GUI toolkits you have to figure out absolute positions in pixels by hand, while with something Qt you specify the layout as a tree and the toolkit figures out the mapping to pixels.

Not to knock the nice surprises that come from letting go of the downbeat :smiley: but I wanted to try to get closer to how I feel time when playing e.g. jazz bass or percussion, and I was trying to find techniques to express something like a variable fill or ornamentation (with some probability) without having to explicitly compute the time intervals or worry about missing the downbeat:

The only thing I’ve come up with is to express note probabilities over the measure (or interval of interest, like a 4 measure line) and then evaluate the probability at every grid point. Since the probability can be expressed as a set of basis functions, one can choose radial basis functions or Fourier series to do different things. Here’s an example with just two basis functions (cosines)

use_bpm 90
nt = 16
live_loop :perc do
  sample :bd_fat
  nt.times do
    t = tick/(1.0*nt)
    b1 = Math.cos(t*8*6.28)
    b2 = -Math.cos(t*6.28)
    prob = Math.sqrt(Math.exp(b1 + b2))
    sample :drum_cymbal_closed, amp: prob if prob > rrand(0.5,1.5)
    sleep 0.125
  end
end

I could imagine other algorithms based on trees or something more interesting, so I’d thought I’d ask around… any other cool ideas?

edit disclosure, I chose the basis functions using python snippet & plot like this:

2 Likes

Have you played with time_warp at all? It lets you do stuff in its own time bubble before rolling back time as if nothing had happened.

live_loop :foo do
  #thing to do on the down beat
  sample :bd_fat

  time_warp do
    # do all your random probabilistic stuff in here. 
    16.times do
      t = tick/(1.0*nt)
      b1 = Math.cos(t*8*6.28)
      b2 = -Math.cos(t*6.28)
      prob = Math.sqrt(Math.exp(b1 + b2))
      sample :drum_cymbal_closed, amp: prob if prob > rrand(0.5,1.5)
      sleep 0.125
    end
  end

  # time is now as if the time_warp didn't happen

  sleep 2
end
2 Likes

Ah from a quick read in the docs I thought this function just shifted time, I didn’t see that one can execute code inside with a rollback, kind of like a temporal transaction. Thanks for the tip, I’ll definitely play with this!