music, math & me: from pythagorean tuning to digital...

1
Music, Math & Me: From Pythagorean Tuning to Digital Synthesis E. Carmi D. Zeigler California State University, Sacramento, CA Abstract Mathematically, audio signals are modelled as periodic curves, or waves, in the time domain. According to Fourier’s Theorem, any periodic wave can be decomposed as a sum of sinusoidal waves. Applied to music, every instrument has a signature sound characterized by the frequencies of the sound waves produced when played. We used the Fast Fourier Transform (FFT) to extract and manipulate audio signal properties (amplitude, frequency and wave envelope) of a tenor saxophone. Ring modulation was also applied to manipulate a square wave signal. Motivation Equipped with the complete frequency profile of an instrument, a similar sound may be electronically recreated using sinusoidal waves. Knowledge of the sound profile of an instrument may also enhance sound quality. Pythagoras developed a structure of frequency ratios which are now referred to as musical scales. For reasons unknown, many modern musicians are unaware of Pythagorean Tuning and have been using equal-tempered tuning. We can compare multiples of frequencies that match the Pythagorean ratios with each other, as well as randomly selected frequencies to determine relative dissonance/consonance. Components of Sound Sound is characterized by: I Frequency (pitch) I Duration (length) I Amplitude (volume) I Tone (harmonic content) I Envelope (ADSR) 0 0.2 0.4 0.6 0.8 1 0 50000 100000 150000 200000 250000 300000 Attack Decay Sustain Release Figure: An envelope of sound is composed of a sound’s attack, sustain, decay, and release. F ast Fourier Transform (FFT) The discrete Fourier transform (DFT) is used to analyze the frequency spectrum of a finite collection of sampled data. For an original 2π-periodic signal, f (x), the sampled signal is f =(f 1 f 2 ··· f n ) T R n . The transformed signal, ˆ f, containing frequency data is calculated as ˆ f = 1 ω ··· ω (n-1) 1 ω 2 ··· ω 2(n-1) . . . . . . . . . . . . 1 ω (n-1) ··· ω (n-1) 2 f where ω = exp - 2πi N = cos - 2π N + i sin - 2π N The components of ˆ f give a resolution of the sampled signal, f, into it’s harmonics [1]. The FFT is an optimized algorithm for computing the DFT that produces exactly the same result as evaluating the DFT definition directly at a much faster rate. Pythagorean Tuning Modern scales used in music are based on specific ratios compared to the first note, similar to frequency ratios. Scale Ratio (Freq.) Interval Name 1 1 unison 2 9/8 major second 3 81/64 major third 4 4/3 perfect fourth 5 3/2 perfect fifth 6 27/16 major sixth 7 243/128 major seventh 8 2 octave -1 -0.5 0 0.5 1 0 50 100 150 200 250 Figure: Frequency ratios for a single sinusoidal wave; ×1 (red), ×3/2 (green), ×2 (blue) Square W ave &Tenor Sax Harmonics A square wave is composed of a sum of odd harmonics (n = 1, 3, 5, 7, . . .) with each successive sine wave amplitude decreasing by a factor of (1/n) X n=1 sin(2n - 1)x 2n - 1 = sin x + 1 3 sin 3x + ··· Using the FFT, the sampled signal of a tenor saxophone may be decomposed into it’s unique spectrum of frequency ratios. -1 -0.5 0 0.5 1 0 100 200 300 400 500 (a) -1 -0.5 0 0.5 1 0 100 200 300 400 500 (b) -0.4 -0.2 0 0.2 0.4 0 50000 100000 150000 200000 250000 300000 350000 400000 (c) 0 500 1000 1500 2000 2500 3000 0 1000 2000 3000 4000 5000 6000 (d) Figure: (a) Individual odd harmonic waves; (b) summation of odd harmonic waves to form a square wave; (c) sampled signal of a tenor saxophone playing a single note; (d) frequency distribution of tenor sax found by applying the FFT to the audio signal in (c). Ring Modulation Ring modulation is a type of amplitude modulation where the input levels of the carrier and modulation signals are balanced such that the only output are the sum and dierence frequencies. The resulting frequencies are almost guaranteed to not be harmonically related, and ring modulation is often used to simulate the sounds of tuned percussion instruments that produce inharmonic frequency spectra, such as bells and chimes. In this example, the carrier wave is a square wave of 396 Hz. When the modulating wave is a 1 Hz sine wave, the eect produced is similar to the carrier wave’s volume changing sinusoidally between the maximum volume and no volume. When the modulating wave is of a higher frequency or a dierent waveform, the output has more aliasing (distortion) if the modulating wave’s fundamental frequency is ×9/8 (major second) from the carrier, but there is less distortion if the modulating wave is ×3/2 (P5) or ×2 (octave) from the carrier. -1 -0.5 0 0.5 1 0 20000 40000 60000 80000 100000 120000 140000 160000 180000 (a) -1 -0.5 0 0.5 1 0 20000 40000 60000 80000 100000 120000 140000 160000 180000 (b) Figure: (a) Carrier square wave of 396 Hz; (b) The eect produced after applying a modulating wave sine wave of 1 Hz. Conclusion Digital synthesis is a common application in creating or modulating sound for music. The FFT is incredibly useful for analyzing the frequency spectrum of a signal. These techniques are not restricted to audio signals and can also be applied in analyzing waves of light got radio communication or infrared imaging. Future Work I Create a phaser eect by implementing an all-pass filter with the z-transform. I Create a digital delay, which shifts a sequence by a desired amount of samples. I Create a flanger eect by combining the phaser and delay. The net sound eect imitates a Doppler shift. Bibliography E. Kreyszig. Advanced Engineering Mathematics. Wiley, New York, 10edition, 2011. Acknowledgements This project was funded by a Faculty Promotion Development Award, 2012-2013, College of Natural Science & Mathematics, CSUS. http://http://webpages.csus.edu/ zeigler zeigler at csus dot edu

