I'm having trouble identifying exact frequencies in what should be an
extremely easy-to-process WAV file, as  a first step to doing a harmonic
analysis with a Fourier transform.

Details of Project

I have a file which contains a second's worth of sound of each of the 91
tonewheels of  a Hammond B-3 organ in order.  (Hammonds have spinning disks
whose edge is fluted in a shape of a desired output sound wave.  This spins
in front of a mechanical pickup, which converts that undulating edge into
an electronic signal.)

I want to do a harmonic analysis of each disk in turn.

Given the volume of example sounds, I'm hoping for the utility program
doing this analysis to be as automated as possible.  I see the first
project as a first step towards a utility that will let me conveniently
analyze other sounds as well going forward, such as guitar notes.

Current Status

I'm properly detecting the notes' start and end, with a heuristic of
looking for a running string of individual samples less than some
threshold.  By experimentation, length and threshold values that work were

Since the Hammond sounds don't change from beginning to end, except for
some instability at the start and finish, I'm taking the middle 80% of each
detected note.

I'm currently then scanning that range for an upwards zero-crossing.  I
linear-interpolate that starting value, so that if say sample 100 is -.04
and 100 is +.01, I assume the waveform starts at 100.8.

I then keep a running "value under the curve", manually
piecewise-integrating the waveform, as I scan forward for more upwards

For each subsequent upwards zero-crossing, I again linear-interpolate a
fractional sample value.  This is possibly the end of the waveform.  I
tentatively ask what the "value under the curve would be" up to this
zero-crossing.  If the value is close enough to zero, then I treat the
difference between this interpolated crossing and the first as a candidate

When run on test tones I compose of sine waves at various harmonics, the
method succeed to 5-6 decimal places.  The resulting harmonic analysis
gives the proper strengths of the Harmonics I put in, and detects the other
harmonics at values of -90dB or so.  When allowed to continue on and detect
a candidate wavelength in fact twice the actual, the noise floor drops to
-195dB.  Three wavelengths

However when run on the Hammond recording, it's detecting a wavelength of
perhaps 0.7 cent off.  And this probably accounts for an entire wall of
ghost frequencies to be detected as well.

SO........ Am I going about this totally wrong?  Is there a different and
better approach to use?  Or do I just need to keep tweaking, such as adding
a DC filter, an 60Hz AC hum filter (I see some in an FFT at maybe -95dB),
additionally using a low-pass filter before the pitch-detection stage but
don't use once I've detected a wavelength, and so on?  One idea I have is
that I should use the detected wavelength to select the closest known
wavelength (I know the exact frequency of each wheel) but to do so would
make the utility program less general-purpose.

Best regards,
Frank Sheeran
dupswapdrop: music-dsp mailing list

Reply via email to