How the sound is produced by software?
The audio card (with the Digital-Analog Converter) is the key component that converts a list of numbers into sound. Let's now dig into what each number in that list means:
Each number is a sample of the waveform at a specific point in time, and it represents the amplitude of the sound wave at that instant.
Typically, these values are in the range −1.0 to +1.0.
0
means no displacement (silence).- Positive values → speaker cone moves forward (air pressure ↑).
- Negative values → cone moves backward (air pressure ↓).
The larger the absolute value, the louder the sound at that moment.
Example: Sine Wave
In Mathematica, a 440 Hz sine wave (A4) at time t
looks like:
samples = Table[Sin[2 Pi 440 t], {t, 0, 1, 1/44100}];
- Each number in
samples
is the height of the sine wave at that point. - For example, the first few values might be:
{0, 0.0627, 0.1250, 0.1869, ..., -0.1250, -0.0627}
Each of these values tells the speaker to move its diaphragm forward or backward slightly, creating pressure changes in the air — which we hear as sound.
These samples are sent at high speed (e.g., 44100 per second), which the DAC turns into voltage changes that drive the speaker.