Skip to content
Tutorials Center
My learning

Topics

Lesson 1 of 38 ยท Getting Started

What Is Digital Signal Processing?

Learn what digital signal processing is, where it is used, and how a DSP system turns a real-world signal into numbers, processes it and turns it back, with Python.

A signal is any quantity that varies and carries information: the voltage from a microphone, the pressure in a sound wave, the brightness along one row of a photo, the price of a stock each day, the voltage across your heart during a heartbeat. Signal processing is the craft of changing signals to make them more useful: removing noise, squeezing them into fewer bytes, pulling out hidden patterns, or turning them into something a machine can act on.

Digital signal processing (DSP) does this with numbers instead of with capacitors, coils and op-amps. A computer, a phone chip or a small dedicated processor receives a list of measurements, runs arithmetic on that list, and produces a new list. Because the work is just arithmetic, a DSP system is repeatable, easy to change in software, and does not drift with temperature or age. That is why nearly every modern audio, radio, image, radar and sensor product is built on it.

In this course you will build every idea from scratch in Python (NumPy, SciPy and Matplotlib run right in your browser), then compare your code with the library versions. This first lesson gives you the map.

Where DSP is used

  • Audio: equalizers, noise cancelling headphones, speech recognition, MP3 and AAC compression, autotune.
  • Communication: your phone and Wi-Fi modulate and demodulate signals, correct errors, and cancel echoes using DSP.
  • Medicine: cleaning an ECG, reconstructing an MRI or CT image, hearing aids.
  • Sensing: radar, sonar, seismology, vibration monitoring of machines, GPS receivers.
  • Images and video: sharpening, blurring, compression (JPEG, H.264) and edge detection are all filters.
  • Data science: smoothing time series, finding seasonality, detecting anomalies.

The anatomy of a DSP system

flowchart LR
    A["Real world<br/>(analog signal)"] --> B["Anti-alias<br/>filter"]
    B --> C["Sampler + ADC"]
    C --> D["Digital processor<br/>(your algorithm)"]
    D --> E["DAC"]
    E --> F["Reconstruction<br/>filter"]
    F --> G["Output<br/>(analog signal)"]

From a continuous signal to numbers and back. Many applications stop after the processor (you analyze and display), and some start from stored data.

  1. A sensor produces a continuous (analog) signal.
  2. An anti-alias filter removes frequencies that the next stage could not represent correctly. Aliasing is the first big idea of the course.
  3. A sampler reads the value every fixed time step, and an ADC (analog to digital converter) rounds each reading to a number with a limited number of bits (quantization).
  4. Your algorithm works on the list of numbers.
  5. A DAC turns numbers back into a stepped voltage, and a reconstruction filter smooths the steps into a clean analog signal.

Signals as arrays

In code a digital signal is just an array. The array x holds the samples, and a second array holds the time of each sample. The time gap between samples is the sampling period T, and its reciprocal fs = 1/T is the sampling rate in samples per second (hertz).

Python A signal is an array

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Notice how few numbers describe one second of a 2 Hz wave: four samples per cycle. Later you will see exactly when that is enough.

Your first processing: smoothing noise

Real measurements carry noise. The simplest DSP trick is to replace each sample with the average of its neighbours. Fast noise averages out while the slow signal survives.

Python A moving average removes noise

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The error shrinks because random noise is different on every sample, so averaging nine of them reduces it by about a factor of three (sqrt(9)). The averaging also blunts the sine slightly: a trade-off you will quantify in the FIR lessons.

Time domain and frequency domain

You can look at a signal in two ways. In the time domain you plot value against time. In the frequency domain you ask which sine waves, at which frequencies and strengths, add up to the signal. Many problems that are tangled in time become simple in frequency: a hum at 50 Hz is a single spike, and removing it is deleting one spike.

Python Two views of the same signal

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Two tidy lines of output replace 200 wiggly samples. Computing this view is the job of the Fourier transform, which gets a whole chapter.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What does a DSP system process?

    DSP replaces analog circuitry with arithmetic on sampled numbers. It works for any signal type, not only audio.
  2. 2. A signal is sampled at fs = 1000 Hz. What is the time between samples?

    T = 1/fs = 1/1000 s = 1 ms.
  3. 3. Why does a moving average reduce random noise?

    Independent random errors tend to cancel in an average, while a slowly changing signal stays almost the same.
  4. 4. What is the main benefit of the frequency-domain view?

    A hum or a tone appears as one spike, which is easy to see and remove.

Summary

  • A signal carries information and varies with time (or space); DSP processes it as lists of numbers.
  • A DSP chain is: sensor, anti-alias filter, ADC, algorithm, DAC, reconstruction filter.
  • fs is the sampling rate and T = 1/fs the sampling period.
  • Averaging neighbours is the simplest filter and reduces random noise.
  • Signals can be viewed in time or in frequency.

Next: Sampling and Aliasing