Sevish Music

You are browsing the mtof tag


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.