Musical Notes and Frequency

Musical Notes and Frequency

Introduction

This post's labels were updated on August 2nd, 2024, but the original post was published earlier in the summer.

This post goes hand-in-hand with a GitHub project I'm working on. This is part of the background research that's gone into understanding pitch and frequency in the context of human hearing and the Chromatic scale.

The Chromatic Scale

"The chromatic scale is a musical scale with twelve pitches" - C, C#, D, D#, E, F, F#, G#, A, A#, and B - each of which represents a specific frequency within an octave. An octave is the interval (of frequencies) between two adjacent harmonic pitches (which in the chromatic scale are given the same name). The twelve pitches in an octave are equal-tempered, meaning each pitch is a multiple of the prior pitch by a factor of 2^(1/12) ≈ 1.05946. 

See the table below for a look at all the frequencies of pitches in the chromatic scale.

https://mixbutton.com/mixing-articles/music-note-to-frequency-chart/

 The Nyquist Theorem

"The Nyquist theorem states that an analog signal can be digitized without aliasing error if and only if the sampling rate is greater than or equal to twice the highest frequency component in a given signal." (Source: ScienceDirect)

Since most microphones are capable of at least 44.1 kHz, any sound heard by the human ear can be captured with enough fidelity.

Frequency Extraction

My first thought when approaching this application was to apply a Fourier Transform, which breaks down a signal into its component frequencies. In fact (as of Jul 7th, 2024), the Wikipedia article on the Fourier transform contains an example of this exact application, i.e., of utilizing the Fourier transform to determine the constituent pitches in a musical waveform:

Fourier Transform used to extract pitch from a musical waveform.

Fourier Transform on Recorded Audio

When I tried to utilize the Fourier Transform on a piece of audio I recorded, I could not see any obvious frequencies extracted, though the recorded audio contained a fairly clear recording of me whistling a single musical note. The following plots show the waveform and power-spectrum of the recorded audio.

Raw waveform of a 2-second recording containing a whistle (single note and noise).

Power Spectrum calculated from the above waveform using SciPy.

Conclusion

I'll end the post here, since the background research regarding musical notes and frequency has been concluded. Subsequent posts and research will involve a deeper dive into the Fourier Transform and other signal processing methods. 

Comments

Popular Posts