• ### Midi to hz, and hz to midi formulas

hello, its me again with more newbie questions.

im studying with johannes kreidler book and there is a formula on converting midi notes to hertz on chapter 3 (audio) that im not sure i understand.
i know there are [mtof] and [ftom] objects but since its on the book as a formula im guessing its important and i wouldnt like to skip it just because the computer can do it for me.

according to the book the midi to hz formula using the [expr] object is
expr 440*(pow (2, ((\$f1-69)/12)))

if the midi note is 39, the frequency is suppossed to be 77.78 but when i try to do it with my calculator i get a wrong result.

there is also the inverse formula for hz to midi which is

m= 69 + 12 . log2(f/440)

if someone could break these formulas down for me it would help me understand how these objects work.
(i already know expr and variables, im sure im not reading the formulas right).

• Posts 8 | Views 13902
• I don't know any formula for what you want, but just thought that you, or somebody else who visits this thread, might find the attached "Pitch to Frequency Mappings" file to be of some use along such lines.

Good luck, and keep well ~ Shankar

http://www.pdpatchrepo.info/hurleur/0.Pitch-2-Frequency-Mappings.pdf

• tried it also

this patch(as attach) would work

best regards

addisaden

http://www.pdpatchrepo.info/hurleur/midi2ton.pd

@addisaden

• A few pointers, if you might allow me to expound:

The equation describes only equal temperament, and the 69 MIDI value is to correct for the value of the reference key of A4, above middle C.

The assumption of equal temperament proves a repetitious vexation, denotes ignorance, apathy, laziness, and/or unfamiliarity with the math of music. Worse, this assumption proves far too common among engineers / mathematicians / scientists / software programmers. Which then deprives us musicians of useable tools, and the stupidity of the need for MIDI tuning standard / scala / etc, is the vacuum such engenders.

Troubling how in this modern age, they teach his geometric theorem, yet not his music, nor his math relevant to music. Yet we laud him as the grandfather of the Western tradition of music, owing to his discovery and delineation of the mathematic definitions in ratios of the twelve notes of all of Western music. Pythagoras of Samos might well concur: the math we teach is a decrepit wretch of an invalid -- incomplete, fragmented, not useful, and regarding certain fundamentals, dead wrong.

How few know how, when, and why the value of the third decimal onward ad infinitum of Pi needed to be re-evaluated, recalculated for better precision in the latter part of the 20th century, for instance. Yet how few are taught the corrected, more precise value of Pi -- in any school or university in the land? Pi had to be re-evaluated in the 1960s given the orbits of our species' earliest satellites resulted in the falling-back to earth of each one of them due to the value of Pi we were and still are taught in school is not precise after the second digit. The circles we calculated the orbits to be proved each to be slightly short of a true, pure circle, thus returning the satellites to the ground. Pi more precisely can be evaluated to 3.1446055, and not the perpetuation of imperfection, and the maintenance of ignorance still taught today.

Hope this helps,

F.

• well, to contribute to the vile institution of equal temperament then:

in the first equation the input has 69 subtracted from it. This is in order to get the semitones difference between the input note and 69, which is the a above middle c, (the standard is that this note has a frequency of 440). Then this is divided by 12 in order to get the number of octaves that the input is different from a440 (linearly). 2 is then raised to this power.
The reason for this is that if 2 were raised to the 1st power, 1 octave would be traversed upward. similarly, if 2 were raised to the -1 power the octave would be traversed down, because 2^-1 = 0.5, which is a frequency of the octave below.

And because the midi note 69 was the reference point, what is being determined is the ratio of the frequency difference between the input and a440. Therefore, once we know the frequency ratio between the input note and midi note number 69, it is multiplied by 440 in order to get the result

the next formula is this one in inverse:
The input frequency is divided by 440 to get the frequency ratio between the input and 440. Then log2 is taken of it, which is the power that 2 needs to be raised by in order to get the ratio. So this will be the number of octaves difference between the 2 notes.
The number is multiplied by 12 to convert to 1/2 steps, and then 69 is added to get back up to the note a above middle c because 440 was the reference point in the beginning

@dangrondang out of curiosity, do you have any references for the accepted value of pi being wrong? for all of the talk about the sanctity of mathematics this other value does not seem to agree with mathematical principles relating to series convergence formulas for pi. A simple one of these formulas is the Leibniz one. There is a proof of it on the page also
Regarding your putrid opinion on equal temperament, I would also be curious how you would modulate freely between keys on a keyboard instrument. Are you advocating for well-temperament? a system of pythagorean tuning with movable root? The reason equal temperament exists is mainly to create a system where all keys sound the same. Much of music by the mid-1800s e.g. Beethoven was already freely modulating to far away keys and that does NOT sound very good in pythagorean or even simple well temperament (although certain keyboards in the day had many "versions" of notes and scales)

edit: didn't realize this was such an old topic! oh well, perhaps useful still

• @dangrondang wrote:

The circles we calculated the orbits to be proved each to be slightly short of a true, pure circle, thus returning the satellites to the ground. Pi more precisely can be evaluated to 3.1446055, and not the perpetuation of imperfection, and the maintenance of ignorance still taught today.

Sorry to be blunt, but what you are stating is awfully incorrect and the way you proclaim to know this "hidden truth" is really awufully ignorant. So you are stating that there is a mistake on the 3rd decimal digit of pi... It so happens that this decimal place was precisely calculated centuries ago, and the result still (obviously) stands today. There are tons of different approaches on how to get correct digits of pi, such as by using certain convergence series as mentioned by @seb-harmonik.ar. One can manually calculate the 3rd digit of pi using these type of series, and this result has been known for more than a millennium (in the year 480, the value known was 3.1415926, which is way more precise than what you state. By the early 18th century, we knew 100 digits of pi, none of which have been "corrected" later on. See: https://en.wikipedia.org/wiki/Chronology_of_computation_of_π). There is no way that in the 1960's pi had to be defined as 3.1446... instead of 3.1415..., that is just pure ignorance and witchery.

But reading about your number on the internet, I found that this 3.1446055 appears in several articles about satellites, pyramids and all that "dark hidden world that nobody tells you about open your eyes sheep people controlled by the illuminati" kind of talk, but not a single time in a serious mathematical or physics website/journal/wiki. Sorry but the world is not a dark place controlled by people with magic powers trying to keep you in the shadows... simply do not use random blogs as source of information.

The assumption of equal temperament proves a repetitious vexation, denotes ignorance, apathy, laziness, and/or unfamiliarity with the math of music. Worse, this assumption proves far too common among engineers / mathematicians / scientists / software programmers. Which then deprives us musicians of useable tools, and the stupidity of the need for MIDI tuning standard / scala / etc, is the vacuum such engenders.

As for the "stupidity" of using a tempered system, that is just as stupid as using a non-tempered one: it is simply a convention, upon which we built centuries of music. Western music has been based on it for long time (although contemporary composers, myself included, often choose to use micro-intervals), and the decision to create MIDI around this is as logical as it gets when you think what they were aiming at. Or should we have went through all sorts of trouble to incorporate all crazy stuff in the MIDI protocol (which is an Western creation), such as the possibility of having Indian micro-tonal scales? But wait, then what about gamelan scales? No wait, what about <insert ethnomusic genre here> scales?

From a practical point of view, you can still use MIDI cents, and you can also directly use frequencies if you want to precisely define the pitch of a sound. You can compose music in 12-tones, 27-tones or 193-tones if you wish to. The tools are here, and Pd allows you to do whatever you want with them (I myself have composed works using Pd and MIDI that deals with microtones and microtonal glissandi in real-time).

I hope you won't get personally offended with my message, but I can't really read this type of statement, which tries to propagate pseudo-scientific kind of stuff, without writing a strong reply.

Best,
Gilberto

• As for the initial poster who wrote (5 years ago!):

if the midi note is 39, the frequency is suppossed to be 77.78 but when i try to do it with my calculator i get a wrong result.

The formula [expr 440*(pow (2, ((\$f1-69)/12)))] is correct and 77.78 Hz is what you are expected to get indeed. You probably are (or rather were) having some troubles with the order of the operations and parenthesis. Doing it part by part, you get:

39 - 69 = -30
-30 / 12 = −2.5
2^(-2.5) = 0.176776695
440 x 0.176776695 = 77.7817458

Best,
Gilberto

• I've recently taken "the tour" to Mathematics Stack Exchange. Initially, I thought it was going to be some sort of light-hearted pics plus some words about the site. Fortunately, it was much better than that.

"The tour" is an interesting way of inviting you to read the rules. I think these rules also act as a reminder, a reminder of the important stuff.

You can, of course, take the "tour" by yourself, but these are some of the things you can read there.

• Ask questions, get answers, no distractions.
• This site is all about getting answers. It's not a discussion forum. There's no chit-chat.
• Get answers to practical, detailed questions.
• Focus on questions about an actual problem you have faced.
• Not all questions work well in our format. Avoid questions that are primarily opinion-based, or that are likely to generate discussion rather than answers. Questions that need improvement may be closed until someone fixes them.

http://math.stackexchange.com/tour

As @dangrondang (F.) said, hope this helps.

Cordially, Landon

I live and love in Argentina

Posts 8 | Views 13902
Internal error.

Oops! Looks like something went wrong!