Archived

This topic is now archived and is closed to further replies.

Afterlife

OT : f = 440 * 2>(n/12) -> n = ... help...

Recommended Posts

Afterlife    122
*Whoops just noticed there was a maths forum here too, oh well..* I'm making a "tracker" for my game programming library 'cause there isn't a track player for djgpp that I know of. Could someone see what n is from the algorithm f = 440 * 2>(n/12) (rotate > 90 degrees to the left)? Logarithms aren't my strongest quality... Here's what I came up with in a couple of minutes... : 5f/440 = 10>(n/12) log(f/88)=n/12 n=12*log(f/88) ...which is wrong... yay gads I feel brain dead tonight, can't sort an algorithm this simple... Thanks for replying (hopefully) Peace out! Edited by - Afterlife on June 30, 2001 3:56:33 PM

Share this post


Link to post
Share on other sites
Vanukoff    122

f = 440 * 2^(n/12)

f/440 = 2^(n/12)

log2(f/440) = (n/12) // I''m using "log2" meaning log base 2

12*(log2(f/440)) = n

n = 12*(log2(f/440))

n = 12*( log(f/440) / log(2) )

Viola.


Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster

Sounds like maybe he is working with MOD files (or some variant).

440 Hz is the frequency for middle A.

Share this post


Link to post
Share on other sites
Stoffel    250
Yes, middle A, A3. The formula he quoted is the formula for finding music frequencies in equal-tempered scale tuned to A, but it misses most of the scale. In order to play A0, he''d need a negative value for n. From this page:

http://www.ibiblio.org/emusic-l/info-docs-FAQs/MIDI-doc/MIDI-Primer.txt

"The pitch bytes of notes are simply number of half-steps, with middle C = 60."

So if you want your algorithm to be midi-compliant, you should get middle C with n = 60.

Hence my comment.

Share this post


Link to post
Share on other sites