Sahyun's Physics Applets in HTML5

HTML 5

Wave Distortion: Noise, Clipping, and Nonlinearity

Wave Distortion Simulator — developed with assistance from ChatGPT (GPT-5), an AI model by OpenAI, October 2025.

Code converted from original MATLAB code wavedistortion.m by Steven Sahyun, University of Wisconsin - Whitewater, Nov. 12, 2021

The following student activity to do was generated by ChatGPT October 2025

Wave Distortion Simulator – Explanation

1. Purpose

This simulator demonstrates how an audio wave (like a simple tone) changes when affected by noise, clipping, and nonlinear distortion. These effects occur in real audio systems, such as microphones, amplifiers, and digital processing.

2. The Clean Wave

The original signal is a pure sine wave:
y(t) = A sin(2π f t)
where A is amplitude, f is frequency, and t is time.

3. White Noise

White noise adds random background sound. Increasing Noise Amplitude adds a random “hiss” to the wave. In the frequency plot, noise raises the overall level across many frequencies rather than just one.

4. Clipping Distortion

Clipping occurs when the wave exceeds the Clipping Amplitude. The peaks are “cut off,” making the waveform flatter at top and bottom. This introduces high-frequency components, making clipped sounds buzzy or harsh.

5. Nonlinear Distortion

A nonlinear response simulates real devices that distort the wave shape in a curved way. The formula applied is:
y_new = y^(1 + 2 * nonlinear)
Positive values exaggerate peaks; negative values compress them.

6. Frequency Spectrum

The lower plot shows the FFT (frequency spectrum) of the waveform: x-axis = frequency (Hz), y-axis = amplitude. A pure sine wave has one strong peak; noise or distortion introduces additional peaks (harmonics).

What to Observe

Adjust the sliders to explore:

Learning Goals

Students should: