Perlin Modulation

Continuing the discussion from Some Sonic Pi Jewels:

Started playing with Matt Tytel’s Vital (pre-release with patchpack through In the Mix on YouTube) and what struck me the most was the use of Perlin noise as modulation. Sure, that’s pretty close to smoothing out a random function… and that’s a neat thing to do.

I started prototyping Perlin-style modulation in a few environments. Eventually, I’d like to make it work as some kind of AUv3 plugin (on iPadOS). For now, I’m exploring several options on the desktop: the Grid in Bitwig, Cycling ‘74 Max and, of course, p5js using tips & tricks from Perlin’s NYU neighbour (and hyper enthusiastic Processing champion) Daniel Shiffman.

Now it’s time for SPi.

In that aforementioned discussion, @minced_mind tweaked a script by @H_Tachibana -san which leveraged Perlin noise to create melodic lines. While that’s obviously very neat, I’m searching for something which would be usable directly as a modulation source, maybe a bit like ramp?
Conceptually, I’m thinking of this as a smoother version of some kind of pseudo-random LFO. In fact, my Bitwig prototype is basically made with that. And it sounds quite cool.

So, any help in building a Perlin modulator would be appreciated.

Thanks, gang!

I added this recently. I’ll dig it out…

https://github.com/sonic-pi-net/sonic-pi/pull/2350 All here I think. Enjoy! Let me know if you have questions

Hi,

I think you can do a perlin noise like function as this:

# Initialize
my_note = rrand_i(note(:C4), note(:B5))
my_old_note = my_note

steps = 4.0

live_loop :perlin_noise do
  random_next = rrand_i(note(:C4), note(:B5))
  my_step = (random_next - my_old_note)/steps

  i = 0

  for i in 1..steps do
      my_note = my_old_note + quantise(i * my_step, 1)
      synth :sine, note: my_note
      sleep 0.5
    end

  my_old_note = my_note
end

It runs smoothly in number of “steps” from the old note to a random new note. You can optimize it through running through a scale instead of a diatonic scale. The quantise makes sure that it’s always a tuned note.
You could even make it more complex through randomizing the sleep value (one of 0.25, 0.5, 1.0).
Hope, this gives you some ideas how to use this.

Cu.