Hi Paul,
I was aware that the PIC simply threw the decimal portion away, but I'm no mathmetician & just wanted to clarify that I wasn't approaching this incorrectly!
Thank you for your suggestion...but my goal here is simply to detect the frequency remaining the same for a set length of time (ie the guitar player is 'holding' a note for more than x seconds)....so I don't actually even need to convert to hertz - for simplicity, I can just work in counts.
It might be handy one day to detect the actual 'Note Played'. when I think my approach would be along the lines of a monster lookup table (with a 'window' either side of the centre frequency for each note)...
& so on (I guess Hertz could be derived to decimal points using an even bigger lookup table?!)Code:Hertz Clock Count (from ) 78 6410 Open E 82.41 6067 (to) 84.85 5893 84.86 5892 Fret 1 F 87.31 5727 89.90 5562 89.91 5561 Fret 2 F# 92.50 5405 95.24 5250 95.25 5249 Fret 3 G 98.00 5102 100.91 4955 100.92 4954 Fret 4 G# 103.83 4816 106.91 4677 106.92 4676 Fret 5 A 110.00 4545 113.26 4415 113.27 4414 Fret 6 A# 116.54 4290 120.00 4167
PS Once you get to the highest note on the fretboard (E on the 24th fret - 1318.5Hz) , the compartor clock count between interrupts comes down to something around 379....so it might be worth messing with the prescaler to give a bit more granularity)




Bookmarks