DSPRelated.com
Forums

"Correcting" output of a filter

Started by Ross April 26, 2010
Jerry Avins wrote:
> On 4/26/2010 1:16 PM, Tim Wescott wrote: > > ... > >> My kid's student-model bass guitar doesn't show a fundamental at all on >> the lower notes -- the pickups respond nicely to the overtones, but take >> your hands of the frets and pluck the fattest string, and you don't see >> the fundamental. This can't help but complicate things. > > > "Fundamental" is a slippery concept. Many take it loosely as the lowest > frequency present, but that's inadequate. That frequency of which all > other components are integer harmonics is probably correct. It is also > the reciprocal of the period. It need not in fact be present in a > waveform; it could be absent not only in your pick-up output, but in the > string itself (although I doubt that). A simple example of a waveform > whose lowest frequency is three times the reciprocal of its period is a > square wave with the fundamental suppressed. It makes an interesting > plot: (4/pi){sin(3t)/3 + sin(7t)/7 + sin(9t)/9 + ... } What is the > fundamental of a metronome beating at 72/min.?
And it's a concept that varies depending on the domain you're in. In music, the closest approximation is "the note that you hear", even though the overtones ('partials' I believe is the correct term, although I don't know 'partial of what') of an instrument are often not the exact harmonics of the fundamental. IIRC stringed instruments and wind instruments produce a fundamental, even if it never escapes the confines of the instrument (in the case of The Kid's bass I suspect the fundamental is getting lost in the electronics). But bells generate a lot of partials, without ever generating a fundamental -- and we still hear that fundamental as the note. -- Tim Wescott Control system and signal processing consulting www.wescottdesign.com
On Apr 26, 5:27 pm, Richard Dobson <richarddob...@blueyonder.co.uk>
wrote:
> On 26/04/2010 17:02, Ross wrote: > .. > > > Vladimir: Here is the real problem. > > > Monophonic guitar (and other instruments) can be created by tracking > > the pitch of a digitally sampled version of the notes played by the > > musician and synthesising a sound which follows the played pitch, and > > usually uses the volume which which notes are played as a parameter in > > the synthesis. > .. > > I wanted to do an experiment. Not a great big experiment, but just a > > little quick hack personal experiment. I wanted to experiment with as > > close to zero lag as I could possibly get. > > The problem is that at the instant of plucking the string, the pitch > actually is not in any sense already there - the spectrum is mostly > chaotic (the basis of the classic Karplus-Strong waveguide model). Never > mind the filter - the string itself takes a measurable time to 'settle" > into the target pitch. It may not seem a long time to the human ear, but > to a dsp process it amounts to a lot of samples.
Personally I find the Karplus-Strong algorithm a bit too chaotic at the start, resulting in a bit of an exaggerated "click" at the start of the note. When I've implemented it, I've usually trivially modified the system so that output is not taken from the buffer but from the output of the filter.
> Shorten the response > time and the procedure involves more and more guesswork; and tracking > zero-crossings will likely give you more wrong than right answers.
I'm fully expecting that I won't be able to track zero crossings early on, but will have to rely on other techniques. That therefore converts the problem of static pitch of input to one of correlation between early behaviour and eventual pitch. I don't know to what extent that correlation exists or can be detected. But..... However, the whole point of what I'm looking at is to accept whatever happens in the early part of the note in exchange for low latency. If the original signal is chaotic, then that quite well may mean that the synthesised signal is equally chaotic. But, bass guitar is a musical sound, and provided that the amount of chaos is not exaggerated (or significantly extended), then it won't be too much chaos. And, if this ever got extended (no intention of doing so), then the synth would grow envelope generators. Such that anyone wishing to remove the initial chaos could do so with a slower, or delayed, attack time.
> The > high harmonics will also tend to settle/converge before the fundamental; > which is at least in part why many trackers give octave errors when > trying to reduce latency that bit too much.
Octave errors will be (if I progress this in any way) by a different method. There will be a polyphonic synth, one voice per octave. These synths will be faded in or out depending on the current frequency estimation. Again, this will be a tracking speed versus .... not quite distortion I suppose, but tracking speed versus accuracy of synthesised note tradeoff. Compared to an "ideal" synthesised note with no
> I can't cite references offhand, but the Kalman Filter is widely used in > guitar pitch trackers; well worth investigating.
I've seen use of Kalman filters, e.g. fusing simple models of pitch change with autocorrelation techniques. But as far as I'm aware (please correct me if I'm not sufficiently aware), these techniques are strongest and most applicable in steady states, not early stages.
Ross wrote:
> On Apr 26, 5:27 pm, Richard Dobson <richarddob...@blueyonder.co.uk> > wrote: >> On 26/04/2010 17:02, Ross wrote: >> .. >> >>> Vladimir: Here is the real problem. >>> Monophonic guitar (and other instruments) can be created by tracking >>> the pitch of a digitally sampled version of the notes played by the >>> musician and synthesising a sound which follows the played pitch, and >>> usually uses the volume which which notes are played as a parameter in >>> the synthesis. >> .. >>> I wanted to do an experiment. Not a great big experiment, but just a >>> little quick hack personal experiment. I wanted to experiment with as >>> close to zero lag as I could possibly get. >> The problem is that at the instant of plucking the string, the pitch >> actually is not in any sense already there - the spectrum is mostly >> chaotic (the basis of the classic Karplus-Strong waveguide model). Never >> mind the filter - the string itself takes a measurable time to 'settle" >> into the target pitch. It may not seem a long time to the human ear, but >> to a dsp process it amounts to a lot of samples. > > Personally I find the Karplus-Strong algorithm a bit too chaotic at > the start, resulting in a bit of an exaggerated "click" at the start > of the note. When I've implemented it, I've usually trivially modified > the system so that output is not taken from the buffer but from the > output of the filter. > >> Shorten the response >> time and the procedure involves more and more guesswork; and tracking >> zero-crossings will likely give you more wrong than right answers. > > I'm fully expecting that I won't be able to track zero crossings early > on, but will have to rely on other techniques. That therefore converts > the problem of static pitch of input to one of correlation between > early behaviour and eventual pitch. I don't know to what extent that > correlation exists or can be detected. But..... > > However, the whole point of what I'm looking at is to accept whatever > happens in the early part of the note in exchange for low latency. If > the original signal is chaotic, then that quite well may mean that the > synthesised signal is equally chaotic. But, bass guitar is a musical > sound, and provided that the amount of chaos is not exaggerated (or > significantly extended), then it won't be too much chaos. And, if this > ever got extended (no intention of doing so), then the synth would > grow envelope generators. Such that anyone wishing to remove the > initial chaos could do so with a slower, or delayed, attack time. > >> The >> high harmonics will also tend to settle/converge before the fundamental; >> which is at least in part why many trackers give octave errors when >> trying to reduce latency that bit too much. > > Octave errors will be (if I progress this in any way) by a different > method. There will be a polyphonic synth, one voice per octave. These > synths will be faded in or out depending on the current frequency > estimation. Again, this will be a tracking speed versus .... not quite > distortion I suppose, but tracking speed versus accuracy of > synthesised note tradeoff. Compared to an "ideal" synthesised note > with no > >> I can't cite references offhand, but the Kalman Filter is widely used in >> guitar pitch trackers; well worth investigating. > > I've seen use of Kalman filters, e.g. fusing simple models of pitch > change with autocorrelation techniques. But as far as I'm aware > (please correct me if I'm not sufficiently aware), these techniques > are strongest and most applicable in steady states, not early stages.
I don't know about Kalman filters as used in this application, but _done right_, a Kalman filter is going to be your best bet for rapidly acquiring the right number. The basic definition of a Kalman filter is that it gives you the optimal estimate of the state of the filter at each time step. This could be a source of a lot of argument, because a 'pure' Kalman filter makes some assumptions that probably aren't very valid for what you're doing, and if you make those assumptions then they'll trip you up. Conversely, the filter that you probably need will be quite a departure from the linear time-varying state-space filter that says "Kalman" to a lot of people. But even a Kalman-esque version of your original proposed Butterworth filter that starts when you detect the onset of a note would work a lot better than a straight time-invariant B-worth. -- Tim Wescott Control system and signal processing consulting www.wescottdesign.com
Tim Wescott <tim@seemywebsite.now> wrote:
(snip)
 
