You are here: Symbol Reference > SignalUtils Namespace > Functions > SignalUtils.SquareToneInit Function
DSP Master VCL
ContentsIndex
PreviousUpNext
SignalUtils.SquareToneInit Function

Initialize the generation of a square tone.

Pascal
procedure SquareToneInit(Freq: double; Phase: double; Mag: double; var State: TSquareToneState; Complex: boolean = false; const MaxHarmonics: integer = -1);

Initialize a square signal ToneState with frequency Freq, initial Phase and amplitude Mag. Set Complex to true to generate a complex signal. State is to be passed to the SquareTone routine to generate the actuall time series. The time series is generated by Fourier Series expansion. For very low frequencies, for example 1Hz, and sampling frequency of 192kHz, this would result in 48000 distinct sine tones to be generated and would require proportional computational power. The maxHarmonics parameter defines the maximum number of harmonics (including the fundamental) to be generated for the approximation of the square signal. This can help limit the CPU requirements in case of very low frequencies. About 200 Harmonics would already give a very good shape of "square".

Copyright (c) 1999-2025 by Dew Research. All rights reserved.
What do you think about this topic? Send feedback!