Re: [music-dsp] Sound Analysis

2019-01-14 Thread Theo Verelst

About the final accuracy of an FFT applied to note recording sample files, it's 
like
if you have a number of waves in you FFT interval, they seldom will wrap around 
at sample
boundaries, and certainly if you want an accurate match in your FFT, the FFT 
interval
should as closely as possible match the wavelength of the lowest frequency in 
you tone.

So you'd have to find out the number of samples per wave, and use a multiple 
number of
waves from your sampled file until the number of waves (in terms of as accurate 
as
possible matched sampled in floating point) becomes close to an integer number.

Then adjust the bin size, and hope transients (there's all kinds of electronic 
coupling
going on) and disturbances (which do not necessarily fit in the same harmonic 
analysis
interval for repeating waves) aren't too much a problem.

T.V.
___
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-05 Thread Sound of L.A. Music and Audio

Hello all

Is there a synchronous synchronisation to the given power frequency or 
does it have slippage like an asynch engine?

If long term synchronous, there certainly is jitter.


Am 02.01.2019 um 02:50 schrieb Ben Bradley:> 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.


Am 02.01.2019 um 02:50 schrieb Ben Bradley:

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.


Anyway: For this particular recording approach, you will have to the 
identify base frequency and its vibrato / tremolo with an equation and 
fitting. A FFT will most probably fail.


jürgen

___
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-04 Thread robert bristow-johnson









> Thank you Nigel, RB-J, Steffan, and Neil.

>
yer welcome from me.� armchair quarterbacking is pretty easy.


>

>

> i suspect that those tone wheel waveforms are close to sinusoidal.

>>

>

> Early models were. Starting I think around '53 with the B-3, C-3 and A1xx

> series (A100 etc.) they were a bit brighter, and the foot pedals were FAR

> brighter.

>

>

>

>> but to find out from your .wav file, you can apply a pretty simple pitch

>> detection to get the period of the waveform to a precision of

>> fractional sample.? then you can divide that period into N samples using

>> interpolation and resampling techniques.? this is how i would advocate

>> extracting a wavetable from a portion of a note (as opposed to the

>> heterodyne oscillator approach).

>>

>

> Exactly what I've already coded! Curious what the heterodyne oscillator

> approach is, but don't tell me, I'll look it up myself, thx as always.

>
pitch detect **and** resmpling?� as simple as it sounds, there's a bunch of 
code in that.
(i'll tell you anyway) the heterodyne oscillator approach is what James 
Beauchamp and Andrew Horner and every other author i know of that has done 
analysis of musical notes to get the
envelope for each harmonic.� it still requires knowledge from a pitch detector 
and then you multiply the note by this oscillator:


� �o[n] = e^(-j 2 pi f/fs n) = cos(2 pi f/fs n) - j sin(2 pi f/fs n)
where fs is the sampling frequency and f is the exact frequency of the harmonic 
you're looking at.� this will bump the real and imaginary parts of that 
harmonic down to DC.� then LPF both real and
imaginary parts of the result to get only the DC, then calculate magnitude and 
phase of that DC value and you have the magnitude and phase of your harmonic at 
frequency f.
...


>> And why do you need the _exact_ frequencies?

>>

>

> Only to have the exact wavelength, so I can do a DFT and get the exact

> harmonics from each disk and the amount of leakage.

>
�
right, and if you **do** have a perfectly periodic waveform that goes into your 
DFT, then there is no DFT bin leakage, if that is the leakage you mean.
if you mean leakage of other tonewheels into the waveform of interest, that's a 
different issue.� maybe you
should mark off 16 contiguous periods (after resampling so it's exactly 16 
periods) and FFT that.� then bin 0 is your DC component, bin 16 is your first 
harmonic, bin 32 your second, etc.� the bins in between should be virtually 
zero and if they aren't, there is something else messing it
up.
�

--



r b-j� � � � � � � � � � � � �r...@audioimagination.com



"Imagination is more important than knowledge."

�
�
�
�
___
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-04 Thread Robin Gareus
On 1/4/19 3:22 PM, Frank Sheeran wrote:
> Hey, if you don't want an actual Hammond, that's why I wrote the entire
> soft synth in the first place!  :-D
> 
> The main reason I'm doing this patch is as a case study showing my soft
> synth can emulate a real Hammond (and Leslie) warts and all, to a very deep
> level, and showing how one would go about it.

Hi Frank,

You may want to have a look at
   https://github.com/pantherb/setBfree
'warts and all' even managed to creep into the source-code there :)

The tonewheels in that case are pure sine waves with -40dB compartment
leakage, -40dB terminal-strip cross-talk and also -40dB for wire model,
but those are configurable (see src/tonegen.c). IMHO it does sound very
realistic e.g. https://vimeo.com/130633814

A related issue, there is a really nice paper analyzing the key-click:
https://asa.scitation.org/doi/full/10.1121/1.5003796

Cheers!
robin
___
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-04 Thread STEFFAN DIEDRICHSEN


> On 04.01.2019|KW1, at 15:22, Frank Sheeran  wrote:
> 
> Thank you Nigel, RB-J, Steffan, and Neil.


You’re welcome!
> 
>  
> 
> i suspect that those tone wheel waveforms are close to sinusoidal.
> 
> Early models were.  Starting I think around '53 with the B-3, C-3 and A1xx 
> series (A100 etc.) they were a bit brighter, and the foot pedals were FAR 
> brighter.


Actually, only the wheels #1 -#13 have a sort of complex waveform. But the 3 
series have a slight level slope, the higher frequencies are a bit louder. This 
was a kind of emphasis, which in conjunction with a de-emphasis filter in the 
pre-amp reduced the key click a bit. As a penalty, the harmonic distortion of 
the higher tone wheels is a bit higher. 

> 
> A social network acquaintance supplied me the recording.  I'm not sure where 
> they tapped in to get it.  What it DOES have--and I'm glad of it--is the 
> leakage from the neighboring disk.  The disks are basically all in little 
> compartments of two disks, 4 octaves apart,

There are some wheels with 192 teeth, so the distance is not 4 octaves but an 
extra quint.


> and each disk is picked up by the other's pickup to some extent.  It's 
> absolutely audible, maybe -36dB down or something.

This can be pretty enervating, depending on the organ. Later models had extra 
networks to remove the “sub-harmonic”. 


>  
> 
> The tonewheels are intended to be perfectly sinusoidal, though their mass
> stamping does introduce various differences. The exception is the lowest
> octave of certain models, B3 included, made at certain times, as described
> here:
> 
> My understanding is that the first Hammonds up to the but not including the 
> B-3/C-3/A1xx models, were nearly sinusoidal, but after that they were 
> brightened considerably and that's what I'm seeing in my recording.

This might be introduced by the recording. The Hammond organ is a current 
mixer, the output of the tone wheel and the subsequent filter present on tone 
wheels #49 - #91 runs into matching transformer with a primary resistance < 1 
ohm via mixing resistors , which are  between 30 -100 ohm IIRC, typically 50 
ohm.

>  
> 
> http://www.dairiki.org/HammondWiki/ToneWheel 
> 
> 
> Given the intent of the tonewheel, I wouldn't bother with this particular
> experiment at all if I were trying to recreate a B3.  But then, I wouldn't do 
> any foldback either.


The foldback in the lowest octave was necessary to circumvent the missing 
sinusoidal wheels #1- #13, which had complex wave forms now. 
The foldback in the upper octaves was always there and is necessary to achieve 
the typical sound of an organ with all stops pulled out. 


> 
> Hey, if you don't want an actual Hammond, that's why I wrote the entire soft 
> synth in the first place!  :-D
> 
> The main reason I'm doing this patch is as a case study showing my soft synth 
> can emulate a real Hammond

The Synclavier was claiming that, too. It worked to a certain extent. 

> (and Leslie)

That’s the hard thing, since the Leslie defined the sound much more than the 
organ itself. 


> warts and all, to a very deep level, and showing how one would go about it.
> 
> But it's also well-known that every tonewheel
> organ has its own character due to being a very complex electro-mechanical
> device, so I suppose I might try this analysis if I were attempting to
> create a framework for creating such differenced organs.
> 
> The more modern "clonewheel" organs do let you simulate each wheel's 
> harmonics individually, etc.  In fact I should go look at a Hammond XK-5 just 
> to see if my research is similar to their default settings.

You can adjust the levels but not the harmonics themselves. But even that works 
well. 

>  
> It'd be interesting if a clonewheel manufacturer had an automated service 
> whereby you upload a recording as I requested of my organ acquaintance, then 
> let you download a patch that matched that exact organ.

Since most organ owners don’t have the knowledge nor the equipment how to 
create the recording, I doubt that this might be a great business model. 
Although it is somehow similar to the Kemper amp business model, I’d would 
assume, that most buyers of the Kemper amp are fine with the models supplied 
and shared over the internet. 

Best,

Steffan 


___
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-04 Thread Frank Sheeran
Thank you Nigel, RB-J, Steffan, and Neil.



i suspect that those tone wheel waveforms are close to sinusoidal.
>

Early models were.  Starting I think around '53 with the B-3, C-3 and A1xx
series (A100 etc.) they were a bit brighter, and the foot pedals were FAR
brighter.



> but to find out from your .wav file, you can apply a pretty simple pitch
> detection to get the period of the waveform to a precision of
> fractional sample.? then you can divide that period into N samples using
> interpolation and resampling techniques.? this is how i would advocate
> extracting a wavetable from a portion of a note (as opposed to the
> heterodyne oscillator approach).
>

