Introduction

This is a book about learning how to create your own sound effects from scratch using Rust.

This book is very work-in-progress. Reporting any mistakes/typos you see helps a lot!

Basic Theory

This chapter will explain the basics how digital audio works and some concepts needed to get started.

Sound

Sound is a medium (air), vibrating.

Us humans make a distinction between sound and noise:

When air is displaced in certain patterns our brains can recognize, we call it sound. When air is displaced in patterns our brain can’t recognize, we call it noise.

Speakers

To generate sound from an electronic device we need something we commonly call a speaker.

A speaker works by converting electronic current to movement to vibrate air.

Sound

This electronic current is an analog signal, which means that it also has a wave pattern unlike a digital signal, which is an off-or-on current, 0’s and 1’s.

Digital Signal Processing

As we’ve seen in the previous channel, to create sound from a speaker we need an analog signal, but our computers are digital. How can we convert this digital signal (e.g. a MP3 file) to an analog signal (e.g. the speakers of your PC)?

Digital to Analog Converters (DAC)

TODO: explain digital to analog converters

PCM

DAC

Further Reading:

Sample Rate

TODO: explain buffer size is related to audio quality with how a sine wave is cut down

Oscillators

Backends

SDL2

CPAL

Oscillators

Sine

Square

Saw

Noise

Effects

Distortion

Overdrive