Live data from Hacker News

Fourier Transforms – The Math Trick Behind MP3s, JPEGs, and Homer Simpson’s Face

nautil.us

11–20 of 105 posts

Re: Fourier Transforms – The Math Trick Behind MP3s, JPEGs, and Homer Simpson’s Face

#11

EDIT: I mixed up high vs low frequencies, as the reply pointed out, so I've edited this to be correct now. The reason we can get away with throwing away low frequencies in JPEG is because humans are prone to notice significant details rather than tiny details. High frequencies of a Fourier transform of an image == tiny detail (like being able to distinguish individual hairs) Low frequencies of a Fourier transform of…

To illustrate, here is an example of zeroing the lowest frequencies:

http://imgur.com/a/wVjYk

Re: Fourier Transforms – The Math Trick Behind MP3s, JPEGs, and Homer Simpson’s Face

#12
post #3

Hi Hacker News - I'm the author of the piece, also on twitter @aatishb. Look forward to hearing your thoughts. I encourage you to share your thoughts and insights with other readers by leaving a comment on the post, particularly if you know of other interesting applications about the Fourier transform. Cheers!

OK, since you asked: > The sound wave produced by a piano note is a simple sine wave. No, it's not. A piano note is a complicated stack of overtones (some of which are harmonic and some of which aren't) and transients. If it was just a sine wave, it would sound like a sine wave and not like a piano. This is part of why things like Shazam are so difficult: musical notes aren't just a single frequency in the FFT, they…

I love the FFT even more than you and enjoyed that it is getting lauded, but would have found more algorithmic details even more interesting. Breaking down DFT, etc. and then showing the performance magic of FFT is a great way to approach discussion of many issues in problem analysis and algorithm design.

So, Nice enough article for slipping into the topic - now give me more! harder! faster!

Re: Fourier Transforms – The Math Trick Behind MP3s, JPEGs, and Homer Simpson’s Face

#13
post #3

Hi Hacker News - I'm the author of the piece, also on twitter @aatishb. Look forward to hearing your thoughts. I encourage you to share your thoughts and insights with other readers by leaving a comment on the post, particularly if you know of other interesting applications about the Fourier transform. Cheers!

OK, since you asked: > The sound wave produced by a piano note is a simple sine wave. No, it's not. A piano note is a complicated stack of overtones (some of which are harmonic and some of which aren't) and transients. If it was just a sine wave, it would sound like a sine wave and not like a piano. This is part of why things like Shazam are so difficult: musical notes aren't just a single frequency in the FFT, they…

This is actually really valuable feedback and one of the things I like about the HN audience. I struggle to strike a balance between precision and simplicity, and your comments raised many interesting subtleties that I had overlooked. So thanks for helping me get a better handle on this.

Re: Fourier Transforms – The Math Trick Behind MP3s, JPEGs, and Homer Simpson’s Face

#14

EDIT: I mixed up high vs low frequencies, as the reply pointed out, so I've edited this to be correct now. The reason we can get away with throwing away low frequencies in JPEG is because humans are prone to notice significant details rather than tiny details. High frequencies of a Fourier transform of an image == tiny detail (like being able to distinguish individual hairs) Low frequencies of a Fourier transform of…

To illustrate, here is an example of zeroing the lowest frequencies: http://imgur.com/a/wVjYk

Oh, so your brain can still mostly recreate the shape even with no low frequencies!

Re: Fourier Transforms – The Math Trick Behind MP3s, JPEGs, and Homer Simpson’s Face

#15
post #4

This is a great post, but it's a little bit misleading when talking about MP3s and lossy compression and conflates analog fourier analysis with discrete analysis. When you're talking about a digital signal, it is the sample rate that determines the maximum frequency you can represent. It's not MP3s that "throw out the really high notes" -- it's any digital signal. A discrete fourier transform actually is lossless, bu…

Yes, any digital signal has a limited bandwidth However, MP3s throw more high frequencies than the digital signal at that given sampling rate allows.

