# Frequency to voltage converter IC

Can someone recommend any that would work with a guitar? I'd like to meddle with guitar inputs... ultimately I'm thinking MIDI guitar. Thanks!

If that could be done properly then you would be able to buy them. It can't you can't.

You can get sound to MIDI modules but they do not work perfectly especially with a harmonic rich source like a guitar. You need a lot more processing horse power to do it even badly than an arduino can supply.

This isn't really possible, I've made a keyboard matrix overlay onto an bass guitar, using a PIC with about 25 inputs, feeding it to the computer to display what you're playing in real time on a computer, which barely works still and took about 8 months of time and research with/for a computer engineering technologist background.

In the category of experimentation, I wonder what could be done with frequency analysis--i.e., with an algorithm that extracts the fundamental of a plucked string, or even the set of fundamentals of multiple strings. Arduino can do FFT analysis for instance. I've been playing with a 16-bit integer FFT algorithm that will do a 256-byte FFT in about 45msec (atmega328). There's an 8-bit FFT algorithm posted in this forum that presumably would be twice as fast. More optimizations may be possible (e.g., real-valued FFT).

Just to pick some numbers, say the signal is band-limited to 700 Hz and sampled at 1.4 KHz. A length 256 FFT would give a frequency resolution of 1400/256 or about 5 Hz. That might be enough to distinguish notes above E3 anyway (E3 = 165 Hz, F3 = 175 Hz). It might be interesting to see.

Joe

jmknapp:
In the category of experimentation, I wonder what could be done with frequency analysis--i.e., with an algorithm that extracts the fundamental of a plucked string, or even the set of fundamentals of multiple strings. Arduino can do FFT analysis for instance. I've been playing with a 16-bit integer FFT algorithm that will do a 256-byte FFT in about 45msec (atmega328). There's an 8-bit FFT algorithm posted in this forum that presumably would be twice as fast. More optimizations may be possible (e.g., real-valued FFT).

Just to pick some numbers, say the signal is band-limited to 700 Hz and sampled at 1.4 KHz. A length 256 FFT would give a frequency resolution of 1400/256 or about 5 Hz. That might be enough to distinguish notes above E3 anyway (E3 = 165 Hz, F3 = 175 Hz). It might be interesting to see.

Joe

That's actually a project I'm hoping to undertake in the future, building upon what was learned and accomplished from the aforementioned keyboard matrix bass guitar auto tabbing project done back in college.

I wonder what could be done with frequency analysis

Do you think that has not been tried?
It has and is not successful.

The problem is that what gives a note it's timbre is the change in the harmonic content of the note over time. This totally screws up an FFT an results in miss triggering of notes and misidentifying the correct note from the harmonic.
If it were that simple it would have been done 30 years ago.

Grumpy_Mike:

I wonder what could be done with frequency analysis

Do you think that has not been tried?
It has and is not successful.

I didn't realize that people playing with Arduinos are involved in cutting edge research--isn't the idea to investigate and have fun?

Anyway, here's an LPC sonogram of a guitar scale, F major. LPC might be better for the task than FFT per se, since it tends to emphasize the fundamental:

I'd bet those notes are distinguishable. Even at the higher end, with a strong 2nd harmonic, the fundamental is stronger.

Sometimes it's better to figure out why something can be done, rather than coming up with a dozen reasons it can't, grumpy cred notwithstanding. Here's a paper on the subject from 2006:

Fundamental Frequency Estimation
http://recherche.ircam.fr/equipes/analyse-synthese/roebel/amt_audiosignale/VL5.pdf

The authors state in the conclusion:

For musical instruments the problem of reverberation due
to slow decay of previous notes renders the analysis more or less polyphonic. Due to the
possibilities to restrict the analysis to limited frequency ranges and to threshold spectral
amplitudes it appears that for musical instruments spectral domain preprocessing is helpful
such that spectral domain evaluation of the acf is more appropriate. For the harmonic
instruments the error is below 1% if less than a quarter note of deviation is excepted.

Joe

isn't the idea to investigate and have fun?

It is but also I feel I should let some one know when they are wasting their time trying to do something on an 8 bit micro that has proved to be imposable on much more powerful DSP orientated processors.

But hey it's your life if you want to waste it trying to reinvent a broken wheel then feel free. You never know you might just end up redefining success and so succeed.

Grumpy_Mike:

isn't the idea to investigate and have fun?

It is but also I feel I should let some one know when they are wasting their time trying to do something on an 8 bit micro that has proved to be imposable on much more powerful DSP orientated processors.

But hey it's your life if you want to waste it trying to reinvent a broken wheel then feel free. You never know you might just end up redefining success and so succeed.

Oh my!

KE7GKP:
Mike may be "Grumpy", but he is right.

"Progress, far from consisting in change, depends on retentiveness. When change is absolute there remains no being to improve and no direction is set for possible improvement: and when experience is not retained, as among savages, infancy is perpetual. Those who cannot remember the past are condemned to repeat it." - George Santayana (1905)

But don't discount infancy, or rather the child mind if you will. There's a book by a Dr. Edward Bono that made an impression on me long ago, on the subject of creativity, titled Po: A Device for Successful Thinking. He talked about an experiment where the subjects were shown a diagram of a wheelbarrow with the position of the supports and the wheel reversed. Adults were inclined to simply say "that's wrong" and leave it at that. Children were likely to say, "it would be easier to go around corners" or "it would be less strain on the back because you push down instead of lifting up." Somewhere along the line, de Bono argued, the creativity gets drummed out of us. He is the originator of the term "lateral thinking."

The book talked about exercises that try to get around this tendency to not consider new ideas. He uses the nonsense word PO as a tool, for example:

PO1 - The Intermediate Impossible

