Microtonality

Hi,

It looks like there is no built-in way to get microtones in the Tracktion Engine – the MidiNote class has noteNumber as an uint8 and there is no additional field for intonation.

What would be a sensible way to go? Would it be possible to subclass MidiNote to add an intonation field, for instance?

Any ideas are very welcome!

Erik

I’d probably apply a pitch-bend NoteExpression to each note?
You can’t really subclass engine internals.

Thanks for your quick answer!

You can’t really subclass engine internals.

I see.

I’d probably apply a pitch-bend NoteExpression to each note?

That implies using MPE, no? While that is possible it is not really optimal in my setup.

There are two parts of the issue:

  1. How could non-12-EDO pitches be represented in MIDI clips?
  2. How should these pitches be communicated to audio processors/synthesisers?

The second question seems easier to handle: many synths support the MIDI Tuning standard, so Single Note Tuning MIDI messages could just be inserted into the MIDI sequence.

Regarding 1), imagining a clip representation that had float note numbers, notes could be converted to “normal” notes (with integer note numbers) + MIDI tuning messages at some point. But currently, there seems to be no way of storing the extra pitch information in the first place.

With MIDI 2.0, pitches are indeed no longer restricted to integer values and although a full implementation of MIDI 2.0 is probably far away, IMHO having non-integer pitch values would probably be a step in the right direction anyway!

In the meantime, is there any way to add custom data to the notes in a MIDI sequence/MIDI clip? I’m really a beginner with the Tracktion Engine so please forgive me if I’m not making sense here!

I really don’t know much about how micro tuning is handled between DAWs and plugins. I though they were just tuning modes in synths that adjusted the pitch of incoming MIDI notes?

I also don’t fully understand what side (host or synth) you are implementing. If you want micro tunings to work with any existing plugin, I presume you’ll have to adhere to an existing standard?

One of those standard that might be supported by plugins is MPE. So if you wanted to us that, you could apply PITCHBEND tracktion_engine::MidiExpression to your notes (which has a float semitones number IIRC) then then that will be converted to MPE when sent to synths.

But like I said, I’m not really sure what the best method here is.

I also don’t fully understand what side (host or synth) you are implementing.

I’m implementing a host.

If you want micro tunings to work with any existing plugin, I presume you’ll have to adhere to an existing standard?

Yes, that’s what I meant with 2) above: communicating the pitch information to plugins can be done quite easily – albeit ugly – using e.g. pitch shift for MPE synths or MIDI Tuning messages.

But it would be very nice to not have to put these workarounds in the MidiClips directly! Imagine for instance a piano-roll editor which allows non-discrete placement of notes. As I understand it, I currently would have to implement my own class/format to store such a clip (and then under the hood probably convert it to a te::MidiClip before playback).

However, if MidiNote allowed for float pitches, I could let the GUI use the MidiClip as-is. Obviously, the same pitch bend messages would still have to be produced and sent to plugins at some point, but it would be abstracted away more nicely. Isn’t that very much like how MidiNote appears to have a ”length”, abstracting away the concept of individual note-on/note-off messages?

Even without direct support for microtonal pitches, just any way of attaching auxilary data to a MidiNote would be very useful for these kind of extensions! Because then I could explicitly pre-process my MidiList and convert this data to whatever MIDI messages would be appropriate.

I realize that this may not currently be possible, but perhaps it could be considered a feature request? :slight_smile:

Hmm, making a change like that would need a large amount of thought I’m afraid as we have thousands of lines of code expecting it to be an int.

You can add arbitrary data to a MidiNote though by simply changing a non-reserved property of the MidiNote::state tree.

Hi

Two things to look at

The folks at ODDSound.com have done a lovely job making a plug-in based tuning mechanism where a single plug-in can send tuning information to virtual instruments through a variety of mechanisms. Plus they are nice to work with.

If you want to handle tuning at the host level you may also want to check out the surge team tuning library GitHub - surge-synthesizer/tuning-library: Micro-tuning format parsing and frequency finding as a header-only C+ library which given an scl and kbm file gives you complete keyboard retuning. We licensed that lib mit only and made it header on so folks could use it in lots of projects. You could then allow your host to chose how to react to plain midi to non tuning aware hosts. Or do a variety of other things

Having now written a few goes at microtonal plug-ins it seems the daw sends standard midi and the plug-in (or plug-in set in ODDSound case) figures out the frequency based on tuning in play. The math from scl + kbm to tuning is irritating but we think we got all the edges in our lib.

The folks on the surge discord micro tuning channel have loads of experience and are happy to help if any of this is of interest. And if it’s not - still have fun with a tuning aware project! It’s a neat field.

3 Likes

I want to point out that OddSound also released a library meant to replace MTS or MPE, called MTS-ESP. Although there aren’t a ton of synths that support it yet, @baconpaul already added this functionality to Surge. You can use the library linked above to add this support to your microtonal plugins (it took us just an hour or so to set up).

2 Likes

You can add arbitrary data to a MidiNote though by simply changing a non-reserved property of the MidiNote::state tree.

Thanks! That is just what I need!

@baconpaul & @zac

Thanks for your suggestions! I’ll definetely look into it!

2 Likes