Versions Compared

Key

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

...

The example library is found in the 📁 <AWE>\AWEModules\Source\Examples directory.  Run the main script make_examples.m to generate code for the entire library.

Scaler Module
Anchor
ScalerModule
ScalerModule

This example is contained in the file scaler_example_module.m.  It is equivalent to scaler_module.m provided in the Deprecated module library. This module implements a straightforward linear scaler without any smoothing.  The module scaler_smoothed_example_module.m implements linear scaler with smoothing. The module has single input pin and single output pin with arbitrary number of channels. This module illustrate the basic components of Audio Weaver module.

...

and the output data is placed into

pWires[1]->buffer

Peak Hold Module
Anchor
PeakHoldModule
PeakHoldModule

The peak hold module demonstrates the use of variable size arrays and shows how the constructor function can be specified completely in MATLAB code.  The peak hold module has a single multichannel input pin.  The module computes the maximum absolute value for each channel on a block-by-block basis.  The module records the peak absolute value seen since the module started running and also computes a peak detector with settable attack and decay rates.  In many ways, the peak hold module is similar to a meter module working in block-by-block mode.  This module is contained within the file peak_hold_example_module.m.  A related fixed-point version is found in peak_hold_example_fract32_module.m

...

The C processing function is straightforward and is not shown here.  Refer to the file InnerPeakHoldExample_Process.c.

Fader module
Anchor
FaderModule
FaderModule

This example teaches how to create a new module class out of a subsystem and shows how to implement a custom bypass function.  The fader module has a single mono input pin, a stereo output pin, and 3 internal modules:

...

There is also a fract32 version of this module called fader_example_fract32_module.m See this module for examples of fixed-point processing.

Downsampler Module
Anchor
DownsamplerModule
DownsamplerModule

This module downsamples a signal by keeping only one out of every D input samples.  This example demonstrates two further techniques used when creating audio modules.  First, the module essentially copies 32-bit samples from input to output and doesn't care if the data type is float, fract32, or int.  All of these types will work with the same processing function.  This is obvious in C but this flexibility must be encoded into the MATLAB scripts.  The second technique shown is how to change the block size and sample rate as part of the prebuild function.

...

Note: The shape information is provided as custom svg image. The default shape of the module is rectangle and it can be overwrite with svgImage tag.

Look Ahead Limiter Module
Anchor
LookAheadLimiterModule
LookAheadLimiterModule

This example demonstrates some advanced code generation techniques.  The look ahead limiter is a dynamics processor which applies a time-varying gain to a signal.  The module m-file takes two arguments.

...

The compiled subsystem contains 4 internal modules:

...

Specifying Internal Module Constructor Arguments

If we follow the normal code generation procedure, then the constructor function for the internal delaymsec_module will be:

...

The argument S->maxDelayTime initializes the internal module achieving the desired effect.

Disambiguating Wire Allocation

If look at the default subsystem including wiring information, we see:

...