> My kid's student-model bass guitar doesn't show a fundamental at all on > the lower notes -- the pickups respond nicely to the overtones, but take > your hands of the frets and pluck the fattest string, and you don't see > the fundamental. This can't help but complicate things.
The magnetic pickup should pretty much respond to the changing distance between the (iron) string and the pickup magnet. If the pickup is directly under the string, then it won't see the fundamental of transverse (parallel to the body surface) vibration, but will for perpendicular to the surface vibration. I will guess that much of the sound of an electric guitar is related to the string modes and pickup position. -- glen
Tim Wescott <tim@seemywebsite.now> wrote:
(snip)
 
> And it's a concept that varies depending on the domain you're in. In > music, the closest approximation is "the note that you hear", even > though the overtones ('partials' I believe is the correct term, although > I don't know 'partial of what') of an instrument are often not the exact > harmonics of the fundamental.
That sounds right. The modes of many instruments are not exactly harmonically related, so harmonic isn't the right word. On the other hand, many instruments generate non-sunusoidal signals, which should have harmonically related sinusoidal components. (As I understand it, the stick-slip friction of a violin string generates something close to a sawtooth wave.)
> IIRC stringed instruments and wind instruments produce a fundamental, > even if it never escapes the confines of the instrument (in the case of > The Kid's bass I suspect the fundamental is getting lost in the > electronics). But bells generate a lot of partials, without ever > generating a fundamental -- and we still hear that fundamental as the note.
-- glen
On 4/26/2010 4:07 PM, glen herrmannsfeldt wrote:
> Tim Wescott<tim@seemywebsite.now> wrote: > (snip) > >> And it's a concept that varies depending on the domain you're in. In >> music, the closest approximation is "the note that you hear", even >> though the overtones ('partials' I believe is the correct term, although >> I don't know 'partial of what') of an instrument are often not the exact >> harmonics of the fundamental. > > That sounds right. The modes of many instruments are not exactly > harmonically related, so harmonic isn't the right word.
I refer to them as overtones. I too wonder "partial" of what? Jerry -- "I view the progress of science as ... the slow erosion of the tendency to dichotomize." --Barbara Smuts, U. Mich. &#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;
On 4/26/2010 2:26 PM, Jerry Avins wrote:
> On 4/26/2010 4:07 PM, glen herrmannsfeldt wrote: >> Tim Wescott<tim@seemywebsite.now> wrote: >> (snip) >> >>> And it's a concept that varies depending on the domain you're in. In >>> music, the closest approximation is "the note that you hear", even >>> though the overtones ('partials' I believe is the correct term, although >>> I don't know 'partial of what') of an instrument are often not the exact >>> harmonics of the fundamental. >> >> That sounds right. The modes of many instruments are not exactly >> harmonically related, so harmonic isn't the right word. > > I refer to them as overtones. I too wonder "partial" of what? > > Jerry
I've always thought it was a "partial" element of the total waveform or sound. A harmonic contains only part of the total energy. I've heard them called "partials" in musical contexts as well, and just thought that was the general idea. -- Eric Jacobsen Minister of Algorithms Abineau Communications http://www.abineau.com
On 4/26/2010 6:01 PM, Eric Jacobsen wrote:
> On 4/26/2010 2:26 PM, Jerry Avins wrote: >> On 4/26/2010 4:07 PM, glen herrmannsfeldt wrote: >>> Tim Wescott<tim@seemywebsite.now> wrote: >>> (snip) >>> >>>> And it's a concept that varies depending on the domain you're in. In >>>> music, the closest approximation is "the note that you hear", even >>>> though the overtones ('partials' I believe is the correct term, >>>> although >>>> I don't know 'partial of what') of an instrument are often not the >>>> exact >>>> harmonics of the fundamental. >>> >>> That sounds right. The modes of many instruments are not exactly >>> harmonically related, so harmonic isn't the right word. >> >> I refer to them as overtones. I too wonder "partial" of what? >> >> Jerry > > I've always thought it was a "partial" element of the total waveform or > sound. A harmonic contains only part of the total energy. I've heard > them called "partials" in musical contexts as well, and just thought > that was the general idea.
Piano tuner's jargon refers to "partial" too (a good enough reason is fewer syllables). It probably means "component". Jerry -- "I view the progress of science as ... the slow erosion of the tendency to dichotomize." --Barbara Smuts, U. Mich. &#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;
On 26 apr, 20:06, Tim Wescott <t...@seemywebsite.now> wrote:

> And it's a concept that varies depending on the domain you're in. &#4294967295;In > music, the closest approximation is "the note that you hear",
There are some weighting functions involved in the human audio sensory system. The human ear is more sensitive to some frequency ranges than to others. It's been decades since I saw those graphs, but as I recall, the human ear isn't very sensitive to tones less than a couple of hundred Hertz. If one uses filters that account for such sensitivities, fundamentals of low tones might well go AWOL. Rune
On 4/26/2010 6:49 PM, Rune Allnor wrote:
> On 26 apr, 20:06, Tim Wescott<t...@seemywebsite.now> wrote: > >> And it's a concept that varies depending on the domain you're in. In >> music, the closest approximation is "the note that you hear", > > There are some weighting functions involved in the human > audio sensory system. The human ear is more sensitive to > some frequency ranges than to others. It's been decades > since I saw those graphs, but as I recall, the human ear > isn't very sensitive to tones less than a couple of hundred > Hertz. If one uses filters that account for such sensitivities, > fundamentals of low tones might well go AWOL.
http://en.wikipedia.org/wiki/Fletcher-Munson_effect Jerry -- "I view the progress of science as ... the slow erosion of the tendency to dichotomize." --Barbara Smuts, U. Mich. &#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;