Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Do digital compression create aliasing ? (Read 6422 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Do digital compression create aliasing ?

EDIT : Thread split from there : http://www.hydrogenaudio.org/forums/index....9468#entry94739

Quote
David, how can dynamics compression produce aliases ? It certainly produce unwanted harmonics because of clipping, but why is there aliasing ?

I think it's because you're amplitude modulating the original, and any amplitude modulation creates sidebands.

You can tune the compressor to limit the effective modulation rate, and you can oversample to ensure that what's left doesn't alias. As we know, all real-world digital processors are carefully designed like this to ensure that theoretically perfect quality is acheived regardless of price or speed. Errr

Cheers,
David.

Do digital compression create aliasing ?

Reply #1
Quote
I think it's because you're amplitude modulating the original, and any amplitude modulation creates sidebands.

Let's take an example and apply a sine amplitude modulation of 1000 Hz to a 22000 Hz sine sampled at 44100 Hz. We then create a 21 and a 23 kHz sidebands, but the oversampler will assume that the original was a small 21 kHz sine, plus a big 22 kHz one, and will discard the 23 kHz possibility as an alias of the 21 kHz.

Therefore we have the same result as with an analog compressor, but lowpassed at 22.05 kHz. There should be no alias at all, unless you call "aliasing" the mere fact of compressing and creating sidebands.

Do digital compression create aliasing ?

Reply #2
Quote
Quote
I think it's because you're amplitude modulating the original, and any amplitude modulation creates sidebands.

Let's take an example and apply a sine amplitude modulation of 1000 Hz to a 22000 Hz sine sampled at 44100 Hz. We then create a 21 and a 23 kHz sidebands, but the oversampler will assume that the original was a small 21 kHz sine, plus a big 22 kHz one, and will discard the 23 kHz possibility as an alias of the 21 kHz.

I'm not sure how oversampling and audio equipment works (it seems all I know about is the storage medium), but would the left over 21KHz frequency be desired, or a non-desired artificially-introduced sound?

Do all dynamics compressors introduce such sidebands?  Or mayhaps they're usually unnoticable?

Do digital compression create aliasing ?

Reply #3
In this example, compressing the dynamics is adding sidebands, no more no less. Conversely, adding sidebands is performing a dynamics compression. From this point of view, the leftover 23 kHz is needed, otherwise, it's not compressed properly. However, since it's above the audible threshold, the loss is inaudible.

Do digital compression create aliasing ?

Reply #4
Hrm...
...I always thought that dynamic compression simply brought all of the frequencies in an audio file to closer amplitude levels, not that additional frequencies were created.

Not to mention, I don't understand how creating sidebands would make dynamic compression work...

Is there some explanation of digital dynamics compression you can link me to?

Do digital compression create aliasing ?

Reply #5
It's a trap in which I falled too. Clipping a sine ("hard limiting" it) turns it into a square, thus it adds odd harmonics. Performing a sine amplitude modulation adds sidebands.
I don't know what attack/delay times are usually set for compression, but they will modulate the amplitude.

Seen the other way, adding very close sidebands will create a slow beat effect, thus change the volume at given times.


Do digital compression create aliasing ?

Reply #7
I have been thinking about the creation of overtones when performing dynamic compression.

You need to know a little about Fourier Transforms and complex numbers to follow this:

Would it be possible to eliminate overtone creation by performing dynamic compression in the frequency domain?

For example:

• Perform a full Discrete Fourier Transform (DFT, probably using a lapping window function to divide the audio signal into chunks and reconstruct it afterwards)

• Preserve the complex part of the spectrum, which contains phase information.

• Map the value of each spectral bin (frequency bin) to a new value based on a compression curve (e.g. y = x ^ n) where y and x are normalised amplitudes and n is a power (n=1 is normal audio, n=1.1 would be mild expansion, n = 0.9 would be mild compression etc). I'm not sure if you'd process the Real and Imaginary parts separately or combined, mapping the magnitude in polar (Argand) representation to a new value.

• Perform the inverse DFT and reconstruct the waveform.

Now, you'd get no frequency overtones created because you simply modified the amplitude of each sinusoidal component in the frequency domain - you didn't create any new ones.

However, you don't often get something for nothing in this world!

One thing I can see happening is that the amplitude change wouldn't be consistent in the overlapping portions of the lapping transform window (e.g. you take 1/3 of the amplitude of sample into frame 1, and 2/3 into frame 2). If the frequency's amplitude is 0.6, that's 0.2 in frame 1 and 0.4 in frame 2, assuming the burst of frequency is localised in time to that portion of the window. With n = 0.5, the 0.2 maps to 0.447 (compressed), the 0.4 maps to 0.632. The total comes to 1.080 when the two windows are overlapped again.

If the frequency component were localised in the centre of frame 1, it would come out as 0.6 in the DFT and would be mapped to 0.775. For this case, with n=0.5, the one in the lapping region is 1.39x larger (2.9 dB louder). So we might actually get temporal ripple instead of frequency harmonics.

We might overcome this by taking a proper, unwindowed DFT, but that's huge and impractical.

I guess for multiband compression, where you first divide the spectrum into bands, it may be possible to apply the compression in each band then post-filter to remove frequencies that don't belong in that band and could be generated harmonics, thereby reducing their amplitude. This probably has potential downsides of its own. I guess I'd need to play around with MATLAB or something to try these things out.

I don't think I've talked myself out of it completely, and moderate dynamic compression might sound reasonably good when done like this, and OK for playing in loud environments.

Do digital compression create aliasing ?

Reply #8
Using a proper DFT of the whole file would lead to equalize it, no more no less. Actually, there is no time information in a total DFT.

I don't see the point in trying to "remove" the sidebands. The sidebands I'm talking about are not an artifact, they are the spectral expression of a given set of parameters for compression.

Saying
1 - "I'm compressing this file this way, and we can see that it will modulate it's amplitude"
and
2 - "I'm adding this, this, and this sidebands to that, that, and that frequency"
means exactly the same thing. The second sentence is the "Fourier Transform" of the first.

It's like saying
1-I'm adding 5 to this number
and
2-I'm adding 2, then 3 to this number

It's the same thing.
Thus "compressing dynamics without adding sidebands" has no meaning. It's like saying "turning left without changing direction".

Do digital compression create aliasing ?

Reply #9
Well, if compression is by definition the creation of sidebands...

Is there any method (NOT dynamics compression) that merely brings the amplitudes of all present frequencies towards a "center" value?  (Or have an input dB->output dB graph like in compression, but these values consider only individual frequencies.)  Maybe doing FTs, and adjusting each frequency's amplitude as nessesary? 

Or would something like be impossible, or take too much computer power, or create too much distortion?

Do digital compression create aliasing ?

Reply #10
Quote
Using a proper DFT of the whole file would lead to equalize it, no more no less.

Yes, I think it would be like a sort of dynamic equalization, that would sound strange.

Do digital compression create aliasing ?

Reply #11
Quote
Well, if compression is by definition the creation of sidebands...

Well, more than simple sidebands, dynamic compression creates nonlinear distortion, and thus harmonic and intermodulation distortion products.  The typical sidebands that amplitude modulation produces, happen when there is a signal modulating in amplitude another signal, but I don't think this is what really happens in case of dynamic compression.

Quote
Is there any method (NOT dynamics compression) that merely brings the amplitudes of all present frequencies towards a "center" value?


I think that's what multiband compression does.

Do digital compression create aliasing ?

Reply #12
Removing all detectable sidebands ? Usually, a DFT contains all frequencies, at different levels. If we would only keep sharp spikes in a spectrum, it would wipe out all percussive sounds and all rhythm, that have by definition a wide continuous spectrum. All that would remain would be pure tones slowly fading in and out.
I imagine something like this : AAaaawwwoouiiiwuwiiiiiwiwwwuuuuweeeew

Do digital compression create aliasing ?

Reply #13
Oh man, I've got no idea what's goin' on...

Wanna buy a monkey?

Do digital compression create aliasing ?

Reply #14
Quote
Removing all detectable sidebands ? Usually, a DFT contains all frequencies, at different levels. If we would only keep sharp spikes in a spectrum, it would wipe out all percussive sounds and all rhythm, that have by definition a wide continuous spectrum. All that would remain would be pure tones slowly fading in and out.
I imagine something like this : AAaaawwwoouiiiwuwiiiiiwiwwwuuuuweeeew

Does a FT detect more frequencies than are actually present in a given digital signal?  By definition, it *shouldn't*, but then again we are dealing with finite, discrete values of the digital world, instead of theoretical continouous data.

Ignore dynamics compression discussion for a moment. 
I'm just saying I'd want all the individual frequencies in a given file to be adjusted seperately by a "input amplitude" vs "output amplitude" graph (where "input amplitude" is the FT-found amplitude of any frequency in the audio, and "output amplitude" is simply the new amplitude for that frequency).  Is that possible?

Is that multiband compression, as KikeG stated?

Do digital compression create aliasing ?

Reply #15
In this article from Dolby Systems you can find some discussion about the "modulation" effects of dynamic compression, in the context of noise reduction systems

I think the article (and the series it belongs to) is clear and could help those (like me) with a lower technical level. I hope it is also right 

Here you have a quote from it.

Quote
This is the principle of AM (amplitude modulation) radio, and it also applies to a compressor. The compressor subjects the audio input signal, which is equivalent to an AM radio carrier, to a changing gain. Because the amplitude of each component frequency of the input signal is changed, sidebands are added to each frequency. 



In Figure 2, I have arbitrarily chosen a moment when a gain change results from a compressor’s control voltage with the spectrum shown in the bottom left-hand corner. If the input signal contains 10 kHz, the output will contain that 10 kHz plus sidebands having the same shape as the spectrum of the control voltage. Every other input component will have sidebands added in the same way. Specifically, if a gain reduction of 6 dB is called for, the sum of the upper-frequency sidebands will be roughly 25% of the audio output level, and so will the sum of the lower ones. Thus we could say crudely that during the gain change, the compressor gives 50% modulation distortion!


Carlos G.

Do digital compression create aliasing ?

Reply #16
Quote
I'm just saying I'd want all the individual frequencies in a given file to be adjusted seperately by a "input amplitude" vs "output amplitude" graph (where "input amplitude" is the FT-found amplitude of any frequency in the audio, and "output amplitude" is simply the new amplitude for that frequency).  Is that possible?

Is that multiband compression, as KikeG stated?

If you give, for each frequency, the output vs input gain, it's graphic equalisation. If, for each of them, you give the mapping function that, for each input level, returns a defined output level, it's multiband compression.

Do digital compression create aliasing ?

Reply #17
Quote
Using a proper DFT of the whole file would lead to equalize it, no more no less. Actually, there is no time information in a total DFT.


In theory, the full discrete Fourier Transform of an entire waveform including the Imaginary components of each frequency and both positive and negative frequencies, can be passed through the inverse Fourier Transform to identically reconstruct the wave. It's a lossless transformation. In that sense it does contain timing information and all the information of the whole waveform.

(Imaginary numbers and Real numbers can be added to make a Complex number. Imaginary numbers are a multiple of 'i', where i is the square root of -1.)

However, in audio, we never/hardly ever do this in practice because we're dealing with millions of sample values in our waveform, and Fourier Transforms that big take forever to calculate.

We tend to break down some of these rules of exact reconstruction by chopping our signal into chunks (e.g. frames) and treating each frame separately to speed things up. Sometimes we're only interested in the power spectrum for some analysis (like calculating masking thresholds), so we lose the Imaginary part of the data (and we can do a cosine transform, which ignores the Imaginary number components).

Just chopping into chunks creates problems at the boundaries between chunks (discontinuities) which can cause regular pulses at the boundaries if you modify any of the coefficients before reconstructing. Also, the shorter the chunks are in time, the broader each peak gets in frequency (including ripple). Windowing functions (Hanning, Hamming, Blackman etc) are a trade-off between time and frequency resolution and ripple. To reconstruct a wave from numerous chunks, you need to overlap these windows, and lapping window functions, when overlapped 50% with each other, add up to 1.0 at each point, eliminating amplitude ripple in the reconstructed wave.

This is quite a technical subject, and in audio manipulation, we need to find an acceptable compromise among speed, frequency resolution, time resolution, ripple and so on.

Anyhow, although compression in the simplest form is indeed the same as adding harmonics (overtones) to the frequency spectrum, this might not be desirable coloration of the sound. It changes the timbre of each instrument to some extent.

I don't know how multiband compression is actually implemented in most studio systems.

Assuming you divide the signal into sub-bands, then apply standard compression to each sub-band, you still create overtones. It's just that you can choose to have different amounts of compression in each sub-band (like a EQ can adjust the volume of each sub-band). If you then simply sum signals from each sub-band channel, you'll retain the overtones created. This colouration may well sound pleasant and musical do it may be desirable. (You will also create sum and difference frequencies if you have more than one tone present in the band)

If you set each band to the same compression setting and amplitude, this would sound just like a simple broadband compressor that remaps the instantaneous amplitude of the signal, with just the same overtones that will create.

However, if, just before recombining the sub-bands, you band-pass filter each sub-band's signal to cut out frequencies well beyond its band (i.e. frequencies which must have resulted from the compression and sum-difference effects and couldn't have been in the input signal), you can strip out most of the overtones. I'll call this "band-pass multiband compression"