Upload: others

Post on 30-Apr-2020

7 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Music, Math & Me: From Pythagorean Tuning to Digital Synthesiswebpages.csus.edu/zeigler/Research/StudRes/audioPoster.pdf · Music, Math & Me: From Pythagorean Tuning to Digital Synthesis

Music, Math & Me: From Pythagorean Tuning to Digital SynthesisE. Carmi D. Zeigler

California State University, Sacramento, CA

AbstractMathematically, audio signals are modelled as periodic curves, or waves, in thetime domain. According to Fourier’s Theorem, any periodic wave can bedecomposed as a sum of sinusoidal waves. Applied to music, every instrumenthas a signature sound characterized by the frequencies of the sound wavesproduced when played. We used the Fast Fourier Transform (FFT) to extract andmanipulate audio signal properties (amplitude, frequency and wave envelope) ofa tenor saxophone. Ring modulation was also applied to manipulate a squarewave signal.

MotivationEquipped with the complete frequency profile of an instrument, a similar soundmay be electronically recreated using sinusoidal waves. Knowledge of the soundprofile of an instrument may also enhance sound quality. Pythagoras developed astructure of frequency ratios which are now referred to as musical scales. Forreasons unknown, many modern musicians are unaware of Pythagorean Tuningand have been using equal-tempered tuning. We can compare multiples offrequencies that match the Pythagorean ratios with each other, as well asrandomly selected frequencies to determine relative dissonance/consonance.

Components of SoundSound is characterized by:

I Frequency (pitch)IDuration (length)IAmplitude (volume)ITone (harmonic content)I Envelope (ADSR)

0

0.2

0.4

0.6

0.8

1

0 50000 100000 150000 200000 250000 300000

Attack Decay Sustain Release

Figure: An envelope of sound iscomposed of a sound’s attack, sustain,decay, and release.

Fast Fourier Transform (FFT)The discrete Fourier transform (DFT) is used to analyze the frequency spectrumof a finite collection of sampled data. For an original 2π-periodic signal, f (x), thesampled signal is f = (f1 f2 · · · fn)T ∈ Rn. The transformed signal, f̂, containingfrequency data is calculated as

f̂ =

1 ω · · · ω(n−1)

1 ω2 · · · ω2(n−1)

