I've talked a little bit on this blog about microtonal counterpoint, but my theories and my programs for composing it aren't very far along. Indeed, even just for regular counterpoint in 12-TET, I've never written a program that gets all the way up to fourth-species Fuxian counterpoint, to say nothing of florid or imitative counterpoint. I have a long way to go. But microtonal counterpoint is important to me and I'm going to re-devote myself to the project. Right here.
:: Contrapuntal Motion
When two simultaneously sounding voices each move by their own melodic intervals to new notes, the discipline of counterpoint classifies the relative motion in terms of the relative sizes of the melodic intervals and whether the voices cross. These contrapuntal motions are one of the most important things in counterpoint.
This is already a challenge for the theory of microtonal counterpoint, because intervals in one microtonal tuning system won't be the same size as intervals in another. There isn't, in full generality, a fact of the matter as to which of two intervals is larger, including whether an interval is larger than P1. In my post Orders of Modified Musical Intervals, I wrote about how if we assume that we're writing for tuning systems that preserve the order of natural intervals found in 12-TET, then that assumption induces a partial order over all rank-2 intervals. We could consult this partial order for composing and arranging; with it, we have some guarantees about relative interval size, and maybe we could constrain ourselves to writing with respect to those guarantees.
I'm proud of that post, and I stand by it in theory, but I'd also like an easier way to compose than consulting that partial order graph. My new plan is to compose for rank-2 tuning systems in which P1 < d2 < A1. I'll call this the meantone constraint. This constraint is true of the meantone tuning systems, and of 31-EDO, and of any other rank-2 pure octave syntonic tuning system that tunes P5 to a value between 2^(10/17) and 2^(13/22). It's a good family to work in. Also, for higher-rank tuning systems, the meantone constraint holds in Lilley's 5-limit just intonation tuning system, and in all three of the septimal extensions I've considered to Lilley's 5-limit system. The meantone constraint does not hold true in Pythagorean tuning or in 19-EDO; indeed, of the five families of once-modified interval orders that I identified in the Orders Of Musical Intervals post, only one family has A1 and d2 larger than P1. This assumption certainly isn't universal - but it's our starting point for this blog post. By tuning the octave purely, t(P8) = 2, and by also tuning one of the intervals below to a value below, we can get a few different famous members of the Meantone family of tuning systems:
t(M3) = 5/4 # Quarter-comma meantone
t(A4) = 45/32 # Sixth-comma meantone
t(dddd3) = 1/1 # 31-EDO
.
Given the meantone constraint, it's fairly easy to compare the size of most simple rank-2 intervals. First, we represent intervals in the (A1, d2) basis, as we have done so often in the past. Here are some familiar intervals in (A1, d2) for reference, specifically ordered here according to quarter-comma meantone tuning:
AA0 : (1, -1)
d2 : (0, 1)
A1 : (1, 0)
m2 : (1, 1)
AA1 : (2, 0)
dd3 : (1, 2)
M2 : (2, 1)
d3 : (2, 2)
A2 : (3, 1)
m3 : (3, 2)
AA2 : (4, 1)
dd4 : (3, 3)
M3 : (4, 2)
d4 : (4, 3)
A3 : (5, 2)
P4 : (5, 3)
AA3 : (6, 2)
dd5 : (5, 4)
A4 : (6, 3)
d5 : (6, 4)
AA4 : (7, 3)
dd6 : (6, 5)
P5 : (7, 4)
d6 : (7, 5)
A5 : (8, 4)
m6 : (8, 5)
AA5 : (9, 4)
dd7 : (8, 6)
M6 : (9, 5)
d7 : (9, 6)
A6 : (10, 5)
m7 : (10, 6)
AA6 : (11, 5)
dd8 : (10, 7)
M7 : (11, 6)
d8 : (11, 7)
A7 : (12, 6)
dd9 : (11, 8)
P8 : (12, 7)
All of the other contrapuntal motions assume non-crossing. Once we've established non-crossing, then we don't need the harmonic intervals anymore to classify the motion, we just need the melodic intervals, e.g. {v2(t + 1) - v2(t)}. If melodic intervals in v1 and v2 sampled between two times (t) and (t+1) are both larger than P1, or both smaller than P1, or both equal to P1, then the motion is called "direct". If the motion is direct and the intervals are the same, then the motion is "parallel". If the motion is direct and the intervals differ, then the motion is "similar". If motion is not direct, we have two more options: If one melodic interval is equal to P1 and one is not, then we have oblique motion. If the motion is not direct and neither melodic interval is equal to P1, so that one melodic interval is larger than P1 and one is smaller, then the motion is contrary. Here's a hierarchy that's also a decision tree, sort of.
My guess is that it's not terribly easy to get cool pitches or intervals by following the Fuxian rules of counterpoint. The rules do a good job of keeping us in the space of natural intervals, with occasional deviations into once-modified intervals, but almost never will we reach twice-modified intervals or higher. The obvious way to get to weird intervals faster is to expand the set of melodic and harmonic intervals that we allow ourselves to use. For example, in 12-TET, the m3 and M3 are considered consonant harmonic intervals, but in other EDOs, microtonal composers often use nearby intervals as if they were consonant thirds, e.g. Zheanna Erose talks about the use of basic triads in 31-EDO built by combining the following intervals harmonically with P1 and P5:
But let's follow the rules before breaking them. I'll be developing my programs on the exercises in Jacob Gran's counterpoint youtube videos, starting with How to Compose 1:1 Counterpoint || Tonal Voice Leading 1. You may find his voice more bearable at 2x speed or faster. He starts us out with this cantus firmus composed by Salieri:
We're going to write a counterpoint melody above that. Each counterpoint note has be a consonant interval above the note sounding at the same time in the cantus firmus. Our consonant options are:
with P1 only being an option on the first and last notes. Gran tells us that we can't use two perfect consonant harmonic intervals (i.e. P1, P5, P8) in a row. You've got to throw in some imperfect consonant harmonic intervals, (m3, M3, m6, M6, m10, M10), for spice. And for now, we won't use any dissonant harmonic intervals, those being (2nds, 4ths, 7ths, augmented intervals, and diminished intervals).
When Gran talks about scale degrees in this exercise, we're going to assume a major scale, (P1 M2 M3 P4 P5 M6 M7), over C natural. Natural C is also the first and last pitch class of the cantus firmus. Because we're writing a counterpoint above the cantus firmus, Gran tells us the counterpoint must begin on scale degrees ^1, ^3, or ^5. Among our consonant intervals, this limits us to P1, M3, P5, P8, M10.
The counterpoint can move melodically by these small intervals ("steps"):
(m2 M2)
up or down. So these seconds are ?consonant melodically, even though seconds aren't consonant harmonically. Different sets of intervals. Using non-positive numbers, we can write names for the descending versions of those steps, so the full set of ?consonant melodic steps could be written:
(m0 M0 m2 M2)
. The counterpoint can also move melodically by these large intervals ("leaps"):
(m3, M3, P4, P5, m6, M6, P8)
up or down. By embracing negative numbers, we can again write the full set explicitly:
(m3, M3, P4, P5, m6, M6, P8, m-1, M-1, P-2, P-3, m-4, M-4, P-6)
. Those are the ?consonant melodic leaps. Okay, I really want a different adjective. Harmonic intervals can be consonant, and melodic intervals can be... graceful? Fluent. The fluent melodic intervals are the fluent steps and fluent leaps.
The counterpoint can also move by P1, i.e. stay still. The cantus firmus won't have successive repeated pitches, so this is the only way that we'll get oblique motion between the cantus firmus and the counterpoint.
Gran also says that we can't use P4/P5 melodically between scale degrees ^4 and ^7. Weird flex, but okay. In a major scale, ^4 lies a P4 above P1, plus or minus some number of P8s, and ^7 lies a M7 above P1, plus or minus some number of P8s. Of course, we can't leap by more than an octave, but it might still happen that we reach scale degree ^4 or ^7 in a different octave by smaller motions, and then we'll have to do some tests.
Gran says that melodic leaps larger than a M3 are "typically" followed by step-wise melodic intervals in the opposite direction (i.e. the leaps are "recovered"), "especially" after leaping upward. The "especially" part isn't hard to code: I'll just always recover downward by step from melodic leaps upward that are larger than M3. The "typically" part is a little bit trickier: I'm okay with generating melodies probabilistically, but I'd like the part of my code that *verifies* melodies to be deterministic. I don't want a melody to be valid on one pass of my program and invalid on another pass. So how about these for deterministic rules: first, we'll always recover upward by step after a melodic leap downward that is larger than P4 in magnitude (i.e. less than P-2), and 2) no two successive downward melodic interval in sum will outline an interval more than A5 in magnitude, so that you can go down by P4 + M2 or M3 + M3, but not by P4 + m3 or m2 + P5. I haven't played with those intervals to see if they actually sound typical of a baroque setting, but I can change it later if it's not good. An A5 below P1 is better known as a d-3, a diminished negative third. No two successive melodic intervals of a voice shall sum to less than d-3.
Gran also gives some vague rules about how the overall melodic shapes of the cantus firmus and the counterpoint should differ. I'm not coding that and I'm not sorry.
You might be noticing that there are kind of a lot of rules, and we're only like halfway done. In my experience, this is one of the biggest challenges of writing counterpoint programs: there's a a lot of rules and weird special cases that make your code really ugly, and you'll get sad looking at it and quit for a few months, and when you come back to it, you'll want to start from scratch instead of looking at that awful code again. The next challenge is finding counterpoint melodies that satisfy all the rules, which is kind of like a fun search+optimization problem for computer science students, and the last challenge is wondering why you should keep working with all these rules when no one even likes baroque music, just play Driver's License by Olivia Rodrigo again, god damn. The second problem is fun and I have some new techniques I want to try against it, and my solution to the third problem is to instead make weird mathy microtonal music that challenges me and might help introduce me to some with weird mathy people who also like being challenged by art. But problem-one doesn't go away: the code's still going to be flaming garbage. Ready for more garbage? Cool.
Do you remember the types of contrapuntal motion, like parallel motion and similar motion? We've got rules about them now. First, the counterpoint can't cross the cantus firmus. Easy. Second, we can't approach a perfect harmonic consonance (e.g. a harmonic interval of P1, P5, or P8) by direct motion (parallel motion of similar motion). The contrapuntal motion that ends on a perfect harmonic consonance instead has to be indirect, i.e. it has to be contrary (with one interval larger than P1 and one smaller than P1) or oblique (with one equal to P1 and one unequal to P1).
Those are the rules as Gran presents them in the first exercise. You can find more rules in different sources, but these are a good start. Let's code up the constraints, find some solutions, and give the solutions a listen.
In the past, when I've tried to solve counterpoint constraints, I've tried a few strategies. One is to generate notes one at a time from start to finish, looking at the set of valid notes for the next time step and picking randomly from those. If you get to a point where there are no remaining valid steps, then abort and start over. This isn't memory intensive in each run, but it fails a lot, and it fails more with longer songs. Another thing I've tried is to a recursive function that can try every possible melody, which aborts, prunes, and backtracks when difficulties are encountered. This is more impressive and rarely fails, but it's slow and memory intensive and maybe overkill. One strategy I don't think I've ever tried is to make a complete song that violates some constraints and to then try to fix it by small edits. Not every optimization + design problem can be solved by small local edits, but I don't think I ever tried with counterpoint, and I'd like to. I'll eventually need to be able to make modifications to an existing phrase in order to compose imitative counterpoint, so I might as well figure that out now.
I kind of like the idea of making multiple passes through the contrapuntal melody in which you either:
* adjust things to satisfy the melodic constraints.
There's, um - I don't know if it's a bug in my code or if it's a psycho-acoustic phenomenon I didn't account for, but right now my software synth get *way louder* on higher notes, and it reminds me of that famous performance of the 20th Century Fox theme on kazoo. I definitely have to do something about that before I show you my code or any rendered melodies.
...
No comments:
Post a Comment