I've read a fair bit about this, but I'd like a bit of guidance & a few concepts confirmed or corrected!
I'd like to be able to establish which note is being played on a guitar. I'm only interested from the 'D' string upwards.
The D string frequency is 146.8Hz - which means that one cycle takes 6.81ms. Ok, that's the bit I'm sure about - the rests is fuzzy!
I don't want a lot of complication in the supporting electronics -so ideally I'd like to use the internal oscillator (yes, I know it's rough & ready & not particularly accurate, but I'm not going to be using this to tune the guitar).
I'd thought about using the comparator & basically counting how many cycles have been received in a given time frame - I'd like the time frame to be as low as possible.
Re PICs & floating point - I believe PICs don't do FP - but I'm not sure of the impact to my situation....I'm figuring that the PIC dispenses with the decimal places & just give the integer? (does it round up or just ignore them all together?)
I've created a table to show the lowest possible sampling time frame to be able to get a unique integer for each note, which for this situation works out at about 100ms...
(btw: I didn't know how to format the Excel cells to look ok on here, so I used the code tags - which seems to work ok!)
As you can see, by using 100mS, the sample period 'integer' is unique (ie for the number of complete cycles completed).Code:Note Freq Cycles in 100mS D 146.83 14.683 D# 155.56 15.556 E 164.81 16.481 F 174.61 17.461 F# 185 18.5 G 196 19.6 G# 207.65 20.765 A 220 22 A# 233.08 23.308 B 246.94 24.694 C 261.63 26.163 C# 277.18 27.718 D 293.67 29.367 D# 311.13 31.113 E 329.63 32.963 F 349.23 34.923 F# 369.99 36.999 G 392 39.2 G# 415.3 41.53 A 440 44 A# 466.16 46.616 B 493.88 49.388 C5 523.25 52.325 C# 554.37 55.437 D 587.33 58.733 D# 622.25 62.225 E 659.26 65.926 F 698.46 69.846 F# 739.99 73.999 G 783.99 78.399 E 329.63 32.963 F 349.23 34.923 F# 369.99 36.999 G 392 39.2 G# 415.3 41.53 A 440 44 A# 466.16 46.616 B 493.88 49.388 C5 523.25 52.325 C# 554.37 55.437 D 587.33 58.733 D# 622.25 62.225 E 659.26 65.926 F 698.46 69.846 F# 739.99 73.999 G 783.99 78.399 G# 830.61 83.061 A 880 88 A# 932.33 93.233 B 987.77 98.777 C 1046.5 104.65 C# 1108.74 110.874 D 1174.66 117.466 D# 1244.5 124.45 E 1318.52 131.852
It should then be a case of a simple Look up Table to work out which note is being played, eg...
If Sample count = 14 then D note is being played.
if Sample count = 22 the 'A' note is being played.
And so on.
So at this embryonic stage...
Is my line of thought correct?
Is there any clever workaround available meaning I could bring that 100mS sampling period down?


!


Bookmarks