Can you shift pitches to a different mode in Frescobaldi?

It all started with a thread on the Frescobaldi mailing list with the basic underlying question: Can the modal transpose (in Frescobaldi) be used to shift from one mode to another? After some discussion the answer turned out to be both yes and no.

Below I’ll elaborate on this apparent inconsistency and also introduce a new feature to accommodate the request for a tool to shift between modes.

How Modal Transpose can’t be used to shift mode

Frescobaldi provides a `transpose` tool that emulates LilyPond’s `\transpose` function but actually changes the content of the input file. In September 2013 Christopher Brian added `Modal Transpose` to Frescobaldi that also transposes the music input but keeps the pitches within the given scale.

I’ll give a simple example to explain the intended use of the modal transposer. To my mind this is best illustrated by the use of chords. Take a C major chord:

`<c e g>`

If we transpose it upwards one step with the ordinary transpose (`C D`) we would get a D major chord. But if we use the modal transpose in the key of C major (with the command `1 C`), we get a D minor chord:

`<d f a>`

Similarly we would get E minor instead of E major and A minor instead of A major. Again, this is because the modal transpose transposes music within the notes of the given key or scale.

Let’s now return to the question, can this function be used to shift pitches from one mode to another, from say the key of C major to the key of C minor?

The function only allows for major modes so a shift to minor would be out of the question. But we could try to do the opposite – change the mode from C minor to C major. Minor I would interpret as harmonic minor in this case. Here’s the C harmonic minor scale:

`c4 d es f g as b`

On that we’ll try the modal transpose command `0 C` (meaning transpose 0 steps within the key or mode of C major). With this command you might expect the mode to change from C minor to the given C major (i. e. `es` change to `e` and `as` change to `a`). But instead you see no change at all. Why is that?

The explanation is that if some of the original pitches are outside the given key their alteration will be kept and the pitches will not be adjusted to that key. Hence you can’t use this functionality to shift between different keys or modes. It is meant for in-scale transpositions such as contrapuntal imitations.

I’ll return to the case of chords to illustrate this. Take a chord that is not in the key of C major, let’s say the D major chord.

`<d fis a>`

And transpose it one step down (`-1 C`) we’ll then not get a C major chord, but instead:

`<c eis g>`

This is because the note that is outside the C major scale (F-sharp) retains its alteration after the modal transpose (E-sharp). To sum up the pitches which are inside the given key will stay inside the key no matter how many steps we transpose. And those pitches which are outside the given key will stay outside and not adapt to the given key.

From the above study it seems that a mode shifter is far from what is intended by the modal transpose. But there is in fact a way that this can be done at least to a limited degree.

How Modal Transpose can be used to shift mode

The special trick is to use modal transpose and ordinary (chromatic) transpose in combination. You would then make use of the fact that different modes have the same set of pitches. (This trick was first suggested by Paul Morris.)

Let’s go back to the request above – a shift in mode from C minor to C major. Let’s also interpret C minor as C natural minor this time although this may be a little more far-fetched.

`c d es f g as bes`

The first step is to use the regular transpose to shift from C natural minor to A natural minor (`C A`).

`a' b c d e f g`

As you can see the pitches are now in the scale of C major due to the fact that A natural minor and C major have the same set of pitches. The next step is thus to use the modal (in-scale) transpose to move back to original position while still keeping all the pitches inside C major. We do that with the command `-5 C`.

`c d e f g a b`

And then we have in fact changed the pitches from C natural minor to C major. Now if we wanted we could change back to C natural minor. We would then follow the steps in the opposite order (first modal transpose down 5 steps in the key of C major, then ordinary transpose back from A to C).

This neat trick can be used whenever two modes share the same pitches. But it’s limited to those cases. That means that you can’t for example change from C major to C harmonic minor.

Furthermore as seen above if the original pitches aren’t all part of one scale those external pitches will not be adjusted to the resulting scale. This isn’t necessarily a bad thing; it can be quite desirable. But it means that in some situations you can’t be sure that the result complies to the proposed scale.

Although an interesting workaround this is of course awkward and too limited for extended use. Wouldn’t it be possible for Frescobaldi to have a function that let you shift mode easily?

The new mode shifter

From now on this story will get a little more personal as it’s time to turn from the limitations and possibilities of the existing transpose tools to the creation of a new tool. I hope you don’t mind!

The mentioned thread on the Frescobaldi mailing list got my attention, and to settle my curiosity I started a little research into the matter. I had only very little experience with the modal transpose up to that point.

At first perhaps influenced by the idea of the modal transpose as a means of introducing a new mode I couldn’t figure out why the function didn’t yield results according to the commanded scale. But after having carefully read through the code of the function I finally realized the secrets of the modal transpose (insights I of course tried to share above).

I also realized that I was too deeply involved already. The request of a function to change the mode was added as a wish to the Frescobaldi issue tracker, and furthermore having carefully read through the code I had some vague idea how it could be implemented. I felt that it would be a real waste to leave it with that. I assigned myself to deal with the wish, started to delve deeper into the task and didn’t look back.

I have no intention of boring you with details of how I decided to solve the task. But I’d like to mention one fundamental thing: When I scrutinized the code of the modal transpose I also got a good look at the code of the regular transpose. This function is written by Wilbert Berendsen (of course the creator of Frescobaldi himself). And as always it was very rewarding reading through the code that Wilbert has written (he and Frescobaldi in my world naturally deserves all the credit that can be given). And my decision was to rely on that existing code as much as possible.

At the time of writing this a first version of the new function which I decided to call Mode Shift (`Tools->Pitch->Mode shift`) has been merged into Frescobaldi master. With a little care and further development I think it can turn into a nice and useful addition to the other editing tools. Please don’t hesitate to give the feedback that would reinforce that process!

The new Mode shift menu item.

How Mode Shift can be used to shift mode

To show how the new function works we can once again return to the request to change from C (harmonic) minor to C major.

`c4 d es f g as b`

We enter C major in the Mode Shift dialogue and the pitches shift accordingly:

`c d e f g a b`

It should perhaps be added that there need not be any from scale. Any note would be adjusted to fit inside the given scale. To illustrate this we could take three chords C major, D major and E major.

`<c e g> <d fis a> <e gis b>`

After the shift all pitches outside the C major scale have been adjusted to the nearest step inside the scale, thus we have C major, D minor and E minor as expected.

`<c e g> <d f a> <e g b>`

As always please share any questions or feedback in a comment!

2 thoughts on “Can you shift pitches to a different mode in Frescobaldi?”

1. Guy Stalnaker

Thanks Peter ðŸ™‚ I confess I was daunted by the method required to manually add your patch/work to my 2.17.x install of Frescobaldi. Today I punted and downloaded/installed the 2.18 Dev with Git and it’s all good.

I’m glad my query to the LP list was stimulating.

So you’ll know, one potential use for this kind of function, from my perspective, is doing mode changes to a work to see how such a change affects the sound of a piece. For example, I recently wrote an O Magnum Mysterium in e Phyrgian. I wanted to hear how it sounded in e Major. Before your work, I’d have to manually modify all pitches individually to do such an experiement (which is what I’ve done in the past). Now I can select/mode shift, compile, and listen to see how it sounds. A great time saver.

As a composer, this kind of playing around is invaluable (as well as just plain fun).

That O Magnum Mysterium is better in e Phrygian (though not half bad in e Major).

Thanks again!

1. Peter Bjuhr Post author

Thanks Guy! Great that you find it useful! I also think that it can be a good composition tool.

I’ve actually just made an update. Now the dialog is more user-friendly. And I’ve added some modes – so now you can also change from major to phrygian, for example.