3
$\begingroup$

I often have to do calculations that pertain to musical intervals, i.e. the ratios between two pitches. E.g., the interval that commonly we call a "major third" (c-e, d-f# etc.) can be expressed as a 5/4 ratio (in so-called "just intonation").

Now consider such a ratio, such as 5/4.

Assume that, for our purposes, every ratio that, as a whole, is half as big, (or a quarter, or two times, four times...) is "as good as" that ratio. In other words, we consider 5/2, 5/8, 5/16 etc. equivalent to 5/4. Musically speaking, all those ratios express the same "pitch class". So if 1/1 were our c and 5/4 our e, then those "new" ratios we would call ,e, e' e'' etc., but they're all es.

Now assume that whenever I'm working with a ratio, I always want to stay within one octave, i.e. between 1/1 and 2/1. Every ratio that is generated in the process needs to be (and here's where, as mathematical layman, I run into terminological problems) "folded back" into one octave, i.e. be constrained between 1/1 and 2/1.

Say I wanted to calculate the pitch that we arrive at after stacking a few such major thirds on top of each other:

5/4 * 5/4 * 5/4 * 5/4 ...which, to most people, would be 625/256. But to me, as described above, it's 625/512.

Doing my maths with pen, paper and my head most of the time, none of this is a problem. I simply halve, double, etc. the nominator or denominator, and that's it (here: double the denominator).

But how would we solve such a problem in an automated way? I admit to using Excel once in a while to work on my music theory stuff (besides a dedicated application called "Scala" which is of little help in this specific problem). Suppose you only had Excel available as a tool, how would you go about it? How would you constrain the result of a division between two poles? Any advice is appreciated!

$\endgroup$
1
$\begingroup$

At each step of the multiplication, if you get a result larger than or equal to $2$, divide the result by $2$. (It's easier to do this at each step than to figure out how many times to divide by $2$ after all the multiplications. The Excel formula to divide a number (say in cell B2) by $2$ if it is at least $2$, but leave it alone otherwise, is =IF(B2>=2,B2/2,B2).

Here is a screenshot of a bit of Excel sheet that used a variation on this formula. [Corrected from original posting.] Hope it helps. (In case you're wondering, the formatting for the fractions is a custom format string, #######/#######.

enter image description here

You could also do this using the frequencies, instead of just the ratios, if you divide by $2$ when the result is twice the original base frequency or greater.

enter image description here

$\endgroup$
  • 1
    $\begingroup$ thanks, that should do the job! Given that the basic formula is that simple (which I wasn't aware of), I think I'll take that as an opportunity to start working with VBA scripts. Should be feasible (even for me) to code something that loops through the process of doubling/halving until the result is between 1 and 2. $\endgroup$ – Nils L Jan 4 '18 at 20:51
1
$\begingroup$

On terminology: Given a frequency ratio, you're asking to canonicalize the ratio. That means you are finding its canonical form, or in other words, the canonical representative of its equivalence class modulo $2$.

On implementation: If $\{x\}$ denotes the fractional part of a number $x$, then you want to compute $2^{\{\log_2f\}}$ where $f$ is your original ratio. In Microsoft Excel, you should be able to implement $\{x\}$ as MOD(x, 1). See: https://support.office.com/en-us/article/MOD-function-9b6cd169-b6ee-406a-a97b-edf2a9dc24f3

$\endgroup$
  • $\begingroup$ Very enlightening! I did have the feeling that the problem is mainly in my lack of proper terms, otherwise I would have known better what exactly to look for. I'll give that a try as well. $\endgroup$ – Nils L Jan 4 '18 at 20:54
  • $\begingroup$ And I'd imagine that calling the built-in MOD function is way, way easier than calling a custom script with an iterative loop, so if you just want to get the job done, consider trying that first! $\endgroup$ – Chris Culter Jan 4 '18 at 21:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.