Re: [music-dsp] Sound Analysis

2019-01-01 Thread Nigel Redmon
> However when run on the Hammond recording, it's detecting a wavelength of 
> perhaps 0.7 cent off.

Interesting…I looked at this quickly, not an authority, but power line 
frequency regulation (Hammond relying on synchronous motors for pitch, of 
course)—in North America for 60 Hz—is adjusted for long term accuracy by ± 0.02 
Hz. At 60 Hz, 0.7 cents is about 0.024 Hz (that is, 60.02 is about +0.6 cents 
sharp)...



> On Jan 1, 2019, at 4:45 PM, Frank Sheeran  wrote:
> 
> Summary
> 
> 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 obtained.
> 
> 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 zero-crossings.
> 
> 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 
> wavelength.
> 
> 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
> music-dsp@music.columbia.edu
> https://lists.columbia.edu/mailman/listinfo/music-dsp

___
dupswapdrop: music-dsp mailing list
music-dsp@music.columbia.edu
https://lists.columbia.edu/mailman/listinfo/music-dsp

Re: [music-dsp] Sound Analysis

2019-01-01 Thread Frank Sheeran
Evan thanks for the pointers to techniques.  I haven't heard of them but
will investigate.

Ben thanks for the links.  I actually have reviewed both but they'd have
been critical had I not.  Did you note the Utility Frequency page had a
very surprising coincidental mention of Hammond?
https://en.wikipedia.org/wiki/Utility_frequency#Stability

Best Regards,
Frank Sheeran
___
dupswapdrop: music-dsp mailing list
music-dsp@music.columbia.edu
https://lists.columbia.edu/mailman/listinfo/music-dsp

Re: [music-dsp] Sound Analysis

2019-01-01 Thread Ben Bradley
Your "detecting a wavelength of perhaps 0.7 cent off" caught my eye,
as the Hammond tone generation is mechanically tied to the 50Hz or
60Hz power frequency, and I don't think the line frequency has ever
been regulated as accurately as 1 cent (1/100th semitone). For
accurate recordings, you'd need to run the organ off a power inverter
with a quartz crystal derived power frequency. Even with that, you're
still not accounting for variations caused by the mechanical
geartrain. I can imagine that has an effect, but not how much.

Here's some info on the US power frequency and its variation:
https://en.wikipedia.org/wiki/Utility_frequency
https://ws680.nist.gov/publication/get_pdf.cfm?pub_id=922663
http://www.leapsecond.com/pages/mains/

Then there's this on the Hammond that you surely already know:
https://electricdruid.net/technical-aspects-of-the-hammond-organ/

On Tue, Jan 1, 2019 at 7:48 PM Frank Sheeran  wrote:
>
> Summary
>
> 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 obtained.
>
> 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 zero-crossings.
>
> 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 
> wavelength.
>
> 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
> music-dsp@music.columbia.edu
> https://lists.columbia.edu/mailman/listinfo/music-dsp
___
dupswapdrop: music-dsp mailing list
music-dsp@music.columbia.edu
https://lists.columbia.edu/mailman/listinfo/music-dsp



Re: [music-dsp] Sound Analysis

2019-01-01 Thread Evan Balster
Hello, Frank —

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
> wavelength.
>

If you're doing this, you certainly want to do some kind of high-pass
filter to remove low frequencies from your signal.  Over a sufficiently
short interval of time, low tones look like DC and they'll offset your
integral.

I would caution you against setting your ambitions too high with a design
based on zero-crossings.  That technique might work well enough within
certain parameters (high SNR, low harmonic brightness) but you'll quickly
run into a need for more sophistication if you are attempting to implement
a more general-purpose pitch analyzer.  (Alternative techniques worthy of
note include autocorrelation, cepstrums and adaptive filters.)

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.
>

Any noise in your signal can potentially offset the signal near your
zero-crossing, pushing that crossing forward or backward in time.  This
problem worsens with the level of noise in the signal, especially if the
tone is dark.  Suppressing the noise requires an estimate of the pitch,
creating something of a chicken-and-egg problem — but you can refine an
estimate over time.

– Evan Balster
creator of imitone 


On Tue, Jan 1, 2019 at 6:48 PM Frank Sheeran  wrote:

> Summary
>
> 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
> obtained.
>
> 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
> zero-crossings.
>
> 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
> wavelength.
>
> 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
> music-dsp@music.co

[music-dsp] Sound Analysis

2019-01-01 Thread Frank Sheeran
Summary

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
obtained.

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
zero-crossings.

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
wavelength.

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
music-dsp@music.columbia.edu
https://lists.columbia.edu/mailman/listinfo/music-dsp