DSPRelated.com
Forums

Clipped before FFT

Started by Robert Scott May 10, 2013
Thanks for all your responses.  I will be getting Rabiner's book for
further study.  But to answer a few questions:

I know clipping creates harmonics that were not there.  That is fine.
I am not trying to do any fancy engine diagnostics.  The sole purpose
of this application is to measure the RPM of the engine.  Our app is
already on the iPhone under the name "Engine RPM".  If you go to
iTunes and look it up you will also see that the reviews have not been
favorable, hence my desire to improve the reliability of the RPM
detection.

I am aware that if the ear cannot detect any kind of pitch in the
sound then the analysis is probably going to fail.  This might be the
case for a highly-muffled engine, or one that has lots of
non-correlelated noise, like fan belts, compressors, etc.  The app was
developed primarily to help calibrate the tachometer on a
single-engine airplane.  For that application it works fairly well as
is, provided the user optimally adjusts several configuration
parameters.  We help the user make these adjustments by displaying a
graph of the frequency spectrum along with markers of where our
detection algorithm thinks it has found harmonics.

@Robert B-J:  What does AMDF or ASDF stand for?  I am not familiar
with those abreviations.

@Vladimir Vassilevsky: Regarding tach data and non-uniform rotational
speed, I have seen the same thing.  On a different project I designed
a timing collection module connected to a ring gear pickup for an
engine test stand.  The purpose was to estimate the power contribution
from each cylinder by observing the short-term acceleration produced
during the power stroke.  Even with a heavy flywheel, the acceleration
is easily measureable, especially when the engine is under some load.

As for autocorrelation, I would like to pursue that too.  But I need
to do it efficiently since the application is real-time and does not
use very power processors (just an ARMv7 1GHz in a smartphone).  I am
sampling audio at 11025 samples per second and doing FFTs on 8192
non-windowed samples at a time.  I am doing this in probably 10% of
the available time.  So I guess I have time to do the two FFTs
necessary to implement efficient autocorrelation.  Then the search for
peaks in the autocorrelation function would be similar to my search
for peaks in the frequency domain, right?

Robert Scott
Hopkins, MN
On Fri, 10 May 2013 23:59:05 -0700 (PDT), robert bristow-johnson
<rbj@audioimagination.com> wrote:

>On May 11, 1:32=A0am, Vladimir Vassilevsky <nos...@nowhere.com> wrote: >> >> BTW, I was surprised to see from tach data how irregular and nonuniform >> is rotation rate of conventional piston engine. >> > >even for an engine that is not sick and with the accelerator pedal >held at a fixed position? > >well the 4 cylinders are not positioned in a circle (like those old >airplane engines), so there might be something in the 1/4th sub- >harmonic. > >otherwise, the mechanics should be the same for every piston firing, >no?
In a properly running engine each piston should make the same force and burn the same amount of fuel and so produce the same amount of energy and power. The firing orders are evenly spaced. So estimating rpm from the sound is a reasonable idea, but many practicalities get in the way as the OP is discovering. Cams and other rotating shafts (like balance shafts) rotate at submultiples of the crankshaft, and accessories (alternator, water pump, supercharger, etc.) rotate at (usually) non-integer multiples of the crankshaft. The design of the exhaust header/mufflers/resonators may result in the exhaust pulses reaching the exit(s) unevenly spaced or interfering with each other, etc.,etc. A turbo-charger sits between the engine and the exhaust outlet also modifies the sound. A lot of automotive engines make more noise through the intake than the exhaust, and that has its own set of plumbing, etc. The number of cylinders and angle of V motors, firing order, etc., are usually chosen to minimize mechanical vibration. OTOH, Ferrari V8's sound like Ferrari V8's because the use a "flat crank", where all of the rod journals are on a plane 180 degrees apart, produces a distinctive sound. So there's a lot of variety in the possibilities of what you might hear from a running reciprocating engine. This doesn't even touch on things like radial engines, rotaries, etc., etc. So even though each piston firing should be equal (on a healthy modern engine) from a mechanical or power perspective, the sound it produces may not be the same as one of its brethren in the same motor. Long ago I did some work estimating the speed of passing vehicles from the audio, using the Doppler to estimate the change in frequency. That works when there are good "spectral characteristics", i.e., the autocorrelation has a reasonable peak, but that isn't always the case. Eric Jacobsen Anchor Hill Communications http://www.anchorhill.com
On May 11, 10:12&#4294967295;am, no-...@notreal.invalid (Robert Scott) wrote:
> > @Robert B-J: &#4294967295;What does AMDF or ASDF stand for? &#4294967295;I am not familiar > with those abreviations. >
Average Magnitude Difference Function: N-1 Q[k] = 1/N SUM{ | x[n] - x[n-k] | } n=0 Average Squared Difference Function N-1 Q[k] = 1/N SUM{ ( x[n] - x[n-k] )^2 } n=0 you are adding (or averaging) only non-negative numbers that approach zero when k gets very small or when k approaches an integer multiple of the period of x[n]. so you are looking for what value of k gets to a minimum of Q[k]. you can slide this definition to wherever you want to measure period in the data, and you might want to window the data before summing. and you might want to filter and DC block x[n]. it's in the Rabiner and Schafer book. it's pretty old ideas (like the 70s). r b-j
On Sat, 11 May 2013 05:48:25 -0700 (PDT), makolber@yahoo.com wrote:

