# From time domain to frequency domain

How is it possible to go from time domain amplitude values in floating point to frequencies?

I know the DFT is used, but what exactly is happening for it to be able to extract frequencies from amplitude values?

Is amplitude between -1 and 1 mapped from pressure levels? How are different frequencies detected in a block of amplitude values? What if two files have the exact same amplitude values but completely different frequencies?

The time domain signal is just samples of some data (for instance, air pressure, or microphone diaphragm displacement,etc.) taken at different points in time. If the audio signal is created by something vibrating at some frequency, that will effect how the sampled data changes between each sample. So normally, one has to look at a whole bunch of samples (enough to plot a waveform) to determine if there is something vibrating and at what frequency. A single time domain sample can tell you nothing about how the waveform is changing, thus nothing about the frequency. You need enough samples to plot some points on a graph. A DFT is a good way to count (correlate) how many well rounded periodic "wiggles" per length of that graph, and their shape if not sinusoidal. A different number or shape of wiggles corresponds to a different main frequency, usually mixed with a bunch of overtone or harmonic frequencies. But since small variations in air pressure are very close to linear (additive), multiple frequency sources just sum (like adding two waveforms, sample by sample, in time). A DFT can also be good at unmixing this kind of stuff.

Note that since frequency (other than 0Hz) indicates change, a single sample for a single frequency can have almost any value, depending on when you start taking samples.

The Mathematical structure of all Transforms can be understood by simply first seeing what a Fourier Series Representation is. In Continuous Time Domain, Fourier established that all periodic waveforms can be expressed as sum of Complex exponentials of some magnitude(which are the coefficients in a Fourier Series). The same can actually be applied for an aperiodic waveform assuming a periodic extension of it. So what the underlying Transform Relationships give us are nothing but the Analysis and Synthesis equations for what frequencies are present in a signal and what are their magnitudes. Rather, you can view these magnitudes as the Projections of the signal on the complex exponentials as to trying to figure out how much of a particular frequency is present in a signal. (You might want to remember the Analysis and Synthesis equations to see what I've said here).

Now for a certain set of functions(L2 functions or rather Limited Energy functions $\int_{-\infty}^{\infty}|x^{2}(t)|dt$ being finite and a set of conditions called Dirchlet's conditions being satisfied) have a special and easily identifiable Analysis equation called the Fourier Transform which comes straight from Fourier Representation of Series coefficients. Now in real world, we rarely encounter functions that violate these properties. If a function were to blow up to infinity in Energy we can never use it anyway.

Caution must be exercised because the Fourier representations involve a lot of intricacies which are rather ignored in daily life problem solving. One might learn a lot by looking at Existence, Measurability, Riemann Integrability etc. of functions and their energies.

Once you've tackled the problem of continuous time(both in terms of Series and Transforms) Discrete is just extrapolations right from Nyquist Shannon's sampling theorem. Now what exactly is a digital signal? It is just the sampled version of it. How quickly sampled is what determines the frequency content that you get in the Sampled version. If you look at the formula of a DFT it is nothing but the Analysis equation of Fourier Series represented in $0,1...N-1$ points which are called "Bins". It is nothing but the Discrete version of the Fourier Series(think of Integral in the Analysis equation being replaced by Summation and the $\exp(-j\omega t)$ term in the transform being written as $exp(-2*pi*j*k/N)$ where k represents the number of points that you have from the sampled signal and $2*pi/N$ is nothing but the analogous term in the series which is the Fundamental Angular Frequency. I hope this explains much about how exactly DFT is able to get the Frequencies from a Time domain wave.

And for the last part, for 2 files to have exactly the same amplitude values at exactly the same points of time, it is impossible for them to differ in their frequency content because the Math behind it sees just the values. Maybe I'm misinterpreting your question or your phrasing is not proper.

• Thank you. It sort of explained it. I still dont get how amplitudes can relate to frequencies, especially if they are mixed together in a signal. Or is the math reversed and the audio data is written into the file by converting frequencies into amplitudes? Lets say there is a buffer of 2048 samples, representing a certain amount of time based on the sample rate, how can a single amplitude value represent a frequency, if there might be a mixture of frequencies in the signal at the point which the amplitude represents? – jarryd Aug 4 '13 at 8:36
• No single amplitude represents a frequency. You see a frequency only if there is a variation in amplitudes of a signal. Lets say we have 10 samples. If the amplitudes jump around randomly for every sample, it means that there are "frequencies" composed in those 10 samples. We don't know exactly about their magnitudes unless we perform the transformation. On the other hand if the 10 samples had the same value, it is simple enough that there is no variation of the signal with respect to time and hence there are no harmonics. Frequency, by definition, is just how quickly a time series changes. – Sudarsan Aug 4 '13 at 9:11
• In other words, if there are 2048 samples, depending upon the sample rate you'll have captured different information about different frequencies of the original analog wave. And to see how well you've captured is what the DFT will tell you. To plainly state, the amplitudes of a time domain signal can never tell anything about frequencies(unless you know when you see a signal, which comes to you when you do transformations more and more and guessing how a signal might look in the frequency domain). – Sudarsan Aug 4 '13 at 9:13
• So a single frequency in a signal will always have the same amplitude value whenever it occurs? Is the 0 - 1.0 mapping then representing increasing frequencies up to 1.0 (being the cutoff based on the sample rate), with the 0 to -1.o being the inverse of the signal (duplicate data if it is a real signal) ? – jarryd Aug 4 '13 at 9:16