... ... . . . ...1 ω(n−1) · · · ω(n−1)2

f

whereω = exp

(−

2πiN

)= cos

(−

2πN

)+ i sin

(−

2πN

)The components of f̂ give a resolution of the sampled signal, f, into it’s harmonics[1]. The FFT is an optimized algorithm for computing the DFT that producesexactly the same result as evaluating the DFT definition directly at a much fasterrate.

Pythagorean TuningModern scales used in music are based on specific ratios compared to the firstnote, similar to frequency ratios.

Scale Ratio (Freq.) Interval Name1 1 unison2 9/8 major second3 81/64 major third4 4/3 perfect fourth5 3/2 perfect fifth6 27/16 major sixth7 243/128 major seventh8 2 octave

-1

-0.5

0

0.5

1

0 50 100 150 200 250

Figure: Frequency ratios for a singlesinusoidal wave; ×1 (red), ×3/2(green), ×2 (blue)

SquareWave & Tenor Sax Harmonics

A square wave is composed of a sum of odd harmonics (n = 1, 3, 5, 7, . . .) witheach successive sine wave amplitude decreasing by a factor of (1/n)∞∑

n=1

sin(2n − 1)x2n − 1

= sin x +13

sin 3x + · · ·

Using the FFT, the sampled signal of a tenor saxophone may be decomposed intoit’s unique spectrum of frequency ratios.

-1

-0.5

0

0.5

1

0 100 200 300 400 500

(a)

-1

-0.5

0

0.5

1

0 100 200 300 400 500

(b)

-0.4

-0.2

0

0.2

0.4

0 50000 100000 150000 200000 250000 300000 350000 400000

(c)

0

500

1000

1500

2000

2500

3000

0 1000 2000 3000 4000 5000 6000

(d)Figure: (a) Individual odd harmonic waves; (b) summation of odd harmonic waves to form asquare wave; (c) sampled signal of a tenor saxophone playing a single note; (d) frequencydistribution of tenor sax found by applying the FFT to the audio signal in (c).

RingModulationRing modulation is a type of amplitude modulation where the input levels of thecarrier and modulation signals are balanced such that the only output are the sumand difference frequencies. The resulting frequencies are almost guaranteed to notbe harmonically related, and ring modulation is often used to simulate the soundsof tuned percussion instruments that produce inharmonic frequency spectra, suchas bells and chimes. In this example, the carrier wave is a square wave of 396 Hz.When the modulating wave is a 1 Hz sine wave, the effect produced is similar tothe carrier wave’s volume changing sinusoidally between the maximum volumeand no volume. When the modulating wave is of a higher frequency or a differentwaveform, the output has more aliasing (distortion) if the modulating wave’sfundamental frequency is ×9/8 (major second) from the carrier, but there is lessdistortion if the modulating wave is ×3/2 (P5) or ×2 (octave) from the carrier.

-1

-0.5

0

0.5

1

0 20000 40000 60000 80000 100000 120000 140000 160000 180000

(a)

-1

-0.5

0

0.5

1

0 20000 40000 60000 80000 100000 120000 140000 160000 180000

(b)Figure: (a) Carrier square wave of 396 Hz; (b) The effect produced after applying a modulatingwave sine wave of 1 Hz.

ConclusionDigital synthesis is a common application in creating or modulating sound formusic. The FFT is incredibly useful for analyzing the frequency spectrum of asignal. These techniques are not restricted to audio signals and can also beapplied in analyzing waves of light got radio communication or infrared imaging.

FutureWorkICreate a phaser effect by implementing an all-pass filter with the z-transform.ICreate a digital delay, which shifts a sequence by a desired amount of samples.ICreate a flanger effect by combining the phaser and delay. The net sound effect

imitates a Doppler shift.

Bibliography

E. Kreyszig.Advanced Engineering Mathematics.Wiley, New York, 10 edition, 2011.

AcknowledgementsThis project was funded by a Faculty Promotion Development Award, 2012-2013,College of Natural Science & Mathematics, CSUS.

http://http://webpages.csus.edu/ zeigler zeigler at csus dot edu