About this guide

There is an overview of multirate modules here. This guide provides additional details about working with multirate designs in Audio Weaver.

Reasons for making the sampling rate lower

Reasons for making the sampling rate higher

Reasons for making the Block Size larger

Reasons for making the Block Size smaller

Multi-layout and multiple sample rates

The term “layout” is used throughout Audio Weaver documentation to refer to “a group of modules and connections implementing an audio algorithm”. When you load an AWD file, you are loading the layout. When you generate an Audio Weaver Script (AWS) file (Tools->Generate Target Files) for deployment onto your embedded device, a single AWS file is created.

Within the generated AWS file you will find descriptions of the modules and connections. Each distinct section containing modules running at a different block time will generate a “create_layout” command within this script. So, “layout” or “sublayout” is also used to refer to a section within a design which runs at a different clock frequency as the input pin.

For example, the following layout includes 3 separate block times, 1A, 4A, and 8A. These numbers indicate the block time relative to the input pin at the input of the module in question.

The generated AWS file includes 3 corresponding “create_layout” lines, as shown:

See this page for additional details on threading and clock dividers.

Need for integer interpolation and decimation factors

Decimation

Decimation (for reducing the sampling rate) incorporates both lowpass filtering to suppress any content above the target reduced sampling rate’s Nyquist frequency, as well as subsequent downsampling, which operates by dropping existing samples. To reduce the sampling rate by 2, every other sample is dropped. To reduce the sampling rate by 3, 2 out of every 3 samples are dropped. In general, to reduce the sampling rate by M, (M - 1) out of every M samples should be dropped (and should follow the same pattern). Since this approach operates on whole samples (i.e. you can’t drop 1.5 samples), the decimation factor in the module’s Properties has to be an integer.

Modules which use downsampling

Interpolation

Interpolation (for increasing the sampling rate) incorporates both upsampling, which operates by inserting new samples with a value of zero between existing samples, as well as subsequent lowpass filtering to suppress any spectral images which are created. To increase the sampling rate by 2, a new sample of value zero is inserted between every existing sample. To increase the sampling rate by 3, 2 new samples of value zero are inserted between every existing sample. In general, to increase the sampling rate by M, (M - 1) new samples of value zero are inserted between each existing sample. Since this approach operates on whole samples (i.e. you can’t insert 1.5 samples), the interpolation factor in the module’s Properties has to be an integer.

Modules which use upsampling

IIR vs. FIR filters for decimation and interpolation

Considerations:

This article contains additional information on the differences between the two filtering approaches.

Up FIR Down Module

The “Up FIR Down” module is a somewhat more complicated module that lets you specify fractional sample rate conversions if needed, to get around the integer limitations for the decimation or interpolation factors of the modules described immediately above.

Drop the UpFIRDnConvertor into your design and open the inspector. This shows your input settings and the resulting filter parameters and performance.

Set the input and desired output sampling frequencies, the filter type, then click on calculate.

image-20240109-185746.png

The filter parameters L, D, and N will be shown.

image-20240109-185759.png

Choose different filter types to see the effect on the stopband attenuation and filter size.

image-20240109-185821.pngimage-20240109-185854.png

In this example, if we had an input block size of 32, we could not implement a target sample rate of 32000 Hz properly as D needs to be a factor of the input block size.

image-20240109-190000.pngimage-20240109-190014.png

However, with an input block size of 48 bytes, 32000 Hz would be supported as 48 = 16 * 3.

Use the calculated values for L, D, and N to manually set the following Arguments for this Module:

References