Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Two modules are provided to convert between real and complex data

Image RemovedImage Added

RealImagToComplex

Converts two real signals into complex data using one as the real part and the other as the imaginary part

Image RemovedImage Added

ComplexToRealImag

Converts a complex signal into separate real and imaginary components

...

Audio Weaver provides 3 different transform modules for converting between the time and frequency domains.

Image RemovedImage Added

Cfft

Complex FFT. Supports both forward and inverse transforms

Image RemovedImage Added

Fft

 

Forward FFT of real data

Image RemovedImage Added

Ifft

 

Inverse FFT yielding real data

...

Before an FFT is computed the signal is typically windowed to prevent edge effects from influencing the results. There are 3 modules which perform windowing.

Image RemovedImage Added

Window

Simple window

Image RemovedImage Added

WindowOverlap

 

Window with overlapping

Image RemovedImage Added

WindowAlias

 

Windowing followed by time aliasing

...

The WindowAlias module applies a window followed by time aliasing the sequence to a shorter length. This module is used in the analysis back of short-term Fourier transform based filterbanks.

Image RemovedImage Added

OverlapAdd

Reduces block size by overlapping blocks

The OverlapAdd module performs the opposite of the Rebuffer module. The module has a large input block size and a smaller output block size. The module contains an internal buffer equal to the input block size. The module takes the input data, adds it to the internal buffer, and then shifts out one block of output data. The data in the internal buffer is also left shifted and the leading samples are filled with zeros. The OverlapAdd module finds use in fast convolution algorithms.

Image RemovedImage Added

RepWinOverlap

Replicates data, applies a window, and then performs overlap add

The RepWinOverlap module is for advanced users building synthesis filterbanks. The module replicates a signal N times, applies a window, and then performs overlap add.

Image RemovedImage Added

ZeroPad

Adds zeros at the end of a buffer

...

The frequency domain modules have a large number of modules which operate on complex data. The modules here are listed without detailed explanations because the underlying functions are basic and easily understood.

 Image Added

ComplexAngle

Computes atan2 of complex data

 

 

 

 

 Image Added

ComplexConjugate

Conjugates data by negating the imaginary component

 

 

 

 

 

Image Added

ComplexMagnitude

 

 

 

 

 

Image Added
Image Added

ComplexMagSquared 

Image Added

 

 

 

 

Image Added

ComplexModulate

Multiplies by 𝑒𝑗𝜔𝑘 

Image Added

 

 

 

 

ComplexMultiplier

ComplexMultiplier

Complex x Complex, or

Real x Complex

 

 

 

 

 Image Added

ComplexToPolar

Converts to Polar (angle and magnitude)

 

 

 

 

 

Image Added

PolarToComplex

Converts from Polar to Real/Imag

The modules listed above operate on complex data only. A few of the other Audio Weaver modules found outside the Frequency Domain folder are also able to operate on complex data type:

Module

Operation

BlockConcatenate

...

Combines blocks of complex data

...

BlockDelay

Delays by multiples of the block size

...

BlockExtract

Extracts a portion of the complex data

BlockFlip

...

Frequency flips data

Deinterleave

...

Pulls apart multichannel complex signals into individual mono complex signals

Demultiplexor

...

Outputs complex data to one output pin; zeros the rest

Interleave

...

Combines multiple mono complex signals into a single multichannel complex signal

...

Multiplexor

Selects one of N complex signals

...

ShiftSamples

Left or right shifts complex signals

...

Adder

Adds two complex signals

ClipAsym

...

Clips the real and imaginary components

Invert

...

Multiplies by + or -1. Set smoothingTime = 0.

...

Mixer

Mixers together complex signals

...

MixerDense

-Mixers together complex signals

MuteSmoothed

...

Multiplies by +1 or 0. Set smoothingTime = 0.

...

ScaleOffset

Scale both the real and imaginary components and adds an offset

ScalerDB

...

dB gain without smoothing

Scaler

...

Linear gain without smoothing

...

Subtract

Subtracts two complex signals

...

SumDiff

Adds and subtracts complex signals

WhiteNoise

...

Generates uncorrelated noise in both real and imaginary components

ScalerDBControl

...

dB gain with gain value taken from a control pin. Set smoothingTime =

...

ScalerControl

...

Linear gain with the gain value taken from a control pin. Set smoothingTime = 0

