Hacker News new | past | comments | ask | show | jobs | submit login
How Audio Fingerprinting Works (emysound.com)
259 points by dceddia on Jan 2, 2022 | hide | past | favorite | 19 comments



I’ve wanted to learn more about DSP for a while and recently started working through The Scientist and Engineer’s Guide to DSP [0] and it’s been fantastic. It’s much heavier on explanations and lighter on math equations than other books or courses I’d seen previously. It’s helping me build some real intuition around this stuff.

That book plus this article’s excellent explanations really helped things click for me and I’m very grateful to both authors!

0: https://www.dspguide.com/


I've been trying to figure out how to make IIR filters for a software modular synth, off and on for years now. (Basically, given parameters like cutoff frequency and dB per octave rolloff, how do I find the filter coefficients? There must be closed-form functions for this buried inside VCV Rack, Audacity, and LMMS somewhere, but the code is hard to follow. I don't know how all the Wikipedia articles and DSP guides manage to skip over this step, the only step I don't understand. Some of them even punt to "Call this Matlab function" or "Use this PHP page that generates C code for you" Bleh!)

I did encounter this book, but it still couldn't help me figure it out. I bookmarked it to try again.


First: cutoff, resonance, filter slope, etc., can be built with FIR (finite impulse response) filters. You can describe the passive circuit with a transfer function, which can be implemented in DSP using a z-transform. You can also describe a filter with poles and zeroes, and transform those. There's a bunch of resources on the web, e.g. https://ccrma.stanford.edu/~jos/filters/, but many assume you know something of electronics.

Recurrent filters don't have closed form solutions, and their implementation is a bit of an art. Plugin maker Urs Heckmann (from u-he.com) did a (rather successful) attempt at modeling the filter from an old synth with various implementations, and let people test them in the wild. He blogged about it, but I can't find all relevant posts. This might be a starting point: https://urs.silvrback.com/zero-delay-feedback

This course (https://www.staff.ncl.ac.uk/oliver.hinton/eee305/) is based on a book and links to the chapters, but there's a lot more (check the websites of MIT or Stanford's EE department for online courses).


These are the formulas you want:

https://webaudio.github.io/Audio-EQ-Cookbook/Audio-EQ-Cookbo...

They are the classic IIR biquads. If you want steeper filters, just run multiple equal filters in series (high-order IIRs are prone to numeric instability).

A more modern formatted version exists at e.g. https://www.w3.org/TR/audio-eq-cookbook/ .


I've had similar struggles. I found this comparison between Ableton's EQ Eight and Pro-Q by Dan Worrall [1] to be incredibly (and unexpectedly) informative on the subject. He is a very good teacher and an expert in the area. Maybe it might on your journey.

[1]: https://www.youtube.com/watch?v=ebBqP2PteAQ (be sure to watch from 15min+ onwards but the entire thing is a treat)


Conditioned on what you want to achieve, I would suggest against, strongly against, or very strongly against avoiding (applied) mathematics.

In any case, I suggest flipping through the IEEE Signal Processing Magazine [1] and reevaluating your learning path.

[1] https://signalprocessingsociety.org/publications-resources/i...


I'd say my goal is not so much about avoiding math but more about learning intuition-first rather than equations-first. Top-down vs. bottom-up, maybe. Most of material that I've encountered about math-heavy stuff tends to do the latter.

I imagine there are many people who're great at picking apart an equation and deriving things from first principles; but for me, I find it more manageable to get the big picture first, visualize what's going on, and then finally learn the math behind it. So far the DSP Guide book is doing a great job of presenting things that way.

Another good example of this kind of style is https://betterexplained.com/ (some of their articles are great companions to these DSP topics actually!)


Can you elaborate on why you so strongly advise against it?


I can only invite you to flip through current technical texts in signal processing and go through the thought exercise of defining the envelope of prior knowledge required.

I recommend the IEEE Signal Processing Magazine as it is the flagship magazine from the IEEE Signal Processing Society. IEEE magazine articles are written “to appeal to non-experts as well as experts in the field” [1] and therefore target a broad engineering audience while remaining current and being peer-reviewed.

[1] https://magazines.ieeeauthorcenter.ieee.org/get-started-with...


(2020). See also https://news.ycombinator.com/item?id=9870408, which I found more interesting (and that the author should probably have referenced).


A very long time ago (around 2000) I came up with the idea to record my car's engine sound, use a FFT on that, find the dominant frequency change over time, and then use the car's gear ratio / wheel size to find back the power curve. I'd drive my car both ways on an empty street, in 2nd gear, from idle to the rev limiter. Then I'd compute the two curves and average them.

It was fascinating: the curve plotted was matching nearly exactly the power curve given by the car manufacturer.

I think it's the first Java program I wrote. I copy/pasted some discrete FFT code I found somewhere.

It was a nice little project for it's way simpler than trying to fingerprint audio using FFT like Shazam does: yet I got to learn a bit about harmonics, FFT / amplitude over time vs amplitude over frequency, car drag coefficient, etc.

As I never throw anything I probably still have that crappy code somewhere!


Cool stuff. You might enjoy this video[0] where Ben K. from Applied Science measures the RPM of his car engine via the cigarette lighter by measuring the inductive ignition spikes with an FFT on his scope.

[0] https://youtu.be/t0ToYhjYV9I


Thanks for sharing that! Aside from the excessive fawning over the scope that was a great video - I think it’s awesome that the result differed from expectations with the (spoiler alert!) DMC-12’s uneven firing pattern and made the whole thing more interesting.


You could also use the accelerometer in the phone to measure power transfer.


Wonderful article, I knew some of this but learned a lot more.


Outstanding. I don't know much about audio or fingerprinting, but I know much more after reading this article. Thanks.


Seconded. Absolutely superb. I use Audactity and ffmpeg for analyzing sounds all the time and had only intuited these foundations, which are described in such a straightforward way here.


This is one amazing article. Bravo!


(2020)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: