Topic: How to change root key to frequency in current scale

Is it possible to change the root key to the exact frequency of a key in the current scale and temperament?

I am using a pedal to "Set temperament root note/Change root key of current temperament". After the pedal action, the next midi key on the piano is used as the root key for the temperament that I have set, as described in (https://forum.modartt.com/viewtopic.php?id=11190)

This is quite wonderful, because it allows modulation to all twelve piano keys for any temperament in use, my interest is in exploring the possibilities of extended just intonation.

The problem, however, is that the frequency of the new root is not equal to the tuning of the key before it was pressed, but it retunes all keys relative to the midi key that has been set as the diapason, or tuning reference. By default this is A440 through midi key number 69, but this can be changed to any midi key and frequency using a kbm file.

My question then is if and how I would be able to set any midi key as the new root using the function "Set temperament root note", but also keep the frequency of the current tuning of that midi key. Often when I want to modulate to a different root, I want to use another frequency of the current scale as the new root, which might or might not alter the frequency of the diapason.

Perhaps anyone knows or can think of a way to achieve this, perhaps with different settings of scala and kbm files?

An alternative of course would be to change this functionality in Pianoteq to set the frequency of the newly pressed midi key as the diapason, which I think would be more intuïtive, at least for me.

Re: How to change root key to frequency in current scale

I just realized that if you would let Pianoteq set the exact frequency from the current scale as the new root frequency, that it might not be possible to easily return to the previous root using the same method.

If a non equal temperament is used - which is the only reason you would need to change the key of the temperament anyway - it could well be that none of the scale degrees of the new root includes the previous root. This might be a reason why the diaspon is used as a reference, it will always produce the same 12 roots for a given temperament.

Perhaps there could be an option to set the desired scale of fundamentals/roots (with a second scala file) independent of the regular scale of the keyboard?

Re: How to change root key to frequency in current scale

MTS-ESP plug-in from ODDSound is probably what you need to start with. Pianoteq has implemented it and works flawlessly, apart from some minor 'bugs' showing up only if you mess up Pianoteq's internal diapason (parameters like this, better not to touch as long as Pianoteq is in MTS-ESP following mode).

MTS-ESP (Suite version) comes with several transpose / modulation controls, all suitable for the more 'unequal' scale bells and whistles. You might want to check out the MTS-ESP Suite Master manual (page 63 and so on), watch the video from ODDSound about the transpose macro, etc. There is also some 'adaptive tuning' diving if you are interested...don't ask me though - never went that deep.

Actually I'm not 100% sure on what you asked for and what you are trying to achieve with 'extended just intonation' but I can tell you something in relation to the needs you expressed. There is some more open-source material which you might also like experimenting with. It's made by Dan Trueman and it's called bitKlavier, which now works in tune with MTS-ESP (and Pianoteq, as the man shows). BitKlavier YouTube channel provides excellent instructional videos on what you are seemingly looking for (see, for example, 'Spring Tuning - Nonunique Intervals and Moving Fundamentals'). BitKlavier also can give you some new 'adaptive' stuff offering you more flexibility than, say, the Hermode tuning program.

Depending on the overall settings, preferences and whatnot, when Pianoteq is running as a MTS-ESP Client, consider choosing 'Continuous retuning (pitch-bending)' over 'New notes only (no pitch-bending)'. Both options are to be found by navigating through the Tuning panel as you open Pianoteq in your DAW, see the left part of its main window - click onto the temperament / MTS-ESP label, then go to 'External tuning (MIDI, MTS-ESP)'.

Basically you don't need multiple .scl or .kbm files the moment you can load / manage everything within MTS-ESP. Eventually - if your host allows this - you can map the 'transpose' macro values from the MTS-ESP device to some MIDI interface, in order to select the 'root' manually. Or do things any way you like. The Mini version is completely free but limited in changing scale presets only. The Suite version comes with a 30-days trial in which everything is totally functional. I strongly recommend this software. ODDSound support is just as incredible as Modartt's. Their alliance is a game-changer for the microtonal aficionados.

Mind you the sound quality of Pianoteq's engine gets slightly affected in some ways when in following mode (less pristine). If 'Full rebuild' instead of 'String tension' is selected in the advanced tuning window, then it is no longer so notably compromised. You decide if it is perfect or not depending on what you play. Hope this helps.

Re: How to change root key to frequency in current scale

Well, that is a comprehensive answer with alot of interesting possibilities for me to explore, thank you so much.

At first glance it seems that the MTS_ESP "Modulate" mode of the transpose macro with "Allow Drift" set to off is how Pianoteq behaves when using "Change root key of current temperament".

What I had in mind in my original question is to "ensure there is no pitch shift in the new tonic note when modulating", which is the description in the MTS_ESP manual of setting "Allow drift" to "On". To achieve this, the "reference frequency is adjusted", or what is called diapason in Pianoteq.

But as the name implies this results in a drift of the tonic away from the original root, which apparantly can be solved by setting "Adaptive Tuning" to "on" because then, it says "The original scale intervals are always used to modulate, regardless of any macro adjustments to scale intervals."

I am definitely going to give this a try soon and experiment with the various settings, I'll report back when I have.

Last edited by QuintenCT (08-07-2024 23:55)

Re: How to change root key to frequency in current scale

I would like to suggest an improvement to the way modulation (change of temperament root) is implemented in pianoteq:

1. Use the diapason only to build the initial scale without modulation, not to build scales after modulation.
2. Always take the frequency of one of the degrees in the initial scale as the new tonic (root) after modulation.
3. Calculate the frequencies of the scale degrees after modulation from the relevant degree of the initial scale, not from the diapason.

This way the modulation follows to the scale that you are using, instead of its inverse which is very confusing.

Re: How to change root key to frequency in current scale

Glad that was of help, thank you for replying as well. However I must confess my own perplexities about the request of improvement here. I'm still interested in understanding this with the best of my abilities. So I ran a quick test confronting all MTS-ESP 'Transpose' modes vs Pianoteq 'Change root key of current temperament'.

This topic is controversial, please allow me to present a more comprehensive post than before (which will require some time at reading). I will not go any more into dynamic micro-tuning specifics like it happened with my previous post as it also seems that you are simply not looking for 'automatic adaptive tuning' (such as that which BitKlavier Spring Tuning provides) but rather you want to manually set a specific new 'root' for the 'modulation' (re-tuning or re-mapping) to be more or less immediately applied each time, depending on the moment the next note-on takes place. This would translate in that you might want to choose 'New notes only (no pitch-bending)' over Continuous retuning (pitch-bending)' if Pianoteq was running as a MTS-ESP Client, contrary to what I've said before...whatever.

With that being said, based on my recent results (if I didn't miss anything) it looks like you are wrong with your first assumptions on MTS-ESP. Did you give it a try? Pianoteq behaves not like the "Modulate" mode but exactly like the "Mode Rotate" mode with a reversed +/- value. Also "Mode Rotate" mode in MTS-ESP does not allow any 'drift' nor any 'adaptive tuning' option whatsoever, so we would better not mix things up.

The acoustic result is identical (except for that insignificant detail I told you in the last part of my answer before) but the way these two pieces of software achieve it is not. MTS-ESP "Mode Rotate" mode needs a negative 'macro value' to match the positive increment of Pianoteq's 'root' (MIDI notes have nothing to do with 'roots' in music, just saying). That is, when you set a different 'root' by means of the Pianoteq function alone, and you go for a MIDI note higher than, say, the initial 60 (C4) - hence, say, 61 (Db4) - then, the 'macro value' within MTS-ESP "Mode Rotate" must go to the reversed direction (-1 in this case), or things won't match. And so on (needless to say, Pianoteq must deal with a total common n-tone scale and be loading the corresponding .scl and .kbm files).

It's hard to figure out what you personally mean by 'modulation' without more specific examples. The "Interval matrix (modes)" in Scale Workshop v2 browser app is what I mean by specific examples now, because it gives you a good vision of what happens at least in this specific case. Also, both the 'diapason' value in Pianoteq and the MTS-ESP 'reference note frequency' are completely left untouched by my computer when running this test. So technically I'm unable to register any 'diapason' change. What you are saying about diapason and modulation in relation to Pianoteq 'Change root key of current temperament' facts may be needing some clarification?

If I understood this correctly, Pianoteq does what it does by changing what is referred to as the 'reference note' in MTS-ESP or the 'MIDI note for base frequency' in ScaleWorkshop 2 (these are all .kbm file parameters) while leaving all .scl values untouched. First, the user queries the program for this 'root change' action to be taken (according to the MIDI event he/she must set in the Options -> MIDI, under 'Global MIDI mapping'), then selects the 'root' (MIDI note) by pressing some MIDI note, and, after that, the change immediately occurs in the digital realm, whereas the re-tuning ('modulation' or whatever) can be acoustically appreciated only following the next striked note-on, and provided that the specific MIDI note pressed for the query doesn't lead to a mapped frequency resulting in the start of the period (or modulo-resetting, because this 'wraps' the scale around, whereby no modulation can actually be heard, as if the initial step 0 was meant).

So the 'shifting of the root' (for a lack of better terms) can be indicatively assumed by looking at the note labels 'rotating' towards one direction or the other under the 'Keyboard mapping' section found in the 'advanced tuning window' in Pianoteq (all this without MTS-ESP being engaged, of course). We all know those note labels mean potentially nothing (just values from 0 to 127).

Conversely, MTS-ESP brings the same, identical result as Pianoteq own 'Change root key of current temperament' at the conditions explained above, but gives you a whole bunch of information about the 'modulation', since the 'tuning table' values (.scl file parameters, basically) are dynamically and instantly changed. The change is reflected by the 'Macro Adjustment' column values as well as by the 'step frequency' column values (the latter, in Hz).

The 'Macro Adjustments' can be displayed either in cents interval or in frequency ratio (decimals) format, also either relatively to the 'tonic' (1/1, or step 0 of your scale preset, eventually modified) if the "Display Macro Adjustment as" option is set to 'Absolute'; alternatively, relatively to each step (showing each adjusted inter-step interval size) if set to 'Difference'. Again, this situation with all the possible changes thereof can be grasped as a whole through Scale Workshop v2 "Interval matrix (modes)" available in the "Analysis" window.

As a side note, ODDSound YouTube video about the 'Transpose' mode informs you (along with its own sequel dedicated to 'adaptive tuning') about the existence of a preset such as that of "Adaptive JI". It seems that the maneuver required for you to instruct the software on the precise 'root change' can be customized into more usable and quick ways than those available by means of Pianoteq action & MIDI event global managing (see, for example, the 'Use Lowest Played Note' option demonstration), for all that it might turn out to be that their software is not strictly needed for your specific purpose here (you know).

All in all, some change is reflected in the MTS-ESP line graph / circle graph as well (although questionably, from a practical point-of-view), whereas Pianoteq, in its current implementation of the 'Change root key of current temperament' function, will not display any change at all, for the reasons implicated above (while its own circle graph is definitely more appealing to the eye).

So here's where my perplexity lies. If you are asking Modartt for an improvement in the mere visual sense, it's one thing. If you are asking them for an improvement which instead involves achieving a totally different acoustic effect than what Pianoteq and MTS-ESP (in "Mode Rotate" mode) both achieve, then I would expect you to report here, in return, which actually is the MTS-ESP transpose / modulation mode that does what you request (if there is one).

From what I know, 'extended just intonation' is a tuning system like that which Ben Johnston used for his String Quartets works, and, the "Transpose + Modulate" mode within MTS-ESP - let us forget about drifts and adaptive stuff for the moment - sounds like the way to go, if the composer's interest is to reproduce the same just intonation 'lattice' only potentially 'extended' to any absolute frequency contained in the initial set of absolute frequencies that must come with the initial mode/scale.

Please, let us know. Looking forward to be hearing best results from you. And good luck with your experiments!

Re: How to change root key to frequency in current scale

Thanks alot for you interest, and effort to understand my needs, I appreciate you. I am sorry if my previous answer was a bit too staccato, I failed to actually share my thoughts.

I agree that we should focus this discussion on pianoteqs behaviour as it compares to the options in MTS_ESP, leaving drifting and adaptive tuning aside for the moment. By the way, the term extended just intonation was indeed used by Ben Johnston, which is where I have got it from.

My initial assumption on how pianoteq behaved, as compared to MTS-ESP manual was indeed wrong; as your have aptly described, when pianoteq applies "Set temperament root note/Change root key of current temperament", it does something that is equivalent to changing the value for "MIDI not for base frequency" in a kbm file. However, this is only the same as what MTS_ESP calls "Mode rotate", if the diapason in pianoteq is set to the same note as the tonic, which is why initially I didn't recognise this. Otherwise Pianoteq's behaviour can be classified as "mode rotation", but starting from a different degree/mode.

After testing MTS-ESP I found that my needs perfectly align with the MTS_ESP "Modulate" mode of the transpose macro, namely to modulate to one of the initial scale degrees as the new tonic. What I mean by modulation therefore, is exactly what MTS_ESP, I think correctly, calls modulation as it is used in a musical context (which is something entirely different than modulation in signal processing). It is to apply the same scale to a different tonic.

My request for improvement is based on my conviction that musically and harmonically, if a piano player would need one thing during play it is to modulate to a different tonic. It is the reason why temperaments have been introduced in the first place, to be able to modulate freely. Now that we have the technical capabilities to implement modulation of any scale on the fly, something that musicians over the ages would have drooled over (lets just name Bach's Well Tempered Klavier), it would be a shame to set mode changes as a default in pianoteq and leave out modulation entirely.

Judging from the terminology used by pianoteq: "changing the root key", I think they have intended to implement modulation, because their focus, I think rightly so, is on setting another root/tonic, not setting another mode. It's just that in the implementation, I think things went in a different direction. Which is what I suggest to correct.

Another way to formulate the same request is:
1. Please adjust the behaviour of "Set temperament root note", so that it modulates instead of changes/rotates modes.