...

FilterBank Processing

Introduction

...

The blocks are called “WOLA Analysis” and “WOLA Synthesis”. When dragged out, they will appear as follows in the layout: 

...

The input to the WOLA Analysis bank is real time domain data and the output is complex frequency domain data. Similarly, the input to the WOLA Synthesis bank is complex frequency domain data and the output is real time domain data. When configuring the filterbanks using Module Name and Arguments, the FFT size (K) and the stopband attenuation between subbands is specified. This holds for both the analysis and the synthesis banks. Under module name and arguments, this would show: 

...

The FFT specifies the number of frequency domain “bins” and the input (and output) block size is always ½ of the FFT size. For example, if using a 32 sample block size will only work with an FFT size K = 64. Manually set this on both the analysis and the synthesis filterbanks. This will error out if improperly specified: 

...

The attenuation relates to the separation between outputs of the filterbank, in dB, and will be described in more detail later in the guide. A “safe” value to use is somewhere in the range from 40 to 80 dB. When combining analysis and synthesis filterbanks, ensure that the same value of attenuation is used throughout.

Assuming a block size of 32, set the FFT size K = 64. Making connections between blocks and then showing wire sizes:

...

Note that the output of the filterbank contains 33 complex samples rather than 64. This is because the filterbank modules use real FFTs and as a result discard the redundant conjugate symmetric data. Only K/2+1 bins are kept, which in this case equals 33. The bins have the following properties:

Bin k=0.              Real data.

Bin k=1.              Complex data.

Bin k=2.              Complex data.

Bin k=31.           Complex data

Bin k=32.           Real data

The first and last bins have real data; this is a property of the FFT and results from the fact that the input data is real. Audio Weaver stores the output of the FFT as 33 complex values with the imaginary parts of bins k=0 and k=32 set to zero.

The filterbanks accept any number of channels of input data, but it is not a typical scenario in Audio Weaver[1].The text below the filterbank modules also shows the

Note: Although the analysis and synthesis filterbanks accept any number of channels, most modules in the Frequency Domain folder only operate on mono signals.  It is recommended to design systems with mono frequency domain data for greatest flexibility.

...

The text below the filterbank modules also shows the latency through the filterbanks, in samples. The latency is the combined latency through the analysis and synthesis filterbanks given the current values of K and attenuation. Increasing K or increasing the attenuation increases the latency through the filterbanks. use the displayed latency to time align other signals in the system. For example, to check the reconstruction properties of the filterbanks, compensate using a sample delay module:

The output of the WOLA synthesis bank equals the input of the analysis bank but delayed by 352 samples. In the example above, this latency is compensated with a delay, so the output of the subtract module is essentially zero.

This example shows the meter module with a residual difference at around -80 dB. The filterbanks are not perfect reconstruction but introduce a small amount of aliasing noise. The level of aliasing noise is directly related to the attenuation setting of the filterbanks.

...

This example shows the meter module with a residual difference at around -80 dB. The filterbanks are not perfect reconstruction but introduce a small amount of aliasing noise. The level of aliasing noise is directly related to the attenuation setting of the filterbanks.

The frequency domain outputs of the analysis filterbank represent the outputs of a series of bandpass filters. There are K filters and the spacing between bins is 2π/K radians, or if the sample rate of the system is SR, then the spacing between bins is SR/K Hz. For example, if the sample rate of the system is 48 kHz and K=64, then the spacing between bins is 750 Hz. The first bin (with real data) is centered at 0 Hz. The next bin is centered at 750 Hz, and so on. The last bin (with real data) is centered at 24 kHz.

The filterbanks also contain built in decimation. The outputs of the analysis bank represent the decimated outputs of bandpass filters. The decimation factor equals the block size, that is, K/2. Continuing the example from above, the sample rate of the system is 48 kHz and the block size is 32 samples. Thus, the sample rate of the frequency domain subbands is 1500 Hz. see this by showing the sample rate on the wires. 

Theory

This section describes more of the mathematical theory behind the filterbanks. The design of the filterbanks was based primarily on chapter 7 of the book Multirate Digital Signal Processing by Crochiere and Rabiner. This is an excellent and very readable introduction to the subject of filterbanks. Our description follows the derivation found in this book.A classical filterbank uses a time domain window function followed by an FFT as shown below:

...