>I'll go out on a limb here and say this... >If you can 't judge the rpm by listening to the sound by ear, then no algorithm has a chance >I don't mean get an actual number by ear , I mean if your ear can't separate the desired rpm signal from the noise, then no algorithm will be able to >So listen to the sound first, and you may decide you need to get a better pickup point to start with >The ear/brain is very good >Mark
Many racers/car guys try to have an ear for motors, mostly for macho stuff like identifying the number of cylinders, estimating how much power its making, etc. Some people get pretty good at it, but there's always an oddball case that fools everybody. Chevy/GM LSx V8 motors have a pretty distinctive sound that even over a variety of applications is pretty identifiable. The last couple of years at our national race a guy has shown up with a Nissan 240SX that for whatever reason makes everybody think it's had an LS V8 motor swap (and it definitely sounds like it), but it still has a (somewhat modified) Nissan four-cylinder. He gets remarks often enough that he has text on the back that says "It's not a V8!" Estimating rpm seems reasonable in a rough sense, but to your point I don't know that it can be done reliably. Eric Jacobsen Anchor Hill Communications http://www.anchorhill.com
On Sat, 11 May 2013 00:13:13 +0000 (UTC), glen herrmannsfeldt
<gah@ugcs.caltech.edu> wrote:

>Robert Scott <no-one@notreal.invalid> wrote: >> I have been experimenting with some time-domain pre-processing to >> improve the reliability of an FFT application. The application is >> extracting the RPM of an engine from the sound it makes. Prior to >> these experiements I was using straight FFT of blocks of time-series >> sound data. An engine generally makes a sound rich in harmonics, so >> the FFT should have evenly spaced peaks. > >Seems to me that you could easily have a different periodic signal >high in amplitude. Say a squeaky alternator pully, for example. > >I have seen emission inspection systems that want to measure the engine >RPM that plug into the cigarette lighter (presumably some harmonics go >into the engine electrical system) and also a vibration sensor that goes >on the hood. (So, mechanically coupled, not air coupled, vibrations.) > >-- glen
Tapping the electrical system is the most reliable "non-contact" method I know of for estimating rpm reasonably accurately, but you still need to know the number of cylinders or that'll get fooled pretty easily. The characteristics of the electrical noise from the ignition are quite different than the acoustic response, though. Eric Jacobsen Anchor Hill Communications http://www.anchorhill.com
On Sat, 11 May 2013 14:12:15 GMT, no-one@notreal.invalid (Robert
Scott) wrote:

