kickandsnare script for MaliceX

Official support for: audjoo.com
Post Reply New Topic
RELATED
PRODUCTS

Post

this post refers to
http://michu.kofeina.net/kickandsnare04.zip
and tries to explain how it works.
it was written with an assumption that it will be run with rate set to 1/16.

first, there is a bunch of set opcodes, just initializing variables . helix' virtual machine generally allows only variables and labels to be used as arguments, eg. if one wants to use .666 to multiply something it should be declared as $satan variable or something.
among other things there is a counter setup. the counter is supposed to count from 0 to 31. it makes 32 steps ie 2 bars.
also notable is $chaos variable. this is kind of a seed value for a quasi-random function that makes stuff a bit less predictable. it can take any value in 0..1 range and changing it will make beats a bit different for the same note input.
let's skip the rest for now.

the initialization part is supposed to be run only once so there is a @loop label after that marking a point where the script should return for next iteration.

then there is a check if it is 1st beat in a bar (downbeat). it is done by copying counter value to a variable and perfoming modulo 16 on it. if the value returned is zero the kick will be played.

then there is a check if it is a 2nd or 4th beat (upbeat) where we want a snare.
this is done by copying counter value to a variable adding 4 to it and the doing modulo 8. if the value returned is 0 the snare will be played.

so a kick on 1 and a snare on 2 and 4 are there for sure.

for other steps in a bar there is decision process if the script should play something or leave the step mute. it involves variables i called $density, $ramping, $tension and $chaos. if the sum of this variables is >.5 a hit (for now undetermined) will be played.
$density is created by getting highest note pressed, performing mod12 on it to make sure the value is in 0..11 range regardless of the octave used and scaling it down.
$ramping is created by scaling down a current counter value so we get a 2 bars ramp of increasing hit probability creating a kind of a phraze.
$tension is a variable that gets zeroed if something was played and increased if not. the script wants to hit something and gets itchy if it doesn't for a few steps ;)
$chaos is a quasi-random function axmod1. a can be either pi or phi depending if something was played. i like irrational numbers.

so if script decides to play something on a given step it has to decide if it should be a kick or a snare.
variables involved are $balance, $isevenincentive and $lastplayed. if sum of them is >.5 the kick will be played.
$balance is initialized at .49, is increased with each snare played and decreased with each kick. it tries to ensure that more or less the same number of kicks and snares will be played in a longer run.
$isevenincentive is added if the step is even ie an 1/8 note. this increases probablity of kick.
$lastplayed is set to zero if a kick was played, to hit velocity on a snare and is halved on each mute step. it prevents snare machineguns.

in the end we have parts which actually play (or not) given hit, perform operations for $tension, $lastplayed and $chaos, increment and eventually reset $counter and go back to @loop.

hopefully it makes a tiny bit of sense now :help:
"Dont mistake your inability to understand how this happens for it actualy being imposible. " - nollock

Post

Well it's most certainly quite a mouthful, but thanks for explaining their functions in full detail.

I suppose the real way to find out properly is to reference, edit and execute. Heh. (I'm no coder, yet.)

Regards.

Post Reply

Return to “Audjoo”