Many dynamic compressors for radio actually work more like an automatic gain control (AGC) servo loop in that they measure the power of the signal over a certain time constant and adjust the gain of the microphone or music accordingly. This is different again and has side effects like music fading in and out if the presenter pauses for breath for longer than the time constant. Similarly, some studio bus compressors will allow the bass drum rhythm to cause pumping in the volume of the other instruments, which sounds bad.

What I'm talking about (and Moguta is too) is a constant relationship of input versus output based on each frequency component of the FFT in isolation. You could indeed call this "band-pass multiband compresion" but it's taken to the extreme, where, say, for each 1024 samples of your music you have 512 linearly-spaced frequency bands in your multiband compressor! (1024 if you count negative frequencies as separate). This is a different thing to normal compression.

This would not create sidebands in the first place, so you don't have to go trying to remove them afterwards, so there's no problem with transients disappearing and you wouldn't create the "AAaaawwwoouiiiwuwiiiiiwiwwwuuuuweeeew" sound.

Sure, if one instrument plays a concert A (440 Hz) and another joins in equally loudly on the same note 440 Hz, then the resulting output won't be twice as much power once the compressor has reduced it, but in all other cases, the effect of what's happening in one instrument won't affect the loudness of another (so no sum and difference frequencies from the 'mixer' effect of the non-linearity).