>Thanks for all your responses. I will be getting Rabiner's book for >further study. But to answer a few questions: > >I know clipping creates harmonics that were not there. That is fine. >I am not trying to do any fancy engine diagnostics. The sole purpose >of this application is to measure the RPM of the engine. Our app is >already on the iPhone under the name "Engine RPM". If you go to >iTunes and look it up you will also see that the reviews have not been >favorable, hence my desire to improve the reliability of the RPM >detection. > >I am aware that if the ear cannot detect any kind of pitch in the >sound then the analysis is probably going to fail. This might be the >case for a highly-muffled engine, or one that has lots of >non-correlelated noise, like fan belts, compressors, etc. The app was >developed primarily to help calibrate the tachometer on a >single-engine airplane. For that application it works fairly well as >is, provided the user optimally adjusts several configuration >parameters. We help the user make these adjustments by displaying a >graph of the frequency spectrum along with markers of where our >detection algorithm thinks it has found harmonics.
The propeller noise dominates with an airplane and so I'd expect that to be easier to estimate than an automotive engine. Have you used it with airplanes with gear reduction (e.g., Cessna 421)?
>@Robert B-J: What does AMDF or ASDF stand for? I am not familiar >with those abreviations. > >@Vladimir Vassilevsky: Regarding tach data and non-uniform rotational >speed, I have seen the same thing. On a different project I designed >a timing collection module connected to a ring gear pickup for an >engine test stand. The purpose was to estimate the power contribution >from each cylinder by observing the short-term acceleration produced >during the power stroke. Even with a heavy flywheel, the acceleration >is easily measureable, especially when the engine is under some load.
But it averages well and is periodic with the engine rotation, which is what you're trying to estimate. For that reason I'd think it'd be negligible compared to other impairments.
>As for autocorrelation, I would like to pursue that too. But I need >to do it efficiently since the application is real-time and does not >use very power processors (just an ARMv7 1GHz in a smartphone). I am >sampling audio at 11025 samples per second and doing FFTs on 8192 >non-windowed samples at a time. I am doing this in probably 10% of >the available time. So I guess I have time to do the two FFTs >necessary to implement efficient autocorrelation. Then the search for >peaks in the autocorrelation function would be similar to my search >for peaks in the frequency domain, right?
Yes and the tradeoffs will likely be around the complexity, as you suggest.
> >Robert Scott >Hopkins, MN
I think you have a difficult problem to solve. ;) Eric Jacobsen Anchor Hill Communications http://www.anchorhill.com
Eric Jacobsen <eric.jacobsen@ieee.org> wrote:

(snip, I wrote)
>>I have seen emission inspection systems that want to measure the engine >>RPM that plug into the cigarette lighter (presumably some harmonics go >>into the engine electrical system) and also a vibration sensor that goes >>on the hood. (So, mechanically coupled, not air coupled, vibrations.)
> Tapping the electrical system is the most reliable "non-contact" > method I know of for estimating rpm reasonably accurately, but you > still need to know the number of cylinders or that'll get fooled > pretty easily. The characteristics of the electrical noise from the > ignition are quite different than the acoustic response, though.
The emission inspection system knows the VIN, which I believe can be traced back to the number of cylinders. The engine that I do this with, and sometimes it took the system a little while to figure out, is a Chrysler 3.3l V6 that uses three ignition coils and no distributor. No idea what that does on the electrical system different than a traditional one coil system. The spark timing is generated directly by the computer, from rotational position sensors on the crankshaft. -- glen
Eric Jacobsen <eric.jacobsen@ieee.org> wrote:
> On Sat, 11 May 2013 05:48:25 -0700 (PDT), makolber@yahoo.com wrote:
(snip)
> Many racers/car guys try to have an ear for motors, mostly for macho > stuff like identifying the number of cylinders, estimating how much > power its making, etc. Some people get pretty good at it, but > there's always an oddball case that fools everybody.
Reminds me of the early V6 engines. The traditional V8 has a 90 degree V angle, convenient for eight cylinders firing every other revolution. The early V6s also had a 90 degree V, so non-uniform timing between cylinders. (It was also visible in the spacing on the distributor cap.) After watching Zero-dark-thirty, I was reading in wikipedia on how they do noise reduction on helicopters. One is to change the blade positions so that they are not equally spaced. Move the harmonics around a little, so it is less audible. Sneaking in quietly by helicopter in the middle of the night can't be easy. -- glen
On Sat, 11 May 2013 19:45:34 +0000 (UTC), glen herrmannsfeldt
<gah@ugcs.caltech.edu> wrote:

