Extra Scripts for MicroTonic by MDK

MDK10 244 views35 posts
  • MDK

    I've created 4 little scripts for MicroTonic, all based on the 'Random Morph' script.

    Download them here :


    To download just click the 'get source' button near the top right and choose an archive.

    They are :

    1. Random Morph Same Pitch

    Same as Random Morph but keeps the Osc and Noise frequencies constant

    1. Micro Random

    Random Morph to create short sounds

    Randomizes unmuted channels only. Attack and Decay parameters are constrained so only short(ish) sounds are generated.
    All channels output to A and no chokes are set.

    1. Clean and Smooth

    No randomizing, just creates a copy of the preset at the right hand morph edge with all distortion and pitch mod removed. Also resets the Noise filter Q to the default.

    1. To Dust

    Again no randomizing, creates a copy of the preset at the right hand morph edge with all attack and decay parameters set to zero. Basically turns the pattern into clicks.

    One thing to note, the behaviour is slightly different to the random morph in that it leaves the morph slider at the right hand edge so you immediately hear the generated preset.

    As for the code, well its nothing exciting, just getting familiar with Pika. I'll re-factor it later.

    Hope you find them as fun to use as I do.

  • Magnus Lidström

    These are great! Thanks for sharing. The Random Morph Same Pitch is more useful than my original Random Morph, and the non-random morph scripts are really clever!

    Nice work.

    If you have any questions or need some help with the scripting language, feel free to ask.

  • MDK

    Thanks Magnus, im having a lot of fun with this scripting. So far im ok with the language, im a programmer so having the other scripts and the reference documentation is more than enough at this stage. I did think of one thing and found out you already put it in (preset.tempo) but this leads me to another question, how is the attack time parameter mapped to the 0..1 range?

    Because I want to create a 'backwardizer' script which sets the attack times to some value related to the current tempo and a 'quantizer' which sets attack and decay times to the nearest 1/16th multiple (1/16, 1/8, 1/4 etc..)

    anyway, I just added another quick one I thought of :


    Set current preset to left edge, right edge is altered to make mainly FM type sounds

    I added it to the zip at the above link.

  • Magnus Lidström

    - MDK wrote:
    how is the attack time parameter mapped to the 0..1 range?

    Unfortunately I used a x * exp(x) formula and realized too late that it was a bad idea because its inverse is an implicit function (product log) that you need to solve numerically. The MicroTonic file / clipboard format is using natural units (like 'ms' and 's') which means that everytime such a file is parsed there is a bit of equation solving going on. :) Extremely basic, but still.

    The exact formula used also depends on the envelope modes.

    I think the best idea is to use the paramValue() and paramText() functions which converts any parameter to and from natural units.

    Because I want to create a 'backwardizer' script which sets the attack times to some value related to the current tempo and a 'quantizer' which sets attack and decay times to the nearest 1/16th multiple (1/16, 1/8, 1/4 etc..)

    Great ideas! Keep us updated.

  • Dennis Harms

    Really nice scripts! Thanks for sharing :)


  • Michael Forshaw

    lovin the new scripts

  • Dave

    really nice... especially liking the micro random

  • MDK

    i've made the backwardizer and quantize scripts, they're added to the zip.


    The backwardizer actually just swaps the attack and decay times for each envelope which generally makes things sound backwards.

    The quantizer sets the envelope times to the nearest 1/16, 1/8, 1/4, 1/2 or whole step (hopefully).

    Magnus, i've got a question / problem relating to passing references to presets into functions. I just cant seem to get it to work.

    I've uploaded a separate archive for you to look at here :


    I've created a script in the resources folder where i'll keep various reusable functions, the one I cant get working is the 'storeAndMorph'.

    If you look in the Quantize Envelopes - NotWorking.pika script you'll see that im declaring the actual quantizing loop as a function which should take a reference to a preset as its only argument. This 'quantizeEnvelopes' function is then passed in to the storeAndMorph function which calls it with a reference to the preset 'p', but inside the quantizeEnvelopes function 'p' isnt p.

    I've done some testing and just cant seem to pass a preset into a function and access it properly. what am I missing? :)

  • Dennis Harms

    Thanks for the new scripts! I love the backwardizer! :)

    One small suggestion: It would be nice if the backwardizer would change the noise envelope shape from modulated to exponential if it's set to modulated.
    It doesn't really sound backwards when it's set to modulated since the "rattle" just gets longer.
    Just a small idea :)

    Thanks again!


  • Magnus Lidström

    Wicked. Will check out the new scripts later. First I'll answer your PikaScript question.

    From a quick glance I'd say that the only thing you need to do is place pr within brackets. Like this:

    [pr].drumPatches[ch]['OscAtk'] = quantize(msecPerStep, 'OscAtk.' # ch, [pr].drumPatches[ch]['OscAtk']);

    In PikaScript you need to explicitly dereference references with brackets, e.g. [ref]. It's similar to how you need to dereference pointers in C with *ptr.

    When you do e.g. '@p' you are actually creating a string that identifies the variable 'p' uniquely. E.g. if 'p' is global the identifier string will be ::P

    When you later do '[pr]' you are telling PikaScript to expand this identifier string, so '[pr].blahblah' might become ::P.blahblah

    Hope you understand.

  • MDK

    yeah i do understand, I'll give it a try now. tbh, I thought that the 'args' library function already de-referenced function parameters. anyway, i'll see what happens.


    yeah, it appears to work now. thanks :D

  • Magnus Lidström

    Cool. The args function can be a little confusing. All it does is taking the caller's arguments, $0 and up and puts them into variables. @ is needed before each variable because we must pass their references. E.g. you need to write args(@a, @b, @c) and not args(a, b, c), otherwise you would just try to pass the values of any existing 'a', 'b' and 'c' to args.

  • MDK

    i've uploaded a major update.

    There are 4 new scripts, the 2 important ones are workflow features for working with my scripts.

    1. Lock Muted

    The Lock Muted script will 'lock' all muted channels so that all the other modifier scripts wont affect those channels.

    1. Unlock All

    Unlock all channels

    So the flow is this :

    1. Mute the channels you want to keep the same
    2. Run 'Lock Muted' (you'll notice they now have a # in front of the name)
    3. Now you can unmute those channels.
    4. Run the other scripts from my set to only modify unlocked channels
    5. Unlock all

    hope that makes sense, give it a try and feel free to ask if you have any questions or suggestions.

    There are 2 new very simple modifier scripts :

    1. Reduce Attack

    gradually reduces attack times

    1. Increase Decay

    gradually increase decay times

    download link is the same one in the first post.

    have fun. :D

  • Markus Zorn

    Love those scripts!

    Thanks for sharing!

  • MDK

    my pleasure :)

    Im now keeping them in a mercurial repository here :


    To download from there just click the 'get source' button near the top right and choose an archive.

  • philter

    hey thx for sharing man, sounds great!! can´t await to test the
    random scripts... btw would it be difficult to make a script that creates
    a new random morph (like the one in the Microtonic Script pack) AND
    automatically Save the 2 Morph Values as 2 indivividual Preset Files? :P

  • Michael Forshaw

    hey mdk, great new scripts.

    but i'm getting an error message wi the 'lock muted' script

    the operation could not be performed due to the error:
    script error: invalid lvalue.

    i'm using ableton 8 on windows 7, lenovo thinkpad t410

  • MDK

    ok, i'll check what i uploaded. i've got the same setup as you. ableton 8, win 7. shouldnt make a difference though :)

  • MDK

    i've just pushed an update here : https://bitbucket.org/marvotron/mdk-microtonic-scripts

    give it a try.

  • Michael Forshaw

    aye, it works now.
    only on your scripts, not the magnus scripts.
    it's a cracking script, really handy, cheers mdk :)

  • Riccardo Trost

    Awesome! Thank you Martin!

  • MDK

    you're welcome :)

    btw, Magnus, maybe you can change the thread title to something like 'Extra scripts for microtonic' as there are more than 4 now.

  • Billy Bowers

    I can’t quite figure out the scripts. If I try and download them I only get the HTML file link. If I click on the name I see the script, but copying and pasting to a txt file hasn’t worked either.

  • MDK

    looks like bitbucket have complicated their download process.

    go to this page

    then click 'tags' and select zip on the entry for 'tip'

    that should do it.

  • Billy Bowers

    That worked, thanks so much for that.

  • timbralzoom

    Thank you so much!!

  • nic

    many thanx :-)

  • philter

    thx a lot for sharing ! some really great scripts :)

  • konfront tama

    I've downloaded but haven't been able to use the scripts. i keep getting an dialog saying that there was an error in opening the file. any suggestions>?

  • Technobox


    I moved all the scripts to the right directory. The scripts from Magnus work, but your scripts making an error. I do have Cubase 7.5/Windows 7

    The operation could not be performed due to the error:

    Script error: Undefined: 'html'.

    Maybe someone can help me?

    Best regards,


  • Muffin

    hey MDK, can you share these again? would love to check them out.

  • David ___

    Second this, would love to try them out.

  • Ole Kristian Krogstad

    me too

  • Design Alpha

    Thanks for sharing the nice Tips.

  • Karschnackelwackel

    - Ole Kristian Krogstad wrote:
    me too
    - David wrote:
    Second this, would love to try them out.
    - Muffin wrote:
    hey MDK, can you share these again? would love to check them out.

    this link from above is still working: http://relivethefuture.com/music/MDK_MicroTonic_Scripts.zip
    thanks MDK for the useful scripts!

You need to be to post a reply

Sign In / Sign Up

First time here? Just enter your current email and sign up.
Facebook sign in no longer available. Use the same email to set password and access your account. If you need help, contact us.