Waveform Generator & Synthesizer Back
Signal Analysis

Waveform Generator & Synthesizer

Combine up to 4 sine, square, triangle, or sawtooth components. Instantly compute RMS, peak, crest factor, THD, and visualize the composite waveform alongside its 512-point DFT frequency spectrum.

Waveform Components
Component 1
Amplitude A
Frequency f (Hz)
Hz
Phase φ (°)
°
Component 2
Amplitude A
Frequency f (Hz)
Hz
Phase φ (°)
°
Component 3
Amplitude A
Frequency f (Hz)
Hz
Phase φ (°)
°
Component 4
Amplitude A
Frequency f (Hz)
Hz
Phase φ (°)
°
Composite Waveform Stats
Results
RMS
Peak
Crest Factor
THD (%)
Time-domain waveform & frequency spectrum (DFT)
Time
Amplitude Spectrum
Theory & Key Formulas
Square: $\dfrac{4A}{\pi}\sum_{n=1,3,5...}\dfrac{1}{n}\sin(n\omega t)$
Triangle: $\dfrac{8A}{\pi^2}\sum_{n=0}^{\infty}\dfrac{(-1)^n}{(2n+1)^2}\sin((2n+1)\omega t)$
Sawtooth: $\dfrac{2A}{\pi}\sum_{n=1}^{\infty}\dfrac{(-1)^{n+1}}{n}\sin(n\omega t)$

What is Waveform Synthesis?

🙋
What exactly is a "complex waveform"? I thought signals were just simple sine waves.
🎓
Basically, any repeating signal that isn't a perfect sine wave is complex. In practice, they're built by adding together simple sine waves of different frequencies. For instance, the buzzer on a microwave and the sound of a violin are both complex waveforms. Try the simulator above: set the first component to 1V at 100 Hz, then add a second one at 300 Hz with a smaller amplitude. You'll see the smooth sine wave transform into a more interesting shape.
🙋
Wait, really? So that's how you make a square or triangle wave? How do you know which sine waves to add?
🎓
Exactly! That's the magic of the Fourier series—a recipe that tells you the exact amplitude and frequency of the sine waves needed. A common case is a square wave: it needs sine waves at the odd multiples of the base frequency. In the simulator, try to build one: set Component 1 to 100 Hz, Component 2 to 300 Hz (3x), Component 3 to 500 Hz (5x), and give them amplitudes following the pattern 1, 1/3, 1/5. Watch how the sum starts to look "squarer".
🙋
That's cool. But what do the RMS and "Crest Factor" numbers mean? Why are they important?
🎓
Great question. RMS (Root Mean Square) tells you the effective power of the signal. For a sine wave, it's about 0.707 times the peak. Crest Factor (Peak/RMS) measures "peakiness." A sine wave has a factor of 1.41, but a square wave is 1.0. This is crucial for engineering! For instance, an audio amplifier must handle peaks without distorting. Change the phase of one component using the φ slider and watch how the RMS and Crest Factor change—it directly affects the power delivered.

Physical Model & Key Equations

The core principle is that any periodic waveform can be constructed by summing a series of sine waves (harmonics). This is described by the Fourier Series. The general form for a waveform is:

$$x(t) = \sum_{n=1}^{\infty}\left[ a_n \cos(n \omega t) + b_n \sin(n \omega t) \right]$$

Where $x(t)$ is the composite signal, $\omega = 2\pi f$ is the fundamental angular frequency, and $n$ is the harmonic number. The coefficients $a_n$ and $b_n$ determine the amplitude and phase of each harmonic and are unique for each target waveform.

The key metrics analyzed by the simulator are calculated from the composite signal. The Root Mean Square (RMS) voltage, which relates to power, is:

$$V_{rms}= \sqrt{\frac{1}{T} \int_0^T [x(t)]^2 \, dt}$$

Where $T$ is the period. The Crest Factor (CF) is a simple ratio of the peak absolute value to the RMS value: $CF = V_{peak}/ V_{rms}$. A higher crest factor means a signal has more extreme peaks relative to its average power.

Real-World Applications

Audio Synthesis & Music Production: This is the foundation of subtractive synthesis used in analog synthesizers. By starting with a rich waveform (like a sawtooth or square wave built from harmonics) and then filtering out certain frequencies, musicians can create the vast array of sounds heard in electronic music.

Power Electronics & Motor Drives: Variable Frequency Drives (VFDs) control AC motor speed by synthesizing a variable-frequency AC waveform from a DC source. They use Pulse Width Modulation (PWM), which is essentially a complex square wave, and its harmonic content is critical for motor efficiency and noise.

Signal Integrity & Communications: In digital communications, a square wave represents a stream of 1s and 0s. Real circuits can't produce perfect squares, so engineers analyze the harmonic content to understand bandwidth requirements and prevent data corruption due to high-frequency loss.

Medical Device Testing: Patient simulators and equipment testers use precise waveform synthesis to generate ECG, EEG, or other physiological signals. The ability to control each harmonic allows engineers to create both standard test patterns and pathological waveforms for device validation.

Common Misunderstandings and Points to Note

When you start using this tool, there are a few common pitfalls to watch out for. First is the interpretation of "Amplitude". For a sine wave, amplitude A is directly the peak value, but it's a different story for square or triangle waves. For example, a square wave with a 1V amplitude has a peak value of 1V, but its RMS value is about 1V (for an ideal square wave). On the other hand, the RMS value of a 1V amplitude sine wave is about 0.707V. Since the same "1V amplitude" setting yields different RMS values depending on the waveform type, you need to be careful when considering power or energy.

Next is overlooking the effect of "Phase". Changing the phase between 0 and 180 degrees intuitively flips the waveform, but shifts of 90 or 270 degrees have more subtle effects. For instance, when synthesizing a fundamental wave with its 3rd harmonic, just changing the phase can significantly alter the shape of the resulting waveform (like peak sharpness or symmetry). In acoustics, this changes tonal nuances; in control systems, it affects transient response.

Finally, "Interpreting the Frequency Spectrum". You might find that the spikes from an FFT don't perfectly match the frequencies of the components you set. This is a frequency resolution issue. For example, with a fundamental frequency of 1Hz and an analysis time of 1 second, the resolution is 1Hz. So, a 1.5Hz component will appear spread out between 1Hz and 2Hz. In simulation, you know the theoretical values, so it's easy to miss, but when handling real measured data, always keep this "leakage" phenomenon in mind.

How to Use

  1. Set the fundamental frequency (vf0) in Hz—typical range 50–20000 Hz for audio or power applications.
  2. Configure up to 4 harmonic components by entering amplitude (sA0Num) and phase shift (sphi0 in degrees) for each.
  3. Adjust waveform type (en0) and sampling parameters (sf0Num for sample count), then click Synthesize to generate the composite signal.
  4. Review output metrics: RMS voltage, Peak amplitude, Crest Factor, and THD (%) displayed automatically.

Worked Example

Design a square wave approximation for a 60 Hz industrial power signal. Set fundamental to 60 Hz, Amplitude 230 V (RMS equivalent peak ~325 V). Add 3rd harmonic at 180 Hz with amplitude 108 V (33% of fundamental) and 0° phase. Add 5th harmonic at 300 Hz with amplitude 65 V (20% of fundamental). Result: composite RMS ≈ 242 V, Peak ≈ 360 V, Crest Factor ≈ 1.49, THD ≈ 35.3%. Compare against pure sine (THD 0%, Crest Factor 1.414).

Practical Notes

  1. Power quality audits: THD exceeding 5% for voltage or 20% for current indicates nonlinear loads; use this tool to diagnose harmonic content from distorted waveforms.
  2. Audio synthesis: Set fundamental 440 Hz (A4 note), add harmonics at 880 Hz (50%), 1320 Hz (33%), 1760 Hz (25%) to create warm sawtooth timbre.
  3. Sample rate (sf0Num) must exceed 2× highest frequency component (Nyquist criterion); use ≥40 kHz for signals up to 20 kHz.
  4. Crest Factor >1.414 indicates non-sinusoidal content; equipment rated for sinusoidal loads may overheat under high crest factor waveforms.