Exactly what I've already coded!  Curious what the heterodyne oscillator
approach is, but don't tell me, I'll look it up myself, thx as always.



how did you record the signals? If taken from the TWG terminal strip, they
> contain also a ton of neighbor frequencies, sub-harmonics, etc.


A social network acquaintance supplied me the recording.  I'm not sure
where they tapped in to get it.  What it DOES have--and I'm glad of it--is
the leakage from the neighboring disk.  The disks are basically all in
little compartments of two disks, 4 octaves apart, and each disk is picked
up by the other's pickup to some extent.  It's absolutely audible, maybe
-36dB down or something.  Since the two disks are locked in frequency,
though, I'm just incorporating the partner into the wavetable, so it has
zero performance penalty while playing.  (My synth calculates the wavetable
contents when a patch is loaded/parsed, so it takes an extra few tenths of
a second should you change the leakage coefficient, which will be
user-editable but not in real-time.)



And why do you need the _exact_ frequencies?
>

Only to have the exact wavelength, so I can do a DFT and get the exact
harmonics from each disk and the amount of leakage.


> Happy new year and all the best!
>

To you too, Staffan!


The tonewheels are intended to be perfectly sinusoidal, though their mass
> stamping does introduce various differences. The exception is the lowest
> octave of certain models, B3 included, made at certain times, as described
> here:
>

My understanding is that the first Hammonds up to the but not including the
B-3/C-3/A1xx models, were nearly sinusoidal, but after that they were
brightened considerably and that's what I'm seeing in my recording.


>
> http://www.dairiki.org/HammondWiki/ToneWheel
>
> Given the intent of the tonewheel, I wouldn't bother with this particular
> experiment at all if I were trying to recreate a B3.  But then, I wouldn't
> do any foldback either.


Hey, if you don't want an actual Hammond, that's why I wrote the entire
soft synth in the first place!  :-D

The main reason I'm doing this patch is as a case study showing my soft
synth can emulate a real Hammond (and Leslie) warts and all, to a very deep
level, and showing how one would go about it.

But it's also well-known that every tonewheel
> organ has its own character due to being a very complex electro-mechanical
> device, so I suppose I might try this analysis if I were attempting to
> create a framework for creating such differenced organs.
>

The more modern "clonewheel" organs do let you simulate each wheel's
harmonics individually, etc.  In fact I should go look at a Hammond XK-5
just to see if my research is similar to their default settings.

It'd be interesting if a clonewheel manufacturer had an automated service
whereby you upload a recording as I requested of my organ acquaintance,
then let you download a patch that matched that exact organ.

Thanks again, all.
___
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-02 Thread raito
Robert,

The tonewheels are intended to be perfectly sinusoidal, though their mass
stamping does introduce various differences. The execption is the lowest
octave of certain models, B3 included, made at certain times, as described
here:

http://www.dairiki.org/HammondWiki/ToneWheel

Given the intent of the tonewheel, I wouldn't bother with this particular
experiment at all if I were trying to recreate a B3. But then, I wouldn't
do any foldback either. But it's also well-known that every tonewheel
organ has its own character due to being a very complex electro-mechanical
device, so I suppose I might try this analysis if I were attempting to
create a framework for creating such differenced organs.

The difference in frequency could also be explained by the state of
maintenance of the tone generator. If it has more than nominal friction
that could slow down the mechanism.

Neil Gilmore
ra...@raito.com

___
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-02 Thread STEFFAN DIEDRICHSEN
Frank, 

how did you record the signals? If taken from the TWG terminal strip, they 
contain also a ton of neighbor frequencies, sub-harmonics, etc. And sometime, 
the wheels have a certain flutter lading to some kind of low frequency 
modulations, etc. So, if you’re just off by 0.7 cents of, that might be OK, 
depending on the condition of the organ you’re using. There might be some dirt 
in the gear, which might lead to uneven frequencies, etc. 
And why do you need the _exact_ frequencies?

Happy new year and all the best!

Steffan




> On 02.01.2019|KW1, at 01:45, 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-02 Thread robert bristow-johnson



> 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.
�
i suspect that those tone wheel waveforms are close to sinusoidal.
but to find out from your .wav file, you can apply a pretty simple pitch 
detection to get the period of the waveform to a precision of
fractional sample.� then you can divide that period into N samples using 
interpolation and resampling techniques.� this is how i would advocate 
extracting a wavetable from a portion of a note (as opposed to the heterodyne 
oscillator approach).
from the N-sample periodic wavetable,
you can do an FFT.� bin 0 is DC, bin 1 is the fundamental, bin 2 is the second 
harmonic, etc.
if you simply window the segment and FFT is, you will not be spared the task of 
interpolation, if you want to do this right.� my preference is to interpolate 
between samples to get a
periodic wavetable.
--

r b-j� � � � � � � � � � � � �r...@audioimagination.com



"Imagination is more important than knowledge."

�
�
�
�
___
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 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
>