# A single time-delay can also be expressed in the frequency-domain.

Another way to state, that a stream of time-domain samples has been given a time-delay, is simply to state that each frequency-coefficient has been given a phase-shift, that depends both on the frequency of the coefficient, and on the intended time-delay.

A concern that some readers might have with this, is the fact that a number of samples need to be stored, in order for a time-delay to be executed in the time-domain. But as soon as differing values for coefficients, for a Fourier Transform, are spaced closer together, indicating in this case a longer time-delay, its computation also requires that a longer interval of samples in the time-domain need to be combined.

Now, if the reader would like to visualize what this would look like, as a homology to a graphical equalizer, then he would need to imagine a graphical equalizer the sliders of which can be made negative – i.e. one that can command, that one frequency come out inverted – so that then, if he was to set his sliders into the accurate shape of a sine-wave that goes both positive and negative in its settings, he should obtain a simple time-delay.

But there is one more reason for which this homology would be flawed. The type of Fourier Transform which is best-suited for this, would be the Discrete Fourier Transform, not one of the Discrete Cosine Transforms. The reason is the fact that the DFT accepts complex numbers as its terms. And so the reader would also have to imagine, that his equalizer not only have sliders that move up and down, but sliders with little wheels on them, from which he can give a phase-shift to one frequency, without changing its amplitude. Obviously graphical equalizers for music are not made that way.

Also, this metaphor would require, that the frequencies of the graphical equalizer be uniformly spaced, at a small interval normally just used at the lower end of the spectrum. Obviously, equalizers made for music tend to space their frequencies further apart, at the high end of the spectrum, quasi-logarithmically.

I suppose that another question to ask would be, whether a Discrete Cosine Transform can still accomplish the same effect – a time-delay. And I believe the answer is Yes. Even though each of its terms is only a real number, because both even-numbered and odd-numbered terms – representing half-cycles per sampling interval – can be given non-trivial values, and the DCT can also introduce unintended phase shifts. It is kind of like the DFT, except that afterward, we will only be looking at the real components of the output stream. But strictly, the DCT should only be applied for processing frequency-response curves, and the DFT is best applied, if an accurate phase-shift is to be inserted explicitly.

Now, this question of whether the application of the DCT and then the IDCT is lossy, can be tested analytically, by first observing that each term only represents a cosine-function, with its maximum at the origin of the sampling interval, but that in the time-domain, we may have started with a sine-wave instead, which had its zero-crossing there.

What will happen is that just as with the DFT, the even-numbered terms correspond to full cycles across the sampling interval, while the odd-numbered ones represent some odd number of half-cycles, which are opposite in sign at the end, to how they were at the beginning of the sampling interval.

For the sake of argument, a series of terms starting at F(0) could be like this:


F(n) = {0, 0, 0, -1, 0, +1, ...}




Hence, with the non-zero components at the odd terms, given that zero itself is an even number. In this case, the non-zero components will cancel out at the beginning as well as at the end of the sampling interval. But the overall effect of this set of terms does not cancel out, near the center of the interval. In fact, we know that these half-waves are only different in frequency, by one full cycle. And so this will evoke a sine-wave, from the Discrete Cosine Transform.

But then, one side-effect of this will also be, that the frequency-resolution at which we can force this behavior, is not half a cycle, but rather at full cycles. And if we needed to force an arbitrary phase-shift at one exact frequency in half-cycles, we would need the DFT.

Dirk

(Edit 02/28/2017 : )

By performing a numerical experiment, I have come to a startling discovery about the DCT:

What I have discovered is, when a cosine-wave does reach the DCT at the specified frequency, it already throws energy to the adjacent coefficients, and those terms are equal to what they would be, in the case of a sine-wave. Thus, the wave will be flanked by coefficients that receive a non-zero term. But in order to tell the IDCT that a sine-wave is being encoded, the (+1) at the main coefficient needs to be replaced with a (-1), not a zero! The (-1) cancels out the cosine-component, leaving only the sine-component.

This is accounted for, by the fact that the DCT adds (1/2) to the input-sample-number, before multiplying it with the other one as the parameter to the trig function, assuring that the output sample (0) corresponds to frequency (0), while the IDCT adds (1/2) to the output-sample-number instead, thus allowing one transform to invert the other. This (1/2) offset, introduces a 45⁰ phase-shift in the case of (1/2) Nyquist Frequency, so that what would line up with even sample-numbers and thus supposedly represent a pure cosine-wave, is in fact a combination of cosine and sine-wave.

Also, there is apparent signal-energy at frequencies in this exercise, that simply stems from the shortness of the pulse of samples, and which can be disregarded otherwise.

But this revelation about how the DCT works, with the (-1) replacing the (+1), and not a (0), has a profound effect on my understanding of sound compression schemes that use the DCT. What this means is that even though the first stage of data-reduction halves the number of coefficients, it can still state their sign ! And that explains a lot to me, which was at first unclear.