[sdiy] guitar pitch detection, was: Mighty quiet lately...
John Richetta
jrichetta at earthlink.net
Mon Oct 4 01:43:11 CEST 2010
On Oct 3, 2010, at 1:53 PM, Donald Tillman wrote:
> On Sep 23, 2010, at 6:12 AM, Harry Bissell wrote:
>> I'm playing with LT Spice and simulating guitar pitch converters,
>
> Forget it, Harry; it's time to give up. This guy has completely
> solved the guitar pitch conversion problem:
>
> Guitar through the Phantastron
> http://www.youtube.com/watch?v=OWX6tiOWygk
>
> Enjoy!
You're right: sometimes the best way to solve a problem is to simply
go around it completely, like for example, but not caring about it at
all. Which is not to denigrate "120 years of old west innovation" -
Lorin points out all the careful suboctave matching going on, for
those that might not hear it quite right.
The best thing about this list, IMO, aside from some sometimes very
helpful input, is the humor. :)
Gotta love his facial expressions, where if you didn't know better you
might guess he was scraping his fingernails on a chalkboard. Kinda
cool how erratic this thing can be, though.
----- warning: long-winded speculation follows -----
Having interest in guitar synth building (but not much time to pursue
this) I have given thought, off and on, to pitch matching for stringed
instruments. I'll share some ideas in case someone can turn them into
something useful (though unfortunately, I have not yet gotten around
to building anything based on these ideas, so they are a long way from
functional).
The digital domain is probably the best place to solve this problem,
but for what follows, I'll assume there is interest in an analog
solution.
My essential inspiration for how to improve pitch detection is to pay
more attention to string *harmonics*, instead of focusing so much on
the fundamental. I haven't read much on this topic, but it seems that
people usually use either zero-crossing techniques or some PLL-like
setup to find the fundamental (what little I've looked at has actually
been software, not hardware). IMO, those approaches ignore useful
information.
An important fact that I think may be overlooked is that strings have
primarily integer harmonics (though there are well-understood ways in
which they can become a bit inharmonic; let's ignore that for now).
Instead, suppose we can quickly analyze the frequency content of the
signal (the hard part). If we do this, we should see a relationship
between the frequencies where there is significant energy, in the form
of multiplicity. That is, all the frequencies where there is content
should be of the form n*F, where F is the fundamental frequency. If
one can (quickly and reliably) find many peaks, and analyze them to
find F, the job is done.
So, presuming this idea has merit, the challenges seem to be:
- break the signal into narrow frequency bands
- use some secondary circuit to match frequency within the narrow
bands
- infer the fundamental from the bands having significant energy,
and the relationship between the exact pitches where peaks occur
At first, this might look like a pretty hopeless task for analog. The
naive approach might be a gigantic narrow-band filter bank - with
limitless accuracy and stability problems! - and who knows exactly
what, used to infer F from the output of the filters (a large set of
analog "and" gates, one for each possible note spectral response?).
Of course, we need a better answer. Something like a modest fixed
filter bank that does some broad classification of the frequency
content, with further "PLL-like" circuitry in each band seems more
reasonable. But, I think maybe we can do better.
What we'd really like, to make this job relatively easy, is a filter
that has peaks spaced the same way as string harmonics. Since the
spacing varies with F, obviously, this cannot be a fixed filter. But
do we know a filter that might do this? Yes: a comb filter. That is,
essentially, a filter made from a delay line with feedback. Put the
signal into this, and use PPL phase matching / power maximizing
techniques on the output to lock on, within a "band." This should
work pretty well, even when the harmonics are an octave or two above
the filter's fundamental (a major premise, that might prove
incorrect...). Ideally, there would be *twelve* of these circuits,
each with an initial center tuned to match the lowest octave of a
guitar's range (when tuned to a standard Western "A = 440Hz" 12-tone
scale).
(Apologies to the alternate tuning folks - but this circuitry should
work fine, even for unusual tunings, and could allow some simple
adjustments, perhaps, to offset any less-than-ideal default
conditions; but let's focus on basics, for starters.)
So, an admittedly rough sketch of an idea for a glimmer of an
imaginary circuit that works only in the lab is:
- envelope tracking / note onset detection circuitry
- steep roll-off, octave-spaced fixed filter bank (to help pin
down fundamental)
- a 12-band, 12th-root-of-two-spaced sweepable comb filter network
- each filter has phase matching control over pitch, within a
small range; a factor of +/-1.25, should suffice, for a bit more than
+-3 half steps of pitch bend, as is typically applied (more on the
downside, if you want good "whammy" tracking, but this might be asking
for too much); note that you must be prepared to bend down, not just
up, because guitarists may pre-bend notes upward
- the octave bank is used to determine fundamental (by seeing
which octave, starting at the low end, has "significant" response; the
12-band comb filter bank is used to determine note pitch within the
octave; it's not clear whether it would be an improvement to use the
octave bank info to shift the note-detection comb filters - seems
possible
- note that the preceding step implies a summer, if you want to
put out a control voltage that matches the detected pitch directly:
(octave -> control voltage) + (note within octave -> control voltage);
it's probably a good idea to put out separate octave and note signals,
too
- there must be some level detection circuitry to "latch" and
enable the pitch output (or envelope), only when filter response is
high enough and PLLs have locked; also, comb filter frequencies must
be quickly returned to center, after a note has "ended"
- with careful work, this circuit might even perform passably when
multiple notes are played
I hope these ideas are useful (because otherwise, this will have been
a big waste of bandwidth, and your time). Obviously, this will not be
a small circuit to build - but I think it's still within the realm of
feasible and possibly worthwhile. I'd be appreciative if anyone
simulating, prototyping, or otherwise refining any of this would share
whatever is learned (thanks).
-jar
More information about the Synth-diy
mailing list