The length of the FFT equals the length of the window function. In many cases, the window function is a raised cosine, or Hanning window:

...

The input blocks of the filterbank are overlapped in time. There are many ways to describe the amount of overlapping. The terminology “50% overlap” indicates that from FFT to FFT, K/2 new input samples are made. If there is “75% overlap” then there are K/4 new samples for each FFT computed. In this discussion, the phrase “block size” is used to describe how many new samples arrive each time. This approach is also referred to as a short-term Fourier transform (STFT).

There are two different ways of looking at the output of the STFT analysis bank. On is to segment the input signal into blocks which are windowed and then FFT’ed. The output of the analysis bank thus corresponds to frequency spectra. On the other hand, a careful study of the analysis bank shows that it is in effect implementing a set of parallel bandpass filters as shown below.Figure 5. Analysis filterbank implementation as a parallel set of bandpass filters and decimators.

...

The input signal is filtered and then decimated by the block size M. The filters are all related by the mathematical expression

...

then the frequency response  for K = 32 isFigure 6. Frequency response of a 32-point Hanning window. The graph shows normalized frequencies in the range 0 to 1.0 which corresponds to 0 to  radians/sample.

...

Subsequent bins are spaced by  (or  when viewed as normalized frequencies) and the first 4 bins are shown below:

...

Note

...

: The prototype filter is quite wide in the frequency domain and there is significant overlap between neighboring bins. Not only does bin k overlap with bin k+1, but also with k+2 and k+3. If a decimation factor of 16 is picked, then aliasing will start at normalized frequency of 1/16 as shown below. The prototype filter has only attenuated the signal by 0.5 and severe aliasing will occur.

...

Figure 7. Frequency response of a 32-point Hanning window overlayed with a rectangle indicating where aliasing would occur if the filter output is decimated by a factor of 16.

...

...

If the decimation factor is changed to 8, then aliasing begins at a normalized frequency of 1/8 SR and the filter has attenuated the signal. However, with a decimation factor of 8 the 32 sample Hanning window only advances 8 samples each time and this corresponds to an overlap factor of 75%.Figure 8. This time the rectangle indicates where aliasing occurs for a decimation factor of 4.

...

Is there a way to achieve high decimation while at the same time avoiding aliasing? This brings up the weighted overlap-add filterbank (WOLA). The block based derivation from Crochiere and Rabiner avoids aliasing while supplying high decimation. The analysis filterbank is implemented as shown on the next page.:

...

The main difference is that the prototype filter is N times longer and that after multiplying the input signal, the output is time aliased to the FFT length. Time aliasing is a standard property of the FFT. Suppose an input signal is given: 𝑟[𝑛] of length . Time alias this to a shorter signal  of length

𝑥[𝑛]=𝑝=0𝑁−1𝑟[𝑛+𝑝𝐾]

The FFT 𝑥[𝑘] of 𝑥[𝑛] is related to the FFT R[𝑘] of ??[𝑛] by subsampling

𝑋[𝑘]=R[𝑘N]

That is, 𝑋[𝑘] contains samples of R[𝑘] spaced by N bins.

The advantage of using a longer prototype filter is that it allows us to get better frequency separation between bands. Consider the designs shown below with N=1, N=2, and N=4. The filters get progressively sharper in frequency and for N=4, the passband of the filter falls within the rectangle indicating the aliasing region for a decimation factor of 16. Thus a high decimation factor is achieved while avoiding high amounts of aliasing.

...

Now let’s plot the frequency response of the first 4 filters in the filterbank assuming an FFT size of 32 samples, a window length of 128 samples, and a decimation factor of 16.Figure 9. First 3 subband filters for the WOLA filterbank with K=32, N=4, and a decimation factor of 16.

...

When N is increased to a very high number to achieve a decimation factor of 32, the result is a critically sampled filterbank with no net increase in data. This limit can be approaced, but never achieved in practice. With realizable filters, a filter will always overlap its immediate neighbors. In Audio Weaver, a decimation factor of K/2 is used and the filterbanks are oversampled by a factor of 2. There is a net doubling of the data rate, but this is important because it decouples the subbands and allows them to be modified without introducing further aliasing distortion.

...

As noted above, the filters in the filterbanks are not ideal and introduce some amount of aliasing. The amount of aliasing depends upon the stopband attenuation used in the design of the filters. This section provides details on the amplitude of this aliasing noise. To test this, use the system shown below:

