Adding Sinusoids at Different Frequencies Music 175: Spectrum Tamara Smyth, trsmyth@ucsd.edu Department of Music, University of California, San Diego (UCSD) 7 6 April 5, 2016 amplitude (offset) 5 4 3 2 1 0 −1 −2 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 time (s) Figure 1: Adding 2 sinusoids at different frequencies. • When adding sinusoids at different frequencies, the resulting signal is no longer sinusoidal. • But is it periodic? 1 Music 175: Spectrum A Non-Sinusoidal Periodic Signal 2 Spectrum: Viewing in the Frequency Domain • If the frequencies of the added sinusoids are integer multiples of the fundamental, the resulting signal will be periodic. • When viewing in the frequency domain, a “spike” at a frequency indicates there is a sinusoid in the signal at that frequency. amplitude (offset) 12 10 6 8 6 4 2 0 −2 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 time (s) 4 1 2 0.8 magnitude amplitude (offset) 8 10 0 0.6 0.4 0.2 −2 0 −4 0 5 10 15 20 25 30 frequency (Hz) 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 time (s) Figure 3: Adding sinusoids at 5, 10, 15 Hz in both time and frequency domain. Figure 2: Adding sinusoids at 3, 6, 9 Hz produces a periodic signal at 3 Hz. • The height of the spike indicates the amplitude—all sinusoids here have a peak amplitude of 1. • The harmonic relationship between the partials can be seen by the even spacing between the “spikes”. • Sinusoidal components, or partials that are integer multiples of a fundamental are calle harmonics. Music 175: Spectrum 3 Music 175: Spectrum 4 Standard Periodic Waveforms Spectra of Standard Waveforms • square, triangle and sawtooth by adding sinusoids. Square Wave Spectrum Magnitude 1 Amplitude 1 0.5 0 −0.5 −1 0.8 0.6 0.4 0.2 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 0 Time (s) 0 5 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 Time (s) Amplitude 2 1 0.8 0.6 0.4 0.2 0 0 −1 −2 15 1 0 −1 Magnitude Amplitude 1 −2 10 Frequency (Hz) Triangle Wave Spectrum 2 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 0 5 10 15 Frequency (Hz) Sawtooth Wave Spectrum 1 Time (s) Magnitude 1 Table 1: Standard Waveforms Synthesized by Adding Sinusoids Type Harmonics Amplitude Phase (cos) Phase (sin) square n = [1, 3, 5, ..., N] 1/n −π/2 0 triangle n = [1, 3, 5, ..., N] 1/n2 0 π/2 sawtooth n = [1, 2, 3, ..., N] 1/n −π/2 0 0.8 0.6 0.4 0.2 0 0 5 10 15 Frequency (Hz) Music 175: Spectrum Figure 4: Spectra of complex waveforms 5 Music 175: Spectrum Harmonics and Pitch 6 Missing Fundamental • Notice that even though these new waveforms contain more than one frequency component, they are still periodic. Square wave (up to 7th harmonic) 1 0.8 0.6 0.4 • Because each of these frequency components are integer multiples of some fundamental frequency, they are called harmonics. 0.2 0 200 400 600 800 1000 1200 1400 1600 1800 2000 Square wave (up to 7th harmonic) with MISSING FUNDAMENTAL • Signals with harmonic spectra have a fundamental frequency and therefore have a periodic waveform (the reverse is, of course, also true). 1 0.8 0.6 • Pitch is our subjective response to the fundamental frequency. 0.4 0.2 0 • The relative amplitudes of the harmonics contribute to the timbre of a sound, but do not necessarily alter the pitch. 200 400 600 800 1000 1200 1400 1600 1800 2000 Frequency (Hz) • Listen to: – square wave: squaref0.wav: – square wave, NO fundamental: squareNOf0.wav: • harmocity.pd • Does the sense of pitch change? How about timbre? Music 175: Spectrum 7 Music 175: Spectrum 8 Inharmonicity Clarinet Analysis • The (steady-state) tone of clarinet, mostly closed-open, is sone in time and frequency domain. • Generally, inharmonic overtones lack a clear sense of pitch (difficult to hum). • The perception of pitch 0.15 0.1 amplitude – may vary with individuals; – tends to be clearer when notes are played in succession (particularly with inharmonic tones). 0.05 0 −0.05 −0.1 1.022 • Listen to: 1.024 1.026 1.028 1.03 1.032 1.034 1.036 1.038 1.04 1.042 time (s) 145 Hz 1 – bellsclip.wav: bell in isolation—pitch? – bells.wav: bells in melodic context—pitch? • The context allows us to focus on the change in notes rather than on any one note itself. magnitude 0.8 732 Hz 435 Hz 0.6 1171 Hz 0.4 1025 Hz 0.2 0 0 200 400 600 800 1000 1200 1400 1600 1800 2000 frequency (Hz) Figure 5: Frequency analysis of a clarinet note. • Summing sinusoids at 145, 433, 732, ..., can approximate a steady-state synthesis of the clarinet: – BbClar.ff.D3.wav – clarsynth.wav – clarSteadyState.wav Music 175: Spectrum 9 Music 175: Spectrum 0.15 1 0.1 0.8 magnitude tenor sax: amplitude Harmonicity and Pitch 0.05 0 −0.05 −0.1 9.08 9.085 0.4 0 9.09 magnitude amplitude 0.4 0.2 0 −0.2 0.23 0.235 0.24 • There is a nonlinear relationship between pitch perception and frequency in Hz: 0 500 1000 1500 2000 frequency (Hz) – an octave above 220 Hz is an increase of 220 Hz; – an octave above 440 Hz is an increase of 440 Hz. 1 • In equal-tempered tuning, there are 12 evenly spaced tones in an octave, called semi-tones: 0.8 0.5 magnitude amplitude • An octave (P8) corresponds to a doubling of frequency. 0.4 0 0.245 1 0 −0.5 0.6 0.4 – The frequency n semitones above A440 is 0.2 0 0.005 0.01 0.015 0 0.02 0 time (s) 500 1000 1500 2000 frequency (Hz) 0.3 440 × 2n/12 Hz. 1 0.2 0.8 magnitude amplitude 2000 0.6 time (s) 0.1 0 −0.1 −0.2 – The frequency n semitones below A440 is 0.6 0.4 440 × 2−n/12 Hz. 0.2 −0.3 0.02 0.025 0.03 time (s) Music 175: Spectrum 1500 0.2 −0.6 −0.4 1000 0.8 −0.4 Thunder: 500 1 0.6 −1 0 frequency (Hz) 0.8 Snare Drum: • Listeners usually compare tones on the basis of the musical interval separating them: m3, P5, P8 etc. 0.6 time (s) Japanese Bell: Pitch and Frequency 0.2 9.075 10 0.035 0 0 500 1000 1500 2000 • pitchFreq.pd frequency (Hz) 11 Music 175: Spectrum 12 Beat Notes • What happens when we add two frequencies that are close in frequency? 2 1.5 1 0.5 0 210 212 214 216 218 220 222 224 226 228 230 0.45 0.5 Frequency (Hz) Beat Note (f0 = 220 Hz, 2Hz envelope) 2 1 0 −1 −2 0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 Time (s) • The waveform shows a periodic, low frequency amplitude envelope superimposed on a higher frequency sinusoid creating a beat note. • This can be explained by the Cosine Product formula: cos(a + b) + cos(a − b) cos(a) cos(b) = 2 Music 175: Spectrum 13