Music theory help: Different kinds of melody inversion

• Feb 9, 2023 - 19:12

Please let me know if there is a better place I could be asking this. I am using musescore to do this but it is a general question of music theory.

I was trying out some various forms of canon (I am very new to composition and have no real background in music theory), and I started adding melody inversion. I just did what intuitively made sense to me, and it sounded good to me. But then I went to define a melody inverter in code and realised that my intuition was doing something unusual. The official way to invert a melody according to every source I could find is to invert the sequence of notes around its own middle pitch. I understand why this is a sensible way of doing things but the way I was doing it sounds really interesting too.

I was simply inverting everything by eye around the middle of the staff (B on treble), so ABCDE becomes CBAfe. Effectively I am just flipping the staff upside down. Is this also a thing people do? Is there a name for it?

What I am actually working on is a helper program for making canons quickly, so I need to automate this process, but when I do I am not getting the result I expect. I am taking the B line, which is pitch 71, and simply changing the pitch of each note like:
newPitch = middleNote * 2 - oldPitch;
where middleNote is 71. What I am getting is that about half the notes in my sample melody are inverted as I expect, and about half are one semitone too high.

The act of visually inverting a melody about the middle of the staff seems to be mathematically much more complex than I thought, due to hidden semitones in the staff lines.

  1. Why does what I am doing intuitively sound tonally correct, and the mathematical version of it sounds terrible?
  2. Why does melodic inversion according to the official method sound so unsatisfying for so many melodies?
  3. (Not a music theory question, so I will understand if I don't get an answer here) Is there a programmatic way I can encode my intuitive inversion technique so that it always matches what I would do by hand?

Comments

Here is a file showing what I mean, the first 4 bars are a standard inversion (please let me know if I got this wrong), which sounds ok, the next 4 bars are the inversion I was doing by hand which sounds better in my opinion, as far as it goes with such a boring melody.

Attachment Size
Inversion example.mscz 24.09 KB

In reply to by Duncan124

Everyone will have their own viewpoint.
Theory is a set of rules that explains how things have been done. How should you do things is up to you. If you follow the rules and don't like the result, you have wasted your time. You need to write what you like. It is an expression of you. This has always been true. Otherwise, why bother.
If you want to write a fugue that sounds like Bach, then there are certain things you mus do. But the result will just be a copy of what has already been done. It will be a good exorcise, but not very creative.

In reply to by bobjp

Thanks, it is good of you to say that. But in the end I am trying to learn. I want to understand more about music and how it works. Of course slavishly copying what Bach did will only get me some insight into Bach, but I have to start somewhere. I guess I am curious about other people's experiences, and also developing a deeper understanding of how music theory works.

To western ears a melody only sounds harmonious, rougly speaking, if it belongs to a Major or a minor scale. These scales have no mirror symmetry, and the inversions you suggest take you out of the standard idiom (no Major or minor scale).
In fact, if you flip a Major scale around its root, you get a minor scale (see bars 1-4): G Major becomes C minor (a deep mystery that Music theorists have been pondering since a long time).
That in turn suggests that if you flip a G major tune around g you might get something in the style of a minor variation on a Major theme. This I illustrate in bars 5-8 (Tie a Yellow Ribbon) in G Major, flipped around middle g results in a minor Yellow Ribbon (bars 9-12, not awful, but not great). If I flip bars 5-8 around b (pitch 71) I get bars 13-16, sounds atonal and does not belong to a Major or minor scale.
test.png
On another ‘note’, you might also be interested in the New RetroGrade Plugin (which flips your melody horizontally) and the Negative Harmony Plugin; these you can find in https://musescore.org/en/plugins

Attachment Size
test.mscz 9.99 KB

In reply to by elsewhere

Thanks that is useful. I actually have the retrograde plugin already, I found it while searching for something like what I am making. How do you get the sheet music to display here in the forum?

My main aim is to find ways of manipulating music in systematic ways so that the new version and the old version harmonise with each other, which unless I am quite mistaken, is basically what writing canons is all about. It does not have to work automatically for every tune, the composer obviously needs to make choices and set things up so that it works. I am not trying to make AI generated music, I feel like that misses the point entirely.

I made a mirrored version of the music you posted to see what would happen. It harmonises with itself without being too ugly on a large percentage of the notes. There are a few really discordant ones though. I also added 8 extra bars at the end, because my main interest is finding variations that harmonise to some degree with the original melody, not in discovering new melodies that stand on their own. As you correctly point out, the flip around g is actually quite nice. The other one is a mess. But the way you flipped it is also the mathematical one rather than the instinctive visual one I was using when doing it by hand, the asymetry of the staff is not compensated for. If you compare bars 5-8 with my visual mirroring with the last four, using the mathematically correct tone mirroring, I think the first example sounds better.

Either way, this has given me a lot to think about, I certainly feel clearer in my head about what is going on here. I think I will keep trying to implement the mirror feature, despite it not being standard practice in composition, because I think it sometimes yields very interesting results. I would also be interested to know how you knew that mirroring around g would sound better for that sequence. Was that instinct, knowledge of music theory, trial and error or something else? I am wondering now if it might be worth reworking that feature so that the composer can choose a note to mirror around rather than always using the center of a treble staff.

The other nice thing is that this discussion actually gave me an idea as to how I could make it work mathematically, it is all about the fact that the staff is effectively asymetrical in hidden ways, and if I simply build a map of those asymmetries in code I should be able to compensate them out.

Thanks everyone for your contributions so far this has been quite illuminating.

Attachment Size
test_1_mirrored.mscz 30.86 KB

Do you still have an unanswered question? Please log in first to post your question.