# The relation between making a note from "pitch & duration" and "name & octave"

This question might need some computer science information as well, but I'm stuck in the music theory side of it: I'm trying to use a library in Python (the programming language) called Mingus that makes a `Note` object given the name and octave of a note, and there is also another library called JythonMusic which makes a `Note` object from pitch and duration. Because the second one is very outdated, I cannot use it for my purpose, so I'm trying to figure out from a music theory perspective if it is possible to convert between these. And if yes, how.

In case you have some computer science background, it would probably help you to check the documentation of these libraries (hyperlinked on their names above) in order to answer me.

I need to mention that I have no background in music theory so I don't know how meaningful my question is, but hopefully someone can help me. Please let me know if you need more details.

• Depends on how much different temperaments or microtonality mean to you I think, I found a cool page called xen-calc that given a pitch ratio gives a name for it, it is the most detailed one I have ever found.
– Emil
Jun 15, 2022 at 14:59
• Mingus doesn't store duration in the note object, instead it stores it in the bar - so a mingus note can only encode the pitch from jythonmusic, the duration has to be converted when you add the notes to a bar
– sqek
Jun 15, 2022 at 15:06

In music theory terms, pitch and duration are independent elements. Knowing one gives no information about the other.

In Mingus, note names and octaves are considered as separate elements defining a single pitch; whereas JythonMusic just uses a single number for the same purpose. The correspondence can be seen by using Mingus's int() function on a note.

But duration is entirely separate.

JythonMusic specifies duration as part of the `note` object, while Mingus places it in the `bar` object.

Mingus must have a way of indicating duration. Note name and octave are a way of specifying pitch.

JythonMusic specifies pitch as a numeric quantity corresponding to a MIDI key identifier. Tables mapping these to name-and-octave values should be easy to come by, for example at https://en.wikipedia.org/wiki/Musical_note#Note_designation_in_accordance_with_octave_name

To convert fully from JythonMusic's pitch-and-duration, you'll need to find out how Mingus handles duration.

• Mingus durations are assigned in the "bar" object. Jun 15, 2022 at 16:51
• @Aaron thanks. I'm way too busy to do any research for the next few days. Why isn't this helpful information in your answer? If you add it, you will surely get some upvotes (I have already upvoted for the mention of `int()`). Jun 16, 2022 at 6:56

As far as I understand this Mingus does identify a note with the pitch, but not with the duration. You can then add notes, rests and chords along with some duration at some time to a bar, as given in Page 3 of the Tutorials. So it is not exactly possible to convert between these two note objects as they store a different amount of information, with JythonMusic also storing the duration, while Mingus does not and infers the duration externally.

• "infers the duration externally": how? Jun 16, 2022 at 6:57
• @phoog I have not studied how exactly Mingus stores the Music, but it seems like a bar is basically filled by triplets `(time, duration, note(s))`.
– Lazy
Jun 16, 2022 at 7:48

Just to state the absolutely obvious.

Pitch: The frequency of the sound wave. Same letter pitches imply a power of 2 relation between them. So to compute the physical frequency f you'd calculate:

`f = base_frenquency* 2^(Octave)`.

So the A above middle C, on a piano, is 440Hz and if you'd want to have 2 octaves above that then it's

`440Hz*2²=440Hz*4= 1760Hz`.

Or if you want the 3 octaves below that than it's

`440Hz*2^(-3)= 440Hz *1/(2³) = 440Hz *1/8 55Hz`.

So if you have a frequency value for one of the note names (those can be looked up) and can figure out how man octaves are between that and your note, then you can compute the physical frequency or vice versa.

Though that is the physics point of view, a musician is usually fine with frequencies being obfuscated by letters. They are mostly interested in the note names as their relative distance creates melody (played sequentially) or harmony (played parallel). And the octave is relevant for a musician in terms of whether it's within the range of their instrument and how the fingers and/or air stream have to be manipulated to achieve that sound.

The duration: Is ... well the duration of how long you hold the note. It's usually indicated by a combination of the a relative time scale like the note length idk quarter, half, full, eights and so on. AND with an absolute descriptor telling you idk that you play idk 120 quater notes per minute or something like that, could also be that it's just implied with a vague word like "vivid" or "grave" or whatnot indicated it should be played fast or slow but left to you what exactly that means (there are also tables that give a rough estimate). Or if your program is more technical it could be a literal time duration in seconds or milliseconds.

So you can use the name+octave to infer the frequency from it but you'd need to find a different place to make use of the duration information as that is apparently not handled at the note object.