This process can be said to be an extremely powerful variant of the word suppose. It is built upon the concept that wrong and/or impossible ideas can be used as gateways or stepping stones to ideas that are not wrong. It is a way to jump over the barrier of judgement, and continue in a seemingly wrong direction. This tool is often used as provocative statements. From a graphic design point of view, an example might be “PO this copy should not be readable”. The objective is to explore unfamiliar landscape, and see where the provocation is leading. Results of this PO could be to have the text presented in the braille system, a feature for audio playback of the same text, communicating the same message purely pictorial, or special glasses that make the copy readable.

It can be a cure for grumpiness!

In any case, what do you think about the claims of the German researchers above (<1% error for harmonic instruments)?

Joe

It can be a cure for grumpiness!

Doubt it.

There's a book by a Dr. Edward Bon

Grandmother and egg sucking, he is a bit of a cod physiologist isn't he, according to my wife who is a real one.
Creativity is an often misunderstood concept and he tends to over simplify things.

what do you think about the claims of the German researchers above (<1% error for harmonic instruments)?

I know academics are notoriously bad at applying research in the real world (I was one myself for 21 years University - Physics) but the paper was in 2006, so five years later I would have expected to see a working instrument to MIDI unit. As far as I know they haven't produced one yet that works well. Is 1% good enough, it sounds good initially but it certainly isn't for things like speech recognition to feel as if it is working correctly.

Ah, so we've gone from "it has never been done" to "academics, shmacademics." Fascinating!

Have a look:

I haven't completed all test yet, as SNR goes down with more key struck simultaneously ( energy divided between individual bins), I'm hoping to get 1% error rate for 10 notes so far.

Magician:
Have a look:
http://arduino.cc/forum/index.php?topic=70857.new;topicseen#new

I haven't completed all test yet, as SNR goes down with more key struck simultaneously ( energy divided between individual bins), I'm hoping to get 1% error rate for 10 notes so far.

Good demo in the video. It was even picking up 3 and 4-note chords.

I'd be curious to know, are you using the 8-bit FFT code that was posted on the Arduino forum? Or some other software/hardware to analyze the tones?

You mention 23 msec of work, and then 40 msec waiting for the next array. I'm running some code that takes 45 msec to do a 16-bit FFT, n=256, & it takes 25 msec to fill the array at 10 KHz sampling rate. Since there's only one array the tasks can't be done in parallel.

Using the Arduino Mega (8K RAM) sounds like a good idea--with the atmega328 the 2K gets used up pretty fast (256 ints, real & imaginary = 1K) & unless the frame size is very small there's no luxury of filling one buffer while analyzing another, flipping between the two for each frame, which would be ideal.

Joe

I'd be curious to know, are you using the 8-bit FFT code that was posted on the Arduino forum? Or some other software/hardware to analyze the tones?

No other hardware, one ULN2003 to switch led matrix columns.
Initially I get 16-bit FFT code from: jj's useful and ugly FFT page
(I think, it's the same version someone modify to 8-bit and posted on the forum. )
I did a lot of optimization to source code, and also turn it to 8 -bit. Since then I write my own FFT code, but couldn't get better performance (yet), even it's pretty close (-10%). I already used code in other project:http://fftarduino.blogspot.com/2011/02/color-organ-spectrum-analyzer-on.html

You mention 23 msec of work, and then 40 msec waiting for the next array. I'm running some code that takes 45 msec to do a 16-bit FFT, n=256, & it takes 25 msec to fill the array at 10 KHz sampling rate. Since there's only one array the tasks can't be done in parallel.

23 msec is for 8-bit. I'd expect 60 msec on 16-bit, but there is no way I can test it on Uno:
array is 1024, real/imaginary 512/512, output 256 bins (only half real part, other half is mirror).
16 bit 1024 would take all 2K memory.
Sampling rate 4 kHz, upper note 1976 Hz on yellow right side led. ( there is no antialising filter yet, probably this is why it unstable in upper notes).
I'm doing parallel: Sampling array 256 - 16 bit, dynamicaly "scaling" down to 8-bit to get better SNR of input data. When it's full (256 x 0.25 msec = 64 msec) it's transfered to processing array 1024, missing 256 real sample is "zero padded", and sampling continue w/o interruption (transfer time less than 250 usec)
I did zero padding on a purpose to get "response time" led matrix as fast as possible, so real time 1/16 note could be visually distinguish the same time as they sound.
But as always you can't get both, zero padding is not for free, it degrade sensitivity/snr in two, plus degrade resolution to 16 Hz compare to design 8 Hz. I'm able to get tone on lower end only if two "neighboring" tone not played simultaneously ( it should happened really ocasionaly, I think). So it's compromise version between speed/accuracy.
Later I would turn on accuracy road, and it wouldn't be too hard to decode 7.5 octave grand acoustic only it' wouldn't be real-time anymore

Edited:
Should correct last sentence:
"wouldn't be too hard to decode 7.5 octave grand acoustic - on Mega or with additional memory chip. "only it' wouldn't be real-time anymore" , hmm , why not? I have an idea...

Very interesting, Mag--thanks for sharing what you've done.

BTW, for the anti-aliasing filter, I like the tools on this web site from Japan:

http://sim.okawa-denshi.jp/en/Fkeisan.htm

For example, the third-order Sallen-Key LPF which you can implement with 3 resistors, 3 caps and an op amp. Using the Chebyshev selection, looks like if you set the cutoff at 2KHz you could be almost 30dB down at 4KHz.

Joe

I'm afraid the filter that I need, isn't invented yet. Roll off so sharp : 30 dB from 1976 to 2000 Hz........
(Nyquist with 4k sampling is 2kHz). What it would be , 30-th order or something?
The other way, push sampling to higher rate, again , with more memory.