back to list

calculation cent to Hertz

🔗kopiez@xxxxxxxxxxxx.xx

11/8/1999 3:26:09 AM

Could anybody please post the formular to calculate a distance in Cent from
a given basic frequency to the second frequency-value in Hz?

Thank you,

Reinhard Kopiez

🔗Dale Scott <adelscott@xxxx.xxxxxx.xxxx>

Invalid Date Invalid Date

At 11:26 AM 11/8/99 +0000, you wrote:
>From: kopiez@hmt-hannover.de
>
>Could anybody please post the formular to calculate a distance in Cent from
>a given basic frequency to the second frequency-value in Hz?
>
>Thank you,
>
>Reinhard Kopiez

1. Divide the upper frequency by the lower frequency.
2. Find the log of this.
3. Divide that by the log of 2.
4. Multiply by 1200.

🔗Rick McGowan <rmcgowan@xxxxx.xxxx>

11/8/1999 11:25:26 AM

> Could anybody please post the formular to calculate a distance in
> Cent from a given basic frequency to the second frequency-value in Hz?

If a C program is useful to you... Here's a command-line program that
calculates the frequency a given number of cents above (or below) some given
frequency.

Rick

-- --

#include <stdio.h>
#include <math.h>

#define TWELVE_00th_ROOT_2 1.000577

/* (approx 1.0057929414) to the 120th power = two to
* within 7 decimal places. Use this to calculate
* frequencies. Take the number of cents, divide
* by 10 to get 120ths of an octave. Then figure
* out the frequency ratio by taking:
* 1.0057929414 ^ (given_cents / 10.0)
* Once we have the frequency ratio, multiply that
* by the given base frequency.
*/

#define ONE_20th_ROOT_2 1.0057929414

main(argc, argv)
int argc;
char **argv;
{
double base, cents;
double ans;

if (argc != 3) {
printf("Usage: freqc base_freq cents\n");
exit(1);
}
base = atof(*++argv);
cents = atof(*++argv);
printf("Base: %1.4f Cents: %1.4f\n", base, cents);

ans = pow((double) ONE_20th_ROOT_2,
(double) cents / (double) 10.0);
printf("%1.4fHz + %1.4f cents = %1.4fHz\n",
base, cents, ans * base);
exit(0);
}

🔗Adrian van den Dries <adries@xxxx.xxxx.xxx.xxx>

11/8/1999 6:36:09 PM

I guess you'd calculate the linear value by:

linear = 2 ^ ( cents/1200 )

and then multiply the base frequency with your linear value.

Eg.

[800cents above 300Hz]

linear = 2 ^ (800/1200)
linear = 2 ^ (2/3)
linear = 1.5874

300 * 1.5874 = 476.2Hz

> From: kopiez@hmt-hannover.de
>
> Could anybody please post the formular to calculate a distance in Cent
from
> a given basic frequency to the second frequency-value in Hz?
>
> Thank you,
>
> Reinhard Kopiez
>
> > You do not need web access to participate. You may subscribe through
> email. Send an empty email to one of these addresses:
> tuning-subscribe@onelist.com - subscribe to the tuning list.
> tuning-unsubscribe@onelist.com - unsubscribe from the tuning list.
> tuning-digest@onelist.com - switch your subscription to digest mode.
> tuning-normal@onelist.com - switch your subscription to normal mode.
>