Well, sort of. If you have a wav file and an mp3 file, both of which have a sample rate of 44kHz, they will both be able to represent the same maximal frequency of 22kHz. The mp3 wouldn't necessarily discard the high frequency information, but it may do so when it is deemed that the sound wouldn't be perceivable.

Re: Fourier Transforms – The Math Trick Behind MP3s, JPEGs, and Homer Simpson’s Face

#16
When we first covered the FS (Fourier Series) and FT (Fourier Transform) and the relation between the two in our Signals and Systems course in EE, I was amazed. It was the greatest thing I've ever learned, and I think it'll be hard to top.

Once you understand the FT, you basically understand how a signal is structured. By converting (or transforming) a time signal to the frequency domain, one can clearly see what frequency components (or harmonics) contribute to said signal. If one were to try the same in the time domain, it would be much more difficult to visualize.

Re: Fourier Transforms – The Math Trick Behind MP3s, JPEGs, and Homer Simpson’s Face

#17
post #8
post #4

This is a great post, but it's a little bit misleading when talking about MP3s and lossy compression and conflates analog fourier analysis with discrete analysis. When you're talking about a digital signal, it is the sample rate that determines the maximum frequency you can represent. It's not MP3s that "throw out the really high notes" -- it's any digital signal. A discrete fourier transform actually is lossless, bu…

Thanks for your feedback. Sure, any digital signal is by definition finite in its resolution (the sample rate or bits). I was trying to address the distinction between wave files of the type stored on audio CDs, and MP3s - both digital signals. I agree that the Fourier transform is in principle lossless, but it's particularly useful to use it in a lossy way, i.e. to throw out the least important (to us) components of…

Well, if you want to be 100% accurate, I think the section talking about how the high notes aren't important could be clarified. The really high "notes" have already been lost when you recoded the wav file digitally. The lossy step of mp3 encoding is not a result of the transform, but what you do with that information and is more complex than just discarding high frequency components.

Also, the the word "note" is confusing in the context of music, since really low notes usually contain a lot of high frequency information.

Re: Fourier Transforms – The Math Trick Behind MP3s, JPEGs, and Homer Simpson’s Face

#18
post #5

Elegantly explained. Does anyone know of similar posts on other transforms like Z, etc?

It's not a short pithy blog post, but this is a good intro to the Laplace transform: http://ocw.mit.edu/courses/mathematics/18-03-differential-eq...

Re: Fourier Transforms – The Math Trick Behind MP3s, JPEGs, and Homer Simpson’s Face

#19
post #14

Earlier quoted context omitted.

To illustrate, here is an example of zeroing the lowest frequencies: http://imgur.com/a/wVjYk

Oh, so your brain can still mostly recreate the shape even with no low frequencies!

Depends on how far away from the image you are, or how big it is. By taking the low frequency from one image, and the high frequency from another, you can get some interesting results. Take a look at this image, first sitting near the screen, then step away a couple of meters.

http://cvcl.mit.edu/GroupFaceHybrid.jpg

Re: Fourier Transforms – The Math Trick Behind MP3s, JPEGs, and Homer Simpson’s Face

#20
post #3

Hi Hacker News - I'm the author of the piece, also on twitter @aatishb. Look forward to hearing your thoughts. I encourage you to share your thoughts and insights with other readers by leaving a comment on the post, particularly if you know of other interesting applications about the Fourier transform. Cheers!

OK, since you asked: > The sound wave produced by a piano note is a simple sine wave. No, it's not. A piano note is a complicated stack of overtones (some of which are harmonic and some of which aren't) and transients. If it was just a sine wave, it would sound like a sine wave and not like a piano. This is part of why things like Shazam are so difficult: musical notes aren't just a single frequency in the FFT, they…

> This is actually the exact same number of numbers as in the time-domain series.

In a way, it's twice as many, since they have both real and imaginary components.

Post reply on HN