0

I'm studying how FLAC works, although my question is valid for any lossless codec.

I wonder how may a codec be lossless if the original signal is multiplied by a window which is not rectangular.

I think this operation will modify the stream that we don't want to change.

I know a rectangular window has a terrible spectral response (sinc, with many lobes), but, what's the problem? We don't want to disturb the audio stream, and by multiplying by something different to 1, we will.

Thank you.

greg-449
  • 109,219
  • 232
  • 102
  • 145
baister
  • 283
  • 2
  • 9

1 Answers1

1

A window function can be applied when you want to transform your signal from the time domain to the frequency domain. If you are working with chunks of data then a window can be applied to minimise the effects of spectral leakage.

You can use a (symmetrical) window and apply it to chunks of audio if you also introduce whats known as overlap. Usually 50% overlap is used. This means that the last 50% of your previous chunk is added to the first 50% of your next chunk. This is a lossless operation.

Ronny Andersson
  • 1,558
  • 13
  • 12
  • But why do I have to worry about spectral leakage? In that windowing stage, I only want to cut the stream, don't I? – baister Nov 17 '13 at 12:47
  • The transform between time and frequency (using most likely the Fast Fourier Transform, FFT) assumes that your input signal is periodic. Most signals does not conform to this (being perfectly phase-aligned and periodic) so we "cheat" by applying a window to minimise this effect. – Ronny Andersson Nov 17 '13 at 13:12
  • Thank you. I understood what you say, and for some applications (like analog/digital conversion), I find it completely logical. However, as I studied until now, what we want in the framing stage is cutting the signal to get pseudo-stationary, more editable and predictable streams. I think using rectangular windows would be a much more reasonable option, because we aren't worried about frequency, but the time domain. Where is the mistake in my reflection? Thanks again. – baister Nov 17 '13 at 13:39
  • 1
    There are multiple pages on the net that describes spectral leakage better than I can do here, [for example this blog post](http://www.gaussianwaves.com/2011/01/fft-and-spectral-leakage-2/). If all your processing after you have divided your signal into blocks were performed in the _time domain_ then you only need to keep track of your initial state(s) between different blocks of processing. But because you will perform _frequency domain_ processing on your block you _have_ to worry about frequencies and therefore a window might be preferred. – Ronny Andersson Nov 17 '13 at 15:16
  • Sorry - why would flac rely on a FFT at all? Does it? The audio signal is passed through an ADC (analog-to-digital) to get the PCM representation, all in the time space. FFT would be used in filtering problems, but to my knowledge, not used to encode audio data in the time domain. So no windowing. – Charles Pehlivanian Dec 04 '13 at 13:28