Now, the natural quieter overtones of each instrument would be boosted (each in isolation), so the timbre would change, but a pure sinewave (a flute comes close, for example, apart from the initial breathy transient) will not be imbued with new overtones. If used too heavily (big compression), instruments with a moderate total loudness (power) spread over a broad range of frequency bins at low spectral density (low power per bin) such as noiselike sounds, like percussion and vocal sibilants, could have their total power and loudness boosted quite heavily, and more heavily than a very tonal instrument where all the power in concentrated in the fundamental frequency and a few overtone frequencies.

So in fact, compression in this form would tend to boost, not suppress, the transient sounds because you'd be boosting the least peaky frequency components the most. You could also try to cut out the very quietest components as a form of hiss reduction, and if that were done too heavily then you'd start to lose some of the more subtle transient sounds. My thread on testing of Noise Reduction routines showed this effect.

You can get a picture for the relative concentration in frequency of noise versus tonal signals from the frequency analysis graphs in a recent post I made. The last Frequency Anaylsis plot (before the spectrogram) is pink noise at 91 dB perceived loudness (about -35 dB per bin at around 1760 Hz frequencies, typically, with energy spread over a wider band). The second frequency plot was a 1760 Hz tonal signal at 104 dB perceived loudness (0dB per bin at 1760 Hz), and it would be -13 dB per bin at 1760 Hz for the same perceived loudness as the pink noise signal.

