Chapter 3. Non-Periodic Signals
The signals we have worked with so far are periodic, which means that they repeat forever. It also means that the frequency components they contain do not change over time. In this chapter, we consider non-periodic signals, whose frequency components do change over time. In other words, pretty much all sound signals.
This chapter also presents spectrograms, a common way to visualize non-periodic signals.
The code for this chapter is in chap03.ipynb
, which is in the repository for this book (see “Using the Code”). You can also view it at http://tinyurl.com/thinkdsp03.
Linear Chirp
We’ll start with a chirp, which is a signal with variable frequency. thinkdsp
provides a Signal
called Chirp
that makes a sinusoid that sweeps linearly through a range of frequencies.
Here’s an example that sweeps from 220 to 880 Hz, which is two octaves from A3 to A5:
signal = thinkdsp.Chirp(start=220, end=880) wave = signal.make_wave()
Figure 3-1 shows segments of this wave near the beginning, middle, and end. It’s clear that the frequency is increasing.
Before we go on, let’s see how Chirp
is implemented. Here is the class definition:
class Chirp(Signal): def __init__(self, start=440, end=880, amp=1.0): self.start = start self.end = end self.amp = amp
start
and end
are the frequencies, in Hz, at the start and end of ...
Get Think DSP now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.