When analyzing data, one can use a variety of transformations on the data to massage it into a form that works better to tease out the information one is interested in. One such example is the application of the Fourier transform, which transforms a data set from the time domain into the frequency domain. Yet what is this frequency domain really? After enticing us to follow the white rabbit down a sudden plummet into the intangible question of what is and what is not, [lcamtuf] shows us around aspects of the frequency domain and kin.
One thing about the (discrete) Fourier transform is that it is excellent at analyzing data that consists out of sinewaves, such as audio signals. Yet when using the Fourier transform for square waves, the resulting output is less than useful, almost as if square waves are not real. Similarly, other transforms exist which work great for square waves, but turn everything else into meaningless harmonics. Starting with the discrete cosine transform (DCT), this gets us into Walsh and Hadamard matrices and the Walsh-Hadamard Transform (WHT), and their usage with transforming data from the time into the frequency domain.
Ultimately it would seem that the frequency domain is as real as it needs to be, albeit that its appearance is wholly dependent on the algorithm used to create it, whether this the DFT, DCT, WHT or something else entirely.
Absolutely not. It is a mapping from the time domain to a Complex space.
Interesting perspective from an organism that usually comes factory equipped with spectrum analyser function, but no real oscilloscope function.
Play the right combination of sound waves and the organism might begin to move around in a similar pattern
Funfact: female crickets are literally hard wired to move towards male mating sounds. There is no free will there, but a direct connection from the “audio analyzer” to the “motor controller”.
(Source: worked adjacent to some biology group that investigated that “behavior” for a while)
Standard cable analysers operated in the frequency domain. Recording return loss for the example. The result remains frequency domain. However operate the same machine to record distance to fault, it still operates in the frequency domain but converts results using reverse Fourier analysis to time domain. Is time domain real?
We don’t even know if reality is real, so it’s probably a moot point :D
You should always remember that power comes from the real part.
The power comes from the Mitochondria.
Reality is by definition real. It’s even the root of the word.
Whoa man, did you, like, come up with that yourself? Far out
When you’re walking along an airport trav-o-lator in a hurry, the frequency domain is the place where you find the exit.
As for square waves not being real, I’m sure there are plenty of oscilloscope-havers ready to pounce on that
Only those that don’t have enough resolution or haven’t zoomed in enough. Square waves aren’t real.
Enhance!
Neither is a flat surface “real”.
They are mathematical models. All models are wrong, but some are useful.
Spherical cow says hi.
Instantaneous change is a physical impossibility. Real square waves are slope and/or bandwidth limited and real measurement equipment is too.
They’re just a bunch of sine waves in disguise, standing on top of each other and wearing a trench coat.
Any oscilloscope-haver who knows what he’s doing will agree that they are not real, only approximations—like the perfect circle.
Sometimes it’s real. Sometimes it’s imaginary. But, generally, it’s complex.
^^^ this line fits any function.
“i” see what you did there.
> Yet when using the Fourier transform for square waves, the resulting output is less than useful, almost as if square waves are not real.
On the contrary, that infinite progression of harmonics is quite informative — it tells you that in any physical process that can’t keep up with infinitely high frequencies (which is all of them), those square waves and their instantaneous transitions can only be idealized approximations. Or in other words, it’s correctly suggesting that square waves aren’t real.
“when using the Fourier transform for square waves, the resulting output is less than useful”
Less than useful? Not in the least. It’s useful if you need to know if you can get that signal through a limited-bandwidth transmission channel. Those OTHER transforms, though, those are pretty much useless. And I still don’t understand how the (missing) sine information gets reconstituted when doing a reverse DCT. Yeah, I sorta get it, that since the original signal was totally real, you should only need the cosines, but I don’t understand where the phase information is encoded.
At least in the use of the DCT for video compression, the phase info is not encoded because it is not needed.
I found the answer here, by the way: https://www.thebroadcastbridge.com/content/entry/18568/transforms-part-6-dct. TLDR: the data set is duplicated and mirrored, resulting in there being two results for each discrete frequency. I haven’t done the math myself, so I still don’t QUITE get it, but at least there are the same number of samples in the transformed data as in the original, so I can hand-wave that at least it COULD be possible to recreate the original data from the DCT. That’s the part that had been bothering me.
The cosine function is an even function, while the sine function is odd.
Due to the mirroring, the input data is a (discrete) even function, and thus it can be represented by a linear combination of only even functions. Hence no sine functions are needed.
Yes, I get that, but I’ve never heard this mirroring mentioned in any other explanation.
I would challenge the author to point to a square wave ever created anywhere. Like, WOW! – from 0 Volts to MAX Volts in 0.0000000000000,,, Attoseconds!
I would like to challenge you to point to a single frequency sine wave created anywhere.
If it starts and stops, then it is no longer a single frequency sine wave.
Your point being?
I think his point is that your hyperbole is silly. Which it is.
Maybe you should have bought a scope with infinite bandwidth? (I don’t have one either)
Well square waves are as real as a dirac delta funtion. Which is not at all in a real physical world. You can try to get near to it ( case of the dirac one might argue mankind has build the largest, most complex and most expensive structures possible, like the LHC) but it can’t be reacched. There is no instant change of anything. Every change need time. You pay dearly to get the slew rate up.
A shadow can move arbitrarily fast, because it’s not a physical object. Therefore you can have an arbitrarily fast transition between shadow and light by waving a shutter in front of a lamp however many light years away.
> A shadow can move arbitrarily fast,
A shadow can move faster than light? Wait….
Uhh … no.
The propagation of the boundary of the shadow, yes. Not the actual speed at which the shadow “reaches” the object it is projected on (i.e. the remaining photons hit it and further photons are blocked).
Easier to explain visually:
https://en.wikipedia.org/wiki/File:Shadow_propagation.gif
yeah, okay – kinda difficult to put into words but I’d say
– it’s not that the shadow is moving faster than light,
– it’s how under very specific conditions (almost theoretical?) “a single shadow” can come into existence in way where the “vanishing light front” on the projection surface moves faster than the speed of light.
“One thing about the (discrete) Fourier transform is that it is excellent at analyzing data that consists out of sinewaves, such as audio signals. Yet when using the Fourier transform for square waves, the resulting output is less than useful,”
I feel a bit out of competence when it comes to signal processing but I think you should be more specific, because now it looks like audio signals can’t be square. There is and audio signal called square wave – it is available in almost every synth based on subtractive synthesis (both analog and digital). Of course that square wave is not “really” square since at the moment there is no known method to produce “truly square” signal except using “infinite energy” – all we get is “close enough for this application”. Depending on method, oscillators will produce only band limited square wave at best – look up for oscilloscope view on some synths like Minimoog or Virus and you will see clear difference but for the application it is close enough. Digital synths also produce some “random noise” on the beginning which is nothing but band limited start of the signal (to avoid “popping” every time you play a note). Maybe that is why it seem “almost as if square waves are not real” – they are not possible to be produced.
Of course they know that, but they’re playing dumb to get you reading and commenting here.
No, it’s imaginary
I have a question about FFT, since i’m currently trying to compare some tape players performances by digitizing the same music track from them using Audacity, and then use the “Plot spectrum” tool. But there’s a “size” parameter that gives me some trouble.
The documentation says “In Spectrum, a larger size gives more accurate frequency resolution (narrow bands), but averages the result over a longer period of time (because more samples are needed for the calculation)”.
And i indeed can see that increasing the size gives me finer details in frequency, so seems to be better. But at the same time, i can see that more details/bands implies lower dB level for each individual band. So when looking at the overall graph from the same file, choosing a low 128 size parameter produces a graph with near linear decreasing from -6dB for 350Hz to -42dB for 16kHz. But if i choose the highest 65536 size, the graph starts at -65db for 1Hz, has a peak level of only -18dB (so very much lower that -6dB max in previous one) for 50Hz, 350 Hz is now only -30dB (instead of -6), and is at about -70dB for 15kHz.
So all in all, the range between 350Hz and 16kHz goes from -6 to -42dB with the lowest size, but only from -30 to -70dB with the highest size. So the overall graph seems to plot much lower levels with increasing size parameter.
In a way i can understand that larger slots of frequencies will measure and average the sum of them. But at the same time, since music is not made of high level carriers, a finer slot will have a lower contribution in the overall spectrum.
But this difference of about 25dB in levels is also confusing for me, since the same file could look quite good to quite terrible, depending on the parameter. So i don’t know which size would gives me a better and the most true representation of my players performances.
I hope that my explanations are clear enough, and that someone smarter that me would be able to give me some advice about how to use this parameter the best way possible.
I’m not qualified enough to answer the entirety of your question, but I’ll drop my 0.03
Theoretically, FFT is performed on infinite (or time-periodic) signals.
What you see on the frequency plot, like the one in the article header or in Audacity, is actually Short-Time FFT, as the input signal is split into “short time” fragments and FFT is peformed over each one separately. A window function is also involved to reshape some artifacts resulting from chopping the signal, and for the purposes of FFT we pretend that this windowed signal is periodic.
The “size” that you can adjust is the duration of this “short time”.
With shorter blocks, you get enhanced time resolution, that is, the frequency bands will represent an average over a shorter period.
With longer blocks, you get more frequency bands, this is a property of FFT, the output’s size is the same as the input.
But you can have both. You can get “smoother-looking” frequency plots for a short window if you upsample the signal before processing. Note that this doesn’t add any meaningful detail mathematically.
“i’m currently trying to compare some tape players performances”
Just like Andrzej “I’m not qualified enough to answer the entirety of your question, but I’ll drop my 0.03”.
You need to define what is performance for you and what are it’s properties. Only then you should define a proper method to measure them. You will probably need different settings for different properties. Without that it is really difficult to answer a question even for a qualified person.
As you decrease the width of the frequency bins, less energy falls into them. So you get a lower dB measurement. (dBm, dBuv etc to be pedantic).
You also have to be careful if looking at noise (tape hiss etc) because the same effect will happen there.
But, when you increase the width of the frequency bin, more background noise than signal starts to fall into them, so your peak levels will appear to drop. The wider the bandwidth you’re covering with your frequency bin, the less it matters that you have energy in some narrow sliver of frequencies within it.
In other words, put water in a tall glass and the surface rises high – pour the same water into a pan and the surface drops low.
“Buser (1987) or Zwicker showed that for sound intensities between 40 and 70 dB, the smallest variation of pitch that a healthy ear can detect relative to a reference frequency is 0.0035. This relative threshold is true for frequencies between 200 and 5000Hz. At more extreme frequencies, pitch sensitivity is greatly decreased.
Using the relative threshold, it is easy to determine the smallest pitch variation that the human ear can perceive by multiplying it by the reference frequency. For example, at 1000 Hz, the smallest variation is 0.0035 x 1000 = 3.5 Hz. At 5000 Hz, it is 0.0035 x 500 = 17.5 Hz.”
In other words, if you want the results to be relevant to hearing music, you’d pick a bin width somewhere around 3-5 Hz range.
Thanks guys for your replies.
“You need to define what is performance for you and what are it’s properties. Only then you should define a proper method to measure them. You will probably need different settings for different properties.”
Oops! At the moment i am focusing of playback bandwidth, in order to find which players could read already recorded tapes the better, in order to digitize them. But other characteristics could be interesting, if you have practical settings and tests methods to explain.
“You can get “smoother-looking” frequency plots for a short window if you upsample the signal before processing.”
Interesting! Will have a try…
“As you decrease the width of the frequency bins, less energy falls into them. So you get a lower dB measurement. (dBm, dBuv etc to be pedantic).
You also have to be careful if looking at noise (tape hiss etc) because the same effect will happen there.”
That’s exactly what i found troublesome: how to balance width of bins –> average energy in them –> lower dB measurements to have meaningful results, and how to correctly interpret them.
“In other words, if you want the results to be relevant to hearing music, you’d pick a bin width somewhere around 3-5 Hz range.”
That’s an interesting and concrete proposal. Will try that, thanks!
Bertrand Russell said, “mathematics is that branch of science where we do not understand the things we talk about, and do not care if the things we say about them are true.”
Negative numbers only came into use in the 1600s, and mathematicians were arguing about whether they were ‘real’ until the 1800s.
The whole notion of mathemetical systems being ‘real’ is frivolous. The important question mathematically is whether they’re interesting. The important question scientifically is whether they’re useful.
The frequency domain turns out to be both.
… and the philosophical question is, why can we use either pure math and logic or pure physics and measurements, and get the same numbers from both? (Or, in other words, why can we use math to describe physics?)
How Imaginary Numbers Were Invented
https://www.youtube.com/watch?v=cUzklzVXJwo
Or “Imaginary numbers are real” by Welch Labs also on youtube (sorry for no link).
https://www.youtube.com/watch?v=T647CGsuOVU
(Just to lure more suckers into the quicksand)
Oh, I wish you had not posted that link. Now I have to watch all of the great videos on that channel. Thanks!!!!
The relationship between accuracy in time and accuracy in frequency is an interesting topic, and a godawful can of worms if you actually have to deal with it
If you think about it, you’ll realize that the time domain view (oscilloscope) doesn’t exist, either. An oscilloscope presents a view of the signals that is useful though it in no way really looks like what an electrical signal really is.
Both the time domain and the frequency domain are abtractions of reality – they present a view of reality without themselves actually being reality or even looking much like reality.
Both abstractions are useful, though, in different circumstances.
hmm… I’d say the time domain is real in the sense how sound propagate through air.
I mean the pressure variations with slow/large low frequency sounds summed together with the high frequency stuff are real, aren’t they? (srsly, I’m not even sure my understanding of sound is “correct” enough).
But what our brain hears is the same but in the frequency domain isn’t it? Real time organic FFT?
What about Haar wavelets? That would get both square and mostly other waves as well.