Overview
Sweep generator
Discussion
Creates a sweep signal generator for use in the Audio Weaver environment. This module has a single channel output pin and generates sweep sine signals with definable start and stop frequencies and sweep times. Sweep generators are commonly used to test the frequency response of electronic filter circuits or speakers.
Trigger parameter allows controlling start and stop of the sweep. This will initially be 0 (waiting), set to 1 to start the sweep. After sweep is completed and the time of the padding samples elapsed the trigger is set to 0 by the module.
If the trigger is used as input pin, it overrides the trigger parameter functionality and directly controls start (1) and stop (0) of the sweep.
Type Definition
typedef struct _ModuleSweepGen { ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure INT32 trigger; // State variable/parameter to trigger sweep on/off. INT32 sweepType; // Specifies a Linear or a Logarithmic sweep. FLOAT32 startFreq; // Frequency at which the sweep starts. FLOAT32 stopFreq; // Frequency at which the sweep ends. INT32 sweepTime; // The time interval in samples of the sweep between the start frequency and the stop frequency FLOAT32 amplitude; // Amplitude in linear units. INT32 padding; // Number of zero samples before repeating the sweep cycle. INT32 duration; // Sweep time in samples. FLOAT32 startIncr; // Increment start value. FLOAT32 endIncr; // Increment target vallue. FLOAT32 dIncr; // Delta increment. FLOAT32 momentaryIncr; // Momentary increment. FLOAT32 phase; // The stored phase of the sweep function. INT32 sampleCnt; // Momentary sample counter. INT32 paddingCnt; // Momentary padding counter. UINT32 pinID; // Specifies which control pins are available. } ModuleSweepGenClass;
Variables
Properties
Name | Type | Usage | isHidden | Default value | Range | Units |
trigger | int | state | 0 | 0 | 0:1 | |
sweepType | int | parameter | 0 | 0 | 0:1 | |
startFreq | float | parameter | 0 | 20 | 1:24000 | Hz |
stopFreq | float | parameter | 0 | 24000 | 1:24000 | Hz |
sweepTime | int | parameter | 0 | 48000 | 1:2880000 | samples |
amplitude | float | parameter | 0 | 1 | 0:1 | linear |
padding | int | parameter | 0 | 0 | 0:32767 | samples |
duration | int | derived | 1 | 48000 | Unrestricted | |
startIncr | float | derived | 1 | 0.0004167 | Unrestricted | |
endIncr | float | derived | 1 | 0.5 | Unrestricted | |
dIncr | float | derived | 1 | 1.041e-05 | Unrestricted | |
momentaryIncr | float | state | 1 | 0.0004167 | Unrestricted | |
phase | float | state | 1 | 0 | Unrestricted | |
sampleCnt | int | state | 1 | 0 | Unrestricted | |
paddingCnt | int | state | 1 | 0 | Unrestricted | |
pinID | uint | const | 1 | 1 | Unrestricted |
Pins
Input Pins
Name: trigger
Description: Flag to trigger sweep on/off
Data type: int
Channel range: 1
Block size range: 1
Sample rate range: Unrestricted
Complex support: Real
Output Pins
Name: out
Description: audio output
Data type: float
MATLAB Usage
File Name: sweep_gen_module.m
M=sweep_gen_module(NAME, SAMPLERATE, BLOCKSIZE, TRIGGERPIN) Creates a sweep signal generator for use in the Audio Weaver environment. This module has a single channel output pin and generates sweep sine signals with definable start and stop frequencies and duration times. Arguments: NAME - name of the module. BLOCKSIZE - number of samples per output channel. By default, BLOCKSIZE = 256. SAMPLERATE - sample rate of the output signal, in Hz. By default, SAMPLERATE = 48000. TRIGGERPIN - boolean that determines whether the module exposes an input pin that allows en/disabling during run-time