Transforming audio signals into the frequency domain
Audio signals consist of a complex mixture of sine waves of different frequencies, amplitudes, and phases. Sine waves are also referred to as sinusoids. There is a lot of information that is hidden in the frequency content of an audio signal. In fact, an audio signal is heavily characterized by its frequency content. The whole world of speech and music is based on this fact. Before you proceed further, you will need some knowledge about Fourier transforms. A quick refresher can be found at http://www.thefouriertransform.com. Now, let's take a look at how to transform an audio signal into the frequency domain.
How to do it…
Create a new Python file, and import the following package:
import numpy as np from scipy.io import wavfile import matplotlib.pyplot as plt
Read the
input_freq.wav
file that is already provided to you:# Read the input file sampling_freq, audio = wavfile.read('input_freq.wav')
Normalize the signal, as follows:
# Normalize the...