Skip to content

Commit cdb70b0

Browse files
committed
getHz corection per simulator
1 parent 3d07fc2 commit cdb70b0

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

sixtube_lm/sixtube_lm.ino

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -780,12 +780,10 @@ void switchAlarm(char dir){
780780

781781
word getHz(byte note){
782782
//Given a piano key note, return frequency
783-
//TODO (note-basenote)/12 resolves to a float...
784-
return 440*(2^((note-49)/12));
785-
//37 = 220 A3
786-
//49 = 440 A4
787-
//56 = 659.2 E5
788-
//61 = 880 A5
783+
char relnote = note-49; //signed, relative to concert A
784+
float reloct = relnote/12.0; //signed
785+
word mult = 440*pow(2,reloct);
786+
return mult;
789787
}
790788
//Sometimes we activate the beeper directly (e.g. pips) but most of the time we make a bell tone TODO
791789
// char curBellToneLevel; //support negative just in case

0 commit comments

Comments
 (0)