...

Analysis and synthesis filterbanks are placed back-to-back. The input is white noise, the output is subtraction of the inputs while compensating for the delay through the filterbanks. Comparing the energy at the input to the energy of the residual noise provides an indication of the level of the aliasing components. The following table shows the aliasing level and latency as a factor of the stopband attenuation of the prototype low pass filter. In the test, an FFT size of 256 samples was used with a resulting blockSize of 128 samples., an FFT size of 256 samples was used with a resulting blockSize of 128 samples.

Stopband Attenuation (dB)

Measured Aliasing Noise (dB)

Latency (samples)

Latency (blocks)

30

-28

384

3

40

-39

640

5

50

-50

896

7

60

-61

1152

9

70

-61

1152

9

80

-78

1408

11

90

-87

1664

13

Keep in mind that the aliasing components are linearly related to the input signals. That is, reducing the level of the input signal by 20 dB results in the level of the aliasing components dropping by 20 dB. Thus, the aliasing level is more similar to a signal to noise ratio (SNR) rather than total harmonic distortion.

...

Part of the beauty of these filterbanks is that it is possible to manipulate the signals in the subband domain. For example, if scaling the subband signals as shown below, the result will be an equalizer with linearly spaced frequency bins.

...

Another nice property of the WOLA filterbanks is that they have built in smoothing. That is, making an instantaneous gain change to one of the subband signals then the net effect at the output will be smooth. This is because the synthesis bank has built in low pass filters in each subband and these smooth out discontinuities.

The FIR filter example can be taken further. The example above had only a single gain within each subband. What if the goal is to have more frequency resolution? Place FIR filters into each subband. A longer FIR filter would provide more resolution within that particular frequency band. Consider the following example. A filterbank has an FFT size of 64 samples and is operating with a decimation factor of 32. If the input is 48 kHz then each subband has a sample rate of 1.5 kHz. If an FIR filter of length 500 samples is placed in the DC subband (bin k=0), then this yields an effective frequency resolution of 3 Hz within this band. The amount of computation needed to implement this filter is approximately 1500 x 500 = 0.75 MIPs. High resolution is needed in audio applications at low frequencies. For higher frequencies, reduce the lengths of the FIR filters and achieve something close to “log frequency resolution”. By proper design of the subband filters, designing phase response becomes simple.

 

Any of the Frequency Domain modules which operate on complex data operate in the subband domain. Audio Weaver also provides a special set of “Subband Processing” modules that start with the “Sb” prefix. These modules replicate some of the standard time domain modules but the operations occur separately in each subband.

 Image Added

SbAttackRelease

Attack and release envelope follower (real data only)

 

 

 

 

 

Image Added

SbDerivative

Derivative (real data only)

 

 

 

 

 

SbComplexFIR

Complex FIR filter

 

 

 

 

 Image Added

SbComplexFIR

Complex FIR filter

Image Added

SbNLMS

Normalized LMS adaptive filter

 

 

 

 

 Image Added

SbSmooth

Performs smoothing across subbands (real data only)

 

 

 

 

 

Image Added

SbRMS

RMS with settable time constant (real data only)

 

 

 

 

 

Image Added

SbSOF

Second order filter (real data only)

 

 

 

 

 

Image Added

SbSplitter

Subdivides the spectrum into overlapping regions. Similar to a crossover

 

 

 

 

Synthesis Filterbank

The synthesis filterbank takes the subband signals and reconstructs a time domain output. Error! Reference source not found.Remember that the analysis filterbank can be considered to be a parallel set of bandpass filters and decimators. The synthesis filterbank uses a the inverse of this with upsamplers, filters, and adders. The upsamplers take the decimated subband signals and return them to the original sampling rate by inserting M-1 zeros between each sample value. In the frequency domain, upsampling creates copies of the input spectrum at multiples of  and the filters remove the high frequency copies.Figure 10. Synthesis filterbank implementation using upsamplers and bandpass filters.

...

For efficiency, the synthesis filterbank is implemented using an inverse FFT and periodic replication. As in the analysis filterbank, the window function f[n] corresponds to the impulse response of the prototype lowpass filter used in subband k=0.

Figure 11. Synthesis bank implemented using an inverse FFT followed by windowing and overlapping.

...