I guess it's the difference in treatment of tonal versus noise-like signals that might be the big downside of this approach, and that it might only allow pretty mild compression before it sounds overwhelming. Probably the only way to find out is to try it (which would take some time and effort, and probably a knowledge of something like MATLAB to make it relatively easy to program and try out).

I'm interested in trying it out to see what happens, but I won't be getting round to it anytime in the foreseeable future.

Do digital compression create aliasing ?

Reply #18
Quote
What I'm talking about (and Moguta is too) is a constant relationship of input versus output based on each frequency component of the FFT in isolation. You could indeed call this "band-pass multiband compresion" but it's taken to the extreme, where, say, for each 1024 samples of your music you have 512 linearly-spaced frequency bands in your multiband compressor! (1024 if you count negative frequencies as separate). This is a different thing to normal compression.

This would not create sidebands in the first place, so you don't have to go trying to remove them afterwards, so there's no problem with transients disappearing and you wouldn't create the "AAaaawwwoouiiiwuwiiiiiwiwwwuuuuweeeew" sound.

This would lead to a "compression" (rather a "soft clipping", since it is applied to all the 1024 set of samples without attack nor decay) reset every 1024 samples.
If the overlap is 50 %, the parameters are reset every 512 samples. That is the same as a 512 bands multiband compressor with the attack and release settings set to 512/44100*1000=11 ms.
The fastest sine amplitude modulation is given by the Nyquist relation : it's has a period of 22 ms (1024 samples).
Thus sidebands will never go farther than 1/0.022=45 Hz from the original tone from which they are created, that is the maximum resolution of the 1024 samples FFT itself.

Sidebands (overtones ?) are caused by the gain changing over time. Working in the frequency domain, you always apply a gain to all the lenght of your data chunk, therefore you can't create overtones. But the gain will vary from a 1024 chunk to the following, creating overtones that can't be seen in the DFT performed, since their difference with the original frequency will always be, by definition, beyond the resolution of the DFT chosen.

The advantage of this method is getting a lot of frequency bands, but the drawback is that you can't set the attack and decay faster than your DFT window.

The "owowwow" sound is another thing. I think that Moguta wanted to eliminate all "noise" (including "unwanted" sidebands) around the pure frequencies supposedly found in the DFT.

Do digital compression create aliasing ?

Reply #19
Good explanation of the equivalent multiband compressor and it's attack/decay times, Pio.

You seem to know a fair amount about multiband compressors, so can you tell me whether or not each band is refiltered before the bands are recombined on a normal multiband compressor?

Thanks,

DickDarlington

Do digital compression create aliasing ?

Reply #20
Sorry, I've never used a multiband compressor in my life. I just assumed it was the same as Samplitude's dynamics compressor, but multiband.

Do digital compression create aliasing ?

Reply #21
Thanks for your comments anyway, Pio.

Does anyone else know if each band is filtered before recombination?