| Sorry to quibble, but I find these things very important!
386c is a pure major third, indeed, but A to C is a minor third.
So the correct numbers would be C = 523.252, A = 440 in equal temperament. The
ratio for the pure minor third is 6/5, = 316c, which would put C at 528Hz. Much
better!
Richard Dobson
Ruston, Paul wrote:
>
> I doubt if this is what you need exactly but if your math skills are any
> better than mine, you may be able to adapt it to your purposes.
>
> To calculate the size of a ratio (interval) in cents:
>
> 1200 x log2 (f 1 / f 2) = size in cents (where f 1 represents the
> largest component of the ratio). "f" could also be expressed as two
> actual "f"requencies.
>
> e.g. 1200 x log2 ( 5 / 4 ) = 386 cents
> or
> 1200 x log2 (550 Hz / 440 Hz) = 386 cents (A to C expressed as a pure
> major 3rd)
>
> I think you would then need to have something that converts cents to
> 'oct', which shouldn't be too hard. However, I never use 'oct' so I
> have no further suggestions. (Is this what you're looking for at
> all???)
>
> Paul Ruston
> >-----Original Message-----
> >From: Tobiah [SMTP:toby@rcsreg.com]
> >Sent: August 13, 1998 1:12 AM
> >To: Csound Mailing List; toby@rcsreg.com
> >Subject: Modifying AIFF soundfile information...
> >
> >I have it in mind to write a utility with which one can modify the
> >base frequency of an AIFF file. With this capability, it will be
> >an easier task to make banks of samples for loscil to read.
> >
> >Firstly, does anybody know of such a utility or application? I am
> >looking forward to writing the program, but would rather use an
> >existing one. By the way, there is an excellent sound editor for
> >UNIX called 'DAP' which has a really nice interface for auditioning
> >and setting the loop points in an AIFF file. See Dave Phillips' page.
> >
> >Second, there is a bit of code in 'aiff.c' that calculates the raw
> >Hz value of an AIFF sample from the 'baseNote' and 'detune' values
> >in its InstrumentChunk. This is used by sndinfo to report the raw
> >frequency, which is not otherwise stored in the AIFF file. Here is
> >the code:
> >
> >
> >double onept = 1.021975; /* A440 tuning factor */
> >
> > oct = (instr.baseNote + instr.detune/100.) / 12. + 3.;
> > adp->natcps = (float)(pow((double)2.0, oct) * onept);
> >
> >I understand this code, but why is 'onept' necessary? Isn't MIDI
> >based on A->440? Anyway, my real question is one of mathematics.
> >I would like to have the ability in my prospective utility to translate
> >the natural frequency in the other direction; that is, to convert
> >a Hertz value to (basenote, detune). The thing that is tough for me
> >is reverse engineering the call to pow(). natcps = 2^oct, but then
> >how does one solve for oct? The word logarithm is seeping in from
> >high school memories, but they are to vague to be of any help to me.
> >
> >Thanks,
> >
> >Toby
> >
> > -There otta be a law-
> >
> >~
> >~
> >~
> >~ |