Messing with Modulation--randomly moving velocity threshold

#Messing with Modulation–randomly moving velocity threshold

I made a couple of modules to try adding some controlled variability to a looping midi note stream by creating a slow moving, sinusoidal modulation signal (aka LFO) that runs from the minimum to maximum velocity recorded in the loop, then use that signal as a threshold to determine which samples to pass along for playback. I added some logic to pass to a separate output the excluded samples for play using a different voice or synth module.

Some variability comes from the nominal LFO rhythm beating against the loop’s rhythm. Additional variability comes by randomly varying the period of the LFO at the end of each cycle. Nominal LFO period and center-weighted random noise is set by the Jittery Knob Simulator module.

White Key Scale Module DEMO 10.audulus (2.2 MB)

I added these modules to my White Key Scale player project, which defaults in scale play mode, where the black keys control five switches. The player uses the “it’s a trap!” drum kit. The three triggers on the left are pads for the kit. Change key by switching to chromatic mode with the button, hitting any key (it plays in the proper tone), then putting it back in scale play mode.

To start, hit a Bb on the MIDI keyboard to pass the clock from the BPM box to the tap tempo box. Once it’s up to tempo, hit Eb to turn on loop recording then start playing, using a mix of velocities. The player is set as uploaded with a minor pentatonic scale selected.

The Autoranging Threshold Modulator (for lack of a better name!) finds the highest and lowest velocity in input gate pulses and then transforms a varying +/- 1 LFO signal to vary between those two values.

Frequency Jumping LFO. The LFO in this case is a sinusoidal waveform with frequency divided from the master BPM clock, and which randomly varies each cycle over a pre-set range, and scaling the tails of the distribution to avoid pileups at zero or one when you’ve set your variability bigger than the distance to that rail.

Pulses louder than the threshold at that moment are passed to output (and corresponding octave signal is latched), and those softer are passed to the “rejected” output.

The frequency divider knob values (the module uses the standard Audulus library freq divider module) for the LFO are generated by the “Jittery Knob Simulator” module on the left that generates random “knob” values, with a “nominal” knob, and a “variability” knob. Random distribution is made approximately Gaussian by passing it to a STS Normal Distribution module, setting std deviation to equal one third of the dialed in variability. The noise signal is then applied to the 0-1 value set by the nominal knob.

Here’s a picture of the whole (unholy) mess:


You might be interested in this: Normal Distribution (Bell Curve) It uses the Box-Muller algorithm to produce an approximation to a normal distribution with a given standard deviation and mean.


I can’t believe that I looked everywhere but right here for it! Thanks!

Just dropped it in, setting my variability to equal 3 standard deviations and losing that 3rd knob!

See edited initial post!


I finally got a drum machine! Love this little thing (Korg Volca Beats). I’m using my audio trigger detector to set the tempo from the audio output of the Korg. It would be better if I did it another way, such as by analyzing the sync signal from the Korg (probably stepped-down or current-limited, and capacitively coupled). Don’t want to fry my iMac or interface audio input.

The Audulus setup is the White Key Scale Player, sans the drum loops. The white key module UI shrunk, but the module functionality is unchanged. Keyboard MIDI channel is 16. The LFO that produced the scaled threshold signal is further divided to produce an even slower LFO. The second LFO outputs is used to randomly sweep certain synth parameters to add some variability. You’ll notice that “pulse above threshold” synth’s decay parameter is modified by the first LFO that produces the pulse output, so that when the threshold is high and there are fewer neighboring pulses, the synth has longer decay.

Oh, and the 2nd loop generator is no longer the modified res drum.

Google Photos

This cruddy video shows the little beast in action, and demonstrates that I can’t hold a phone and do a simple pattern on the keyboard!


Oh dang! I forgot to hook up the regular BPM generator for other folks to try first! This rev does that.

[White Key Scale Player - Tones Only 02.audulus (1.5 MB) ](http://)

AND, I just changed the midi keyboard back to OMNI.

As before, hit any Bb key to apply the tempo to the clock generator. Hit Eb to start recording and C# to apply the custom (push button) scale.


I thought the video was great!

1 Like

Great track!


Yeah I also really enjoyed this. The sounds you got were a cut above.


Thanks for the nice feedback! I tried another idea. I wanted random intervals off the stored loop tones, in scale and in key, distributed around a center interval that I set. I used my quantizer and jittery knob simulator, which approximates a normal distribution around a mean (the set center interval).

Any G# key now toggles on or off the random interval part. Another video, this one uses the blues scale (#14 on the selector), in the key of C.

I also ran the sync out from the Volca Beats into an old USB capture box ands used that to feed the tone loop clock gen.

White Key Scale Player - Tones Only 01.audulus (1.6 MB)


This is pretty dope! Great job on that beat! How long did it take you to put this whole thing together? I aspire to greatness like this, but my ability to focus and attention to detail spreads out and becomes less and less effective at further distances. It’s kinda like if you gave a long distance competition target shooter a shotgun and said, “here, go win the olympic decathlon (is that still a thing?) with this. Gold is the only acceptable medal…” :face_with_symbols_over_mouth::rofl:


Thx for the nice comments! I’ve been working with Audulus for a couple of years, and before that I’ve used other programming/scripting languages for projects in other fields. I roll a lot of my own modules mainly because I love the challenge, and I feel I learn more along the way. If I have a project in mind, I’ll put together a block diagram or truth tables or whatever I’ll need, then set off making any new modules as general purpose as I can, so I can reuse them later.
In this project the only really new thing was remapping the midi keyboard. Everything else was me either reusing my own modules or other peoples’ modules (esp synths or drum machines).
It makes what looks super daunting much more doable, at least for me.

That actually loops really well.

1 Like

That was pure luck-o-the-loop!


I added a second randomizer to run my modified Res Drum-based synth, and a feature that adds the interval and octave you’re playing to the the upper and lower randomizers.

F# adds that feature to the randomizers and G# continues to enable the randomizers (as before, you set the nominal interval you want to hear off the loop tone, and the variability you want from that mean value).

In this setup, the lower loop synth gets the straight loop tones, while the upper loop synth and the ResDrum+ synths can play the random interval shifted versions.

White Key Scale Player - Tones Only 03.audulus (1.9 MB)

The “Spot Quants” now have an interval and octave input to allow the random pattern (random but in-scale) to track what’s being played on the keyboard. The White Key module now has an octave output—tapping the existing internal functionality of the module—to feed the SpotQuants.

So, yeah…I made another video. Kind of “songified” it a little.


Sorry about the awful sound quality! It sounds like it was recorded in a barrel tuned to C below A440! Yuck! My little iPad speakers must have a huge notch right there.


If you have AUM and the CPU will handle it, you could use IAA from Audulus to AUM and use AUM to record the output.


Thanks! I’ll try that later and maybe re-record.

1 Like

I think you could actually screen capture using the built-in screen capture as well, for that lovely light show, as well.


Right. I didn’t think of that. Does it do audio with the screen capture?


Screen recording captures audio out, at the very least with “simple” apps like WhatsApp. No idea how AUM or other more complicated audio routing would interact with it. My guess is that if audio is going to the system default out, it should be captured.