Skip to content

Sawtooth

Discussion

THIS MODULE IS DEPRECATED AND NOT RECOMMENDED FOR NEW DESIGNS. PLEASE USE THE PeriodicFunctionGen MODULE INSTEAD.

Creates a sawtooth generator for use in the Audio Weaver environment. This module has a single 1 channel output pin with controllable frequency with the parameter, freq. The output of the module is a ramp that starts at 0 and then goes up to 1.0. At 1.0 it wraps back to 0.

The internal state variable, phase, stores the phase of the sawtooth module. The internal state variable, phaseIncrement, stores the amount that the oscillator phase is incremented for each output sample .

Module Pack

Deprecated

ClassID

classID = 2035

Type Definition

typedef struct _ModuleSawtooth
{
ModuleInstanceDescriptor instance;            // Common Audio Weaver module instance structure
FLOAT32 freq;                                 // Frequency of the sawtooth generator.
FLOAT32 phase;                                // The stored phase of the sawtooth module.
FLOAT32 phaseIncrement;                       // The amount that the oscillator phase is incremented for each output sample.
} ModuleSawtoothClass;

Variables

Properties

Name Type Usage isHidden Default Value Range Units
freq float parameter 0 1000 0.01:24000 Hz
phase float state 1 0 Unrestricted
phaseIncrement float parameter 1 0.04167 Unrestricted

Pins

Output Pins

Name out
Description audio output
Data Type float

Matlab Usage

File Name: sawtooth_module.m 
 M=sawtooth_module(NAME, SR, BLOCKSIZE) 
 Creates a sawtooth generator module for use in the Audio Weaver 
 environment. 

 Arguments: 
    NAME - name of the module. 
    SR - sample rate. 
    BLOCKSIZE - number of samples per output channel. 

Copyright (c) 2026 DSP Concepts, Inc.