Posted By
gerliczer on 2014-07-26 11:19:35
| Re: Exact TED Frequency a for music beginners :-)
Hmm. I don't think these values are quite right. I calculated quite different numbers with the frequency formula TLC derived ages ago. It was somewhere in the late plus/4 mailing list, IIRC.
Anyway, here is the basic program I used to do the math. Feel free to find errors in it. LIST
10 R=0:I=0 20 D=200000:J=R 30 F=110*(2^(I/12)):IF F>3520 THEN END 40 G=110840.46875/(1024-((R+1)AND1023)) 41 REM G=111860.78125/(1024-((R+1)AND1023)) 50 IF ABS(G-F) < ABS(D) THEN D=G-F:J=R:ELSE PRINTI;":",F,D,J:I=I+1:GOTO 20 60 R=R+1:IF R<1024 THEN 40
READY.
Line 40 is for the PAL machines, line 41 is obviously for the NTSC ones. And no line for the Drean machines.
I is an index, R is the register value, F is the frequency of the note we are trying to approximate, G is the generated frequency and D is the variable used to select the smallest difference. If I not screwed up too badly, this code will print those register values that generate frequencies having the smallest difference compared to the desired note frequencies.
Edit: To find the frequency formula open TLC's member page, click the link to his mailing list posts and find post #1550. You can find the formula after the sea of tabulated numbers in the part where he gives advice to emulator writers.
Edit 2: Part of the basic code somehow got interpreted as a kind of html tag and was messed up. I hope this change fixes it.
|