Sound frequency
Introduction
The signal frequency is the "pitch" of the sound. Some facts about sound
frequencies you might encounter in a pub quiz...
- Typically, male voices range from 85 to 180 Hz and female voices from 165 to 255 Hz.
- Humans can easily hear the sound frequency up to 8,000 Hz and lose abilities to hear sounds beyond that frequency through age.
- The music note C is 261.63 Hz and E 329.63 Hz.
The Python notebook is a convenient playground to generate sounds of those
frequencies and listen to the sounds.
https://github.com/yasumori/blog/blob/main/2025/2025_12_21_signal2.ipynb.
An example code snipet to generate a 2,000 Hz sound is also below:
import numpy as np
from IPython import display
def gen_audio(frequency, duration, sample_rate):
t = np.linspace(0, duration, duration * sample_rate)
return np.sin(2 * np.pi * frequency * t)
hz_2000 = gen_audio(2000, 3, 44100)
display.Audio(hz_2000, rate=44100)
The nice thing about speech and audio processing is to generate sounds and
we can actually listen to it. The 2,000 Hz signal sounds like this:
Then, the 8,000 Hz sound has a lot higher pitch.
The 16,000 Hz sound is very annoying or maybe we can't here it. This sound can scare mice.
The music note C sounds like this.
Then, the note E sounds like this.
We can also add C and E sounds that form a chord.
Time Domain to Frequency Domain
In digital signal processing, the x-axis is time and the y-axis is amplitude
(loudness) in a typical figure of a waveform:
The figure shows a simple sine wave of 1 Hz (1 cycle per second). We can still
see this is only one cycle per second.
Tracking cycles however becomes very
difficult as the signal frequency increases.
This figure shows the first 5 cycles of 261 Hz sine wave. 5 cycles are finished
within 0.02 seconds, meaning that we need to count cycles for samples of
additional 0.98 seconds to ensure that this is a 261 Hz signal. We can add two signals of C (261 Hz) and E (329 Hz) to form a chord. The result is the blue line at the bottom.
Ideally, we want to have a way to know frequency components of the signal at
once. Thankfully, there's a magic called Discrete Fourier Transform (DFT) to
obtain a figure below:
This figure illustrates that the blue signal in the previous figure consists of two peak frequencies of 261 Hz and 329 Hz.
To summarise this post:
- The frequency characterises the "pitch" of a sound.
- We can generate a sound of a certain frequency using Python and listen to it.
- A signal can consist of multiple frequencies and the Discrete Fourier Transform can show "strenghts" of certain frequencies in the signal.




Comments
Post a Comment