>Eric Jacobsen <eric.jacobsen@ieee.org> wrote: > >(snip, I wrote) >>>I have seen emission inspection systems that want to measure the engine >>>RPM that plug into the cigarette lighter (presumably some harmonics go >>>into the engine electrical system) and also a vibration sensor that goes >>>on the hood. (So, mechanically coupled, not air coupled, vibrations.) > >> Tapping the electrical system is the most reliable "non-contact" >> method I know of for estimating rpm reasonably accurately, but you >> still need to know the number of cylinders or that'll get fooled >> pretty easily. The characteristics of the electrical noise from the >> ignition are quite different than the acoustic response, though. > >The emission inspection system knows the VIN, which I believe can be >traced back to the number of cylinders. > >The engine that I do this with, and sometimes it took the system a >little while to figure out, is a Chrysler 3.3l V6 that uses three >ignition coils and no distributor. No idea what that does on the >electrical system different than a traditional one coil system. > >The spark timing is generated directly by the computer, from rotational >position sensors on the crankshaft.
Most modern cars are that way, many with an independent coil directly on each plug. There's still enough electrical noise from the spark to get picked up elsewhere in the system for rpm estimation, partly because that allows a more energetic spark with less loss to the plug. If you have a diesel, though, you're screwed. ;) This is a common problem when running a diesel on a chassis dynamometer, as there's no easy way to instrument the rpm to get both hp and torque measurements. Eric Jacobsen Anchor Hill Communications http://www.anchorhill.com
On Sat, 11 May 2013 19:52:37 +0000 (UTC), glen herrmannsfeldt
<gah@ugcs.caltech.edu> wrote:

>Eric Jacobsen <eric.jacobsen@ieee.org> wrote: >> On Sat, 11 May 2013 05:48:25 -0700 (PDT), makolber@yahoo.com wrote: > >(snip) > >> Many racers/car guys try to have an ear for motors, mostly for macho >> stuff like identifying the number of cylinders, estimating how much >> power its making, etc. Some people get pretty good at it, but >> there's always an oddball case that fools everybody. > >Reminds me of the early V6 engines. > >The traditional V8 has a 90 degree V angle, convenient for >eight cylinders firing every other revolution. The early V6s >also had a 90 degree V, so non-uniform timing between cylinders. >(It was also visible in the spacing on the distributor cap.)
Yeah, there are a few motors with irregular spacing in the firing, so that's not an absolute. The different V angles result in different firing orders for balance and all of those things (and everything else) changes the sound characteristics of the engine. e.g., everybody loves the sound of a V12 Merlin, especially if there's more than one. ;)
>After watching Zero-dark-thirty, I was reading in wikipedia on how >they do noise reduction on helicopters. One is to change the >blade positions so that they are not equally spaced. Move the >harmonics around a little, so it is less audible. Sneaking in >quietly by helicopter in the middle of the night can't be easy.
That's also why the tread blocks on tires are of irregular lengths, to spread the spectrum of the noise as the tire rolls along. Some treaded race tires have equal-sized tread blocks and they're LOUD when driven on the road. e.g., this old Yokohama design: http://europe.yokohama-online.com/Products.33.0.html?&no_cache=1&tx_yokotyres_pi1%5BshowUid%5D=33&tx_yokotyres_pi1%5Btyres_L0%5D=2&tx_yokotyres_pi1%5Btyres_L1%5D=9&tx_yokotyres_pi1%5Btyre%5D=59&cHash=03c5b8c48d Eric Jacobsen Anchor Hill Communications http://www.anchorhill.com