Sevish Music

How to play microtonal scales on a Max/MSP synth

Those of you who have built synths in Max/MSP or Max 4 Live will have used the mtof (MIDI-to-frequency) object. This clever little object waits for you to send it a MIDI note number (0-127), then it spits out a frequency (Hz). Perfect if you’re working within the confines of 12-tone equal temperament—or rather limiting if you wish to use all kinds of expressive intonation systems outside of the Western common practice.

A simple sine wave generator using mtof: MIDI to frequency

There is a very simple way to get microtonal scales out of your Max/MSP synths. We simply replace the mtof object with coll.

The coll object

 

What is the coll object, anyway?

Coll can be used to store and edit collections of data. The data is stored in a text file. Each item of data contains an index followed by some content. For example, we could use coll to remember the release years for various killer synths.

Example of coll's use

Above, the coll object is waiting to receive an index (either YamahaDX7 or Theremin) before it spits out the data we want. I just clicked the “YamahaDX7” button, so “1983” was sent via the first outlet of coll.

To see and edit all the data inside the coll, just double-click on the coll object. It will bring up the data entry window. Here’s what’s inside the above coll object:

OndesMartenot, 1928;
RolandTB-303, 1982;
Theremin, 1920;
YamahaDX7, 1983;

Neat trick. Mind you it’s not very useful for our goal of exploring crazy scales.

Here’s how we can use coll as a replacement for mtof. First we need to understand our data structure. We send a MIDI note number (0-127) to the coll object. We want coll to spit out a frequency in Hz. So we double click coll, and we start inputting data for what frequency corresponds to what MIDI note number.

# Lines that start with a # symbol are comments.
# This is a simple scale which starts at 100 Hz on MIDI note 0.
0, 100.0;
1, 200.0;
2, 300.0;
3, 400.0;
4, 500.0;
5, 600.0;
6, 700.0;

...

127, 12800.0;

(Interesting note: This scale is a harmonic series with a fundamental of 100Hz. Kinda trippy if you’ve never heard this kind of scale before, so try it out).

To test this out, let’s send the number 0 to the coll. This is the lowest possible MIDI note number, and according to our data we should receive the float value 100.0 from coll’s first outlet.

Testing the coll object

A success! It’s pretty simple to get it to work, but the only problem is that the tuning data took us a looooong time to type… 128 lines in total! Luckily coll can read .txt files, and there is a much better way to generate tuning data in this format. For this tutorial, we’ll be using Scala tuning software to create .txt files that coll can read.

 

First create or load some tuning data into Scala. (For now we’ll just load a file from Scala’s huge database)

Loading a scala file from the huge Scala database

Then type the following command into Scala:

set synth 135

Scala will say “Synthesizer 135: Max/MSP coll data, via text file”. You’re doing just great.

Now click File → Export synth tuning as shown below.

How to export a .tun file from Scala

This will bring up a familiar save file dialog, and you can save your .txt file anywhere. Once your .txt file is saved somewhere convenient, your can load it into your coll object.

Create a message button which contains the word “read”. Connect this up to the coll object (as shown below). You can click the “read” button to bring up an open file dialog. Use this to load the file you just exported from Scala.

Load .txt file into coll but using a message box titled "read"

Once you’ve loaded the .txt file into coll, you can check that the data went in correctly by double-clicking the coll object.

# Tuning file for Max/MSP coll objects created by Scala
#
# Sean "Sevish" Archibald's "Trapped in a Cycle" JI scale
0, 8.1757989;
1, 8.4312926;
2, 9.1977738;
3, 9.5384321;
4, 10.2197486;
5, 10.7307361;
6, 11.2417235;
7, 12.2636984;

...

Congrats, you’ve just replaced the mtof object with your very own, microtunable coll! Enjoy playing microtonal scales in Max/MSP.

Big up to Manuel Op de Coul, the creator of Scala, who added support for Max/MSP coll files on my request. Much appreciation that his project is still being maintained.

 

Exercises

  1. Recreate my sine tone generator above, using coll.
  2. Download and install Scala, then get to grips with creating your own scales.
  3. Max 4 Live users—download my device Boom. Look at the source and see how I used coll to load tuning data.
  4. Make your own simple synth and have a jam in 5-EDO.
  5. The mtof object will accept float values in its input. Find a way to abuse this feature to microtune Max/MSP without using coll at all.

16 thoughts on “How to play microtonal scales on a Max/MSP synth”

    1. S Post author

      You’re going to support microtonal scales in your software? That’s amazing! I’m glad to see more software supporting this much-needed feature. Your users will have a new world of expression opened up to them.

      Reply

  1. Yan

    Simple and effective. Genius! I’m not (yet) familiar with Max but I’m planning to use it exclusively with Live for music production and research. As part of my study in Popmusic Design I’d love to introduce Xen to a broader audience, so microtonal sampling will be crucial. Is there a way to implement Live’s stock plugins in max, retune them with your coll method and import them back into Live?

    Reply

    1. S Post author

      I’d love to hear what you come up with when you find a way that works for you!

      As for retuning Live’s stock synths, there’s no simple way to make it happen. If you’re determined to use Live’s synths then you could try the Max 4 Live MIDI effect called “Retune for Live” (http://www.maxforlive.com/library/device/3068/retune-for-live) – This effect will use MIDI pitch bend to retune the notes, so there’s a caveat. Each instance of the Live synth must be monophonic, since MIDI pitch bend itself is monophonic. To get around this, you’ll need to have duplicate instances of each synth for as many notes as you need to play. Personally I don’t use the stock Live synths at all because they’re locked into standard tuning. There are plenty of VST instruments that have microtuning capabilities built-in, and these are much easier for me to work with.

      Let me know if you still have any trouble getting set up for microtonal scales, and good luck.

      S

      Reply

      1. Yan

        Thanks for the link! I’ve read about microtuning with Retune for Live but I think this method is a little too cumbersome for me while producing, resp. I’d like to follow your approach by building my own microtonal devices (multisampling, granular/additive/spectral resynthesis) once and be done with it.
        Camel Alchemy is able to do that but doesn’t support drag & drop like Live/Max devices, so that won’t be a practical solution either I’m afraid.

        Again, thanks for the help. I’ll see how far I’ll come using/modifying your Microsampler. Love your music very much btw! Besides Wendy Carlos it’s the only microtonal contemporary music that actually has a concept and creates an emotional impact, imo.

        Reply

        1. S Post author

          Building your own devices is a great way to go. I hope my Microsampler will be helpful to your goals. These days I stopped using it and bought a VST instrument called TAL-Sampler instead. It has good sound design potential and it’s lessy buggy than Microsampler.

          There are also various synth plugins (and free ones) that support microtuning and work with Ableton Live. The available plugins depend on whether you’re using OS X or Windows. But if you’re interested, you can find a list here:
          http://xenharmonic.wikispaces.com/List+of+Microtonal+Software+Plugins

          Glad you’re enjoying my music! Recently I’ve been writing more and hope to have new sounds out soon. I very much love Wendy Carlos’ music too, she’s hugely inspiring. Oh and AFX and Autechre of course. :)

          Reply

  2. rorytheherb

    Hi thanks for this bit of helpful info- I was hoping there was a way to use .scl files in Max!

    Now, I’m hoping there is a way to batch process all of the .scl files at once. Do you know if it’s possible?

    Thanks,

    Rory

    Reply

    1. S Post author

      Hey Rory, glad this was some help to you! It’s possible to batch process all of the .scl files to .txt files for Max/MSP, yes. I was going to direct you to Jacky Ligon’s website where he has talked about batch processing of Scala files. But I just checked his page and it seems you already left him a comment! Looks like Jacky responded to your question so I hope you’re able to get the batch export working.

      Thanks for getting in touch, and feel free to share any microtonal music you’re making with these techniques.

      Reply

      1. madsness

        I can’t install for some reason. If any of you have the whole scala library exported to max msp coll text files, could you send them to me as a zip or rar? madslundkold at gmail dot com

        Reply

  3. Walker Storz

    Ok, man, so this is mad cool. Thanks so much for this. Short of becoming harry partch and building crazy microtonal instruments, this is the closest i’ll get to being able to hear microtones with precision. Got a couple main questions. Sorry if they’re stupid, i’m not a programmer. Is there a way to set the starting frequency and ending frequency of a given scale? I keep dividing the octave more and more and so the midi keyboard runs out of range
    So I guess I gotta have some for a lower range and some for a higher range

    Also, is there ever gonna be a way that i can save coll with the file in it or am I gonna have to reload that everytime? Because it would be convenient to have it be a more readymade synth

    Reply

    1. Sevish Post author

      It’s been a while since I used Max/MSP (life is getting really busy at the moment) but there are solutions to all the difficulties you mentioned! :)

      The values stored in the coll object are frequencies in Hz, you should be able to achieve any wanted starting and ending frequency by editing the values directly. If you’re exporting the Hz values using Scala, then you can set the base frequency within Scala before you export (you just need to do a little digging around inside Scala to find it).

      Yeah, if you divide your octave into really small pieces then you quickly run out of range on the keyboard. That’s just a limitation of the MIDI spec. But there is a workaround if you have a knob, fader, or some other kind of MIDI control on your device. Use the output of that control, scale it to the values of -3 to 3, multiply that output by 2 (2 meaning octave), then multiply the output of the coll object by that number. Ta-da, you should have an octave transposer at that point.
      That might not be too clear, but feel free to paste in your max patch in a response here and I will try to find time to add the missing pieces for you.

      Finally, for saving the contents of coll. You can store your tuning in a scale.txt file in the same directory as your maxpatch. Then create an object called “loadmess read scale.txt” and pipe its output into the input of the coll object. That should load up the scale.txt contents each time you load the synth.

      Reply

  4. Walker Storz

    Here’s the synth

    {
    “boxes” : [ {
    “box” : {
    “maxclass” : “gain~”,
    “patching_rect” : [ 306.0, 292.0, 22.0, 140.0 ],
    “style” : “”,
    “parameter_enable” : 0,
    “numoutlets” : 2,
    “id” : “obj-3”,
    “outlettype” : [ “signal”, “int” ],
    “interpinlet” : 1,
    “numinlets” : 2
    }

    }
    , {
    “box” : {
    “maxclass” : “newobj”,
    “text” : “prepend midinote”,
    “patching_rect” : [ 226.0, 166.0, 103.0, 22.0 ],
    “style” : “”,
    “numoutlets” : 1,
    “fontsize” : 12.0,
    “fontname” : “Arial”,
    “id” : “obj-21”,
    “outlettype” : [ “” ],
    “numinlets” : 1
    }

    }
    , {
    “box” : {
    “maxclass” : “newobj”,
    “text” : “poly~ 24sub 16 @steal 1”,
    “patching_rect” : [ 277.0, 222.0, 143.0, 22.0 ],
    “style” : “”,
    “numoutlets” : 1,
    “fontsize” : 12.0,
    “fontname” : “Arial”,
    “id” : “obj-20”,
    “outlettype” : [ “signal” ],
    “numinlets” : 1
    }

    }
    , {
    “box” : {
    “maxclass” : “ezdac~”,
    “patching_rect” : [ 369.5, 417.0, 45.0, 45.0 ],
    “style” : “”,
    “numoutlets” : 0,
    “id” : “obj-9”,
    “numinlets” : 2
    }

    }
    , {
    “box” : {
    “maxclass” : “newobj”,
    “text” : “pack”,
    “patching_rect” : [ 226.0, 110.0, 36.0, 22.0 ],
    “style” : “”,
    “numoutlets” : 1,
    “fontsize” : 12.0,
    “fontname” : “Arial”,
    “id” : “obj-2”,
    “outlettype” : [ “” ],
    “numinlets” : 2
    }

    }
    , {
    “box” : {
    “maxclass” : “newobj”,
    “text” : “notein”,
    “patching_rect” : [ 226.0, 56.0, 43.0, 22.0 ],
    “style” : “”,
    “numoutlets” : 3,
    “fontsize” : 12.0,
    “fontname” : “Arial”,
    “id” : “obj-1”,
    “outlettype” : [ “int”, “int”, “int” ],
    “numinlets” : 1
    }

    }
    ],
    “lines” : [ {
    “patchline” : {
    “source” : [ “obj-20”, 0 ],
    “destination” : [ “obj-3”, 0 ],
    “hidden” : 0,
    “disabled” : 0
    }

    }
    , {
    “patchline” : {
    “source” : [ “obj-21”, 0 ],
    “destination” : [ “obj-20”, 0 ],
    “hidden” : 0,
    “disabled” : 0
    }

    }
    , {
    “patchline” : {
    “source” : [ “obj-3”, 0 ],
    “destination” : [ “obj-9”, 0 ],
    “hidden” : 0,
    “disabled” : 0
    }

    }
    , {
    “patchline” : {
    “source” : [ “obj-3”, 0 ],
    “destination” : [ “obj-9”, 1 ],
    “hidden” : 0,
    “disabled” : 0
    }

    }
    , {
    “patchline” : {
    “source” : [ “obj-2”, 0 ],
    “destination” : [ “obj-21”, 0 ],
    “hidden” : 0,
    “disabled” : 0
    }

    }
    , {
    “patchline” : {
    “source” : [ “obj-1”, 0 ],
    “destination” : [ “obj-2”, 0 ],
    “hidden” : 0,
    “disabled” : 0
    }

    }
    , {
    “patchline” : {
    “source” : [ “obj-1”, 1 ],
    “destination” : [ “obj-2”, 1 ],
    “hidden” : 0,
    “disabled” : 0
    }

    }
    ],
    “appversion” : {
    “major” : 7,
    “minor” : 3,
    “revision” : 1,
    “architecture” : “x64”,
    “modernui” : 1
    }

    }

    Reply

    1. Sevish Post author

      I think the formatting got a little chewed up by my website, and it didn’t import into my copy of Max. You can usually select your whole patch then go Edit>Copy Compressed to get a shareable block of text that is easy to import. I made a quick Max/MSP octave transpose function for you to study. Copy the text then go File>New From Clipboard:

      ----------begin_max5_patcher----------
      944.3ocyX0saaBCE9ZpTeGPV6hsoTD1FBvtaOA6AncJx.NotiXh.m1zVs8rO
      icHgzTHdYMVbQvhiC1my2467i8qWekCHsbCsF39M2accbdUJwQIqQhSq.GvR
      xlrBRs5OB3zmJSe.LY6bB5FgR9RQ47cRWQDY2y3KlUQyD50GBC87m3BmBaFv
      AMOQ9d9t+r8i3qWx3ETgZefsRmWxE0rWnJgH4W0QNmrTIG78JFoX2tyxUBkp
      4MH7NokqExEW77JpVg.fC1Z8z58VI82WeUynbXhwfC8kbR1eFBFhi7PgR6Od
      ZC.DD19butrphVS4BhfUxO.I5NQmULJQshvfdWwC.Vz6gRHv6iD9mMRzGMon
      jjujVW6NMXHXJHwWwVBwMCRSzNrEnUYKKHLtQjErx9gQJLAYHagTIsWAsZFk
      SRKTlg+InRPTPWtDLFdNjI+9AwZ1BdCz6BXbQuHJ5rQzrxkKk10wztejIHOR
      kHvtoRWmtEUfC3Avw53Ij1CDp8.AcAj4UKRUfqm+4FBCihTz7HcFR7waxkfs
      CSrVTuztWQ44t0Tg6VWwP7dThh+gihU.BzRg+vHqF9mtVHj7igpYFE5EIiGQ
      XXKBXFNz0nl1uQkR3Kt.FVerfrmyJnClvCFpb7nj380xFvdQeP98fSlw5iGj
      ZJBRVPOFkpnDYfRFof5I1HFLLwGoiOTfVr9k3KNZY2hj+ptfkSqLf0n6oDiU
      uzz3vkpJoZef3d2sSVhLoeDrot3Eq7XubNnGXvhfpDOXnJpTWC7xyyhsJMqu
      bVzMqpbWU9zmQ2c2jOMG9EC.JTjJwUhkNiyzQAPoxX45K0+H2avtXSvo.0ft
      X+.3zzOFbJbTfSe0c3fs1Rf5t.wHuPaTBbfJfykGYSbA.nSmWuklrsL219hg
      W3D6G1EN7epYK7nfhkUVTX.Ea6UwDlbBJ1G0gqG.alz4We3TPq3Z4wGxmIWR
      oAMiHDULYmz5qwxYOT4.nKSo46OOSKD2Ap0aEnfwO5VvTvVyDuwATWttJqUu
      augI2NPWNsVv36Hj2tK9p6e5dVdNke.mLmU2vSyOwAvLVuRLQsPiT0Bac8p4
      VKLPwZ.L3XUwrKhACLRw7suqDZhhYeJVy0KbZ8BlXcEKzH8Jx9.1zwYpUiTq
      2p7iE8Jv5YvLJOALXbR6GodwXq6EgvwYCEF09U3+kZssMQxpUORqp2txZMR1
      P9CkU6OjJP12r9ccWyfJ5ir1OAp2M.oR1QtP1855JcOyalF.jyn1Q4i+BvY8
      .5D
      -----------end_max5_patcher-----------

      I hope that adding this kind of feature to your synth will help you get more range on your MIDI instrument while using huge microtonal scales. Sorry if my code is messy, I haven’t made a max patch in a while!

      Reply

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

*