This baroque era tuning seems to be a popular method for performing pieces like Bach’s well tempered clavier. It is a tuning system based on the Pythagorean tuning but “tempered” with so it would sound well on different chromatic scales.
First, let us look at the basic method for deriving frequencies using the equal temperament (ET). Taking A440 (concert pitch A at 440hz), we can calculate frequencies by doing this.
var noteFrequency = 440 * Math.pow(2, semitones / 12);
where semitones is the number of semitones away from the concert A. Pretty simple right?
Instead of a universal formula for ET, or recalculating the tempering of frequencies, we would use the chart for frequency relation of the Werckmeister I (III) system ["correct temperament" based on 1/4 comma divisions], conveniently taken from wikipedia.
Since there’s 12 distinct notes in an octave, to get a frequency of a particular note, you multiply the relative ratio of the note you wish to get. For different octaves, with simply half or double the frequency, which can be expressed as powers of 2, eg. Math.pow(2, octave_difference);
So after we precompute the ratio table into rational numbers, we can calculate and check cents by running Math.log(werckmeisterRatio)/Math.log(2)* 1200 ) on each note. The precision you would get would be higher than the rounded numbers in wikipedia.
Now, what’s left is to multiply the frequency ratios to a real frequency, but what frequency should we use? What’s more puzzling is that the base frequency for the charts is using C and intead of concert A. But no worries, my friend tells me 415hz (or even 390hz) is usually used for the baroque A, and with that we can estimate the frequency of C. [This topic of frequency is always an area of debate. But a reason how they calculated the lower baroque pitch, at least from a book I’ve read, is by measuring the frequencies created by organs from the baroque era]. One way you could do it is by running baseFrequency = 415 / Math.pow(2, 9/12);
(If you’re observant enough, that’s a equal temperament formula. for the werckmeister method, check out the source code)
Free entrance @ http://jabtunes.com/labs/werckmeister/ (Firefox attire recommended:)
p.s. relevant source code for midi number to frequency using werckmeister’s tuning @ https://gist.github.com/1406293
p.p.s. actually, what’s unclear is that in a chamber setting, what temperament do instruments apart from the keyboard use? to the real musicians, please enlighten