Additive Synthesis
Total Page:16
File Type:pdf, Size:1020Kb
Music 171: Additive Synthesis Tamara Smyth, [email protected] Department of Music, University of California, San Diego (UCSD) October 22, 2019 1 Adding Sinusoids at Different Frequencies • Adding sinusoids of the same frequency produces another sinusoid at that frequency (with possibly different amplitude and/or phase). 7 6 5 4 3 2 amplitude (offset) 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. • Adding sinusoids with different frequencies results in a signal that is no longer sinusoidal. But is it periodic? Music 171: Additive Synthesis 2 A Non-Sinusoidal Periodic Signal • If the frequencies of the added sinusoids are integer multiples of the fundamental, the resulting signal will be periodic. 12 10 8 6 4 2 amplitude (offset) 0 −2 −4 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 time (s) Figure 2: Adding sinusoids at 3, 6, 9 Hz produces a periodic signal at 3 Hz. • Sinusoidal components, or partials that are integer multiples of a fundamental are calle harmonics. Music 171: Additive Synthesis 3 Viewing in the Frequency Domain • When viewing in the frequency domain, a “spike” at a frequency indicates there is a sinusoid in the signal at that frequency. 10 8 6 4 2 0 amplitude (offset) −2 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 time (s) 1 0.8 0.6 0.4 magnitude 0.2 0 0 5 10 15 20 25 30 frequency (Hz) Figure 3: Adding sinusoids at 5, 10, 15 Hz in both time and frequency domain. • The height of the spike here, indicates the amplitude (thus 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”. Music 171: Additive Synthesis 4 Periodic Waveforms • A periodic waveform corresponds to a harmonic spectrum, one where sinusoidal components are integer multiples of a fundamental frequency. • Periodic waveforms, or harmonic sounds, may be thought of as those having a pitch. • “Standard” periodic waveforms: square, triangle and sawtooth, can be created using additive synthesis: 1 0.5 0 Amplitude −0.5 −1 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 Time (s) 2 1 0 Amplitude −1 −2 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 Time (s) 2 1 0 Amplitude −1 −2 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 Time (s) Music 171: Additive Synthesis 5 Creating Standard Periodic Waveforms • The following table gives the harmonic number, relative amplitude and phase of the harmonics for standard waveforms. Table 1: Other Simple Waveforms Synthesized by Adding Sinusoids Type Harmonics Amplitude Phase Phase (cosine) (sine) square n = [1, 3, 5, ..., N] 1/n −π/2 0 (odd) triangle n = [1, 3, 5, ..., N] 1/n2 0 π/2 (odd) sawtooth n = [1, 2, 3, ..., N] 1/n −π/2 0 (even and odd) • Notice that the phase differs depending on whether you use a sine or cosine function. Music 171: Additive Synthesis 6 Spectra of Standard Waveforms Square Wave Spectrum 1 0.8 0.6 0.4 Magnitude 0.2 0 0 5 10 15 Frequency (Hz) Triangle Wave Spectrum 1 0.8 0.6 0.4 Magnitude 0.2 0 0 5 10 15 Frequency (Hz) Sawtooth Wave Spectrum 1 0.8 0.6 0.4 Magnitude 0.2 0 0 5 10 15 Frequency (Hz) Figure 4: Spectra of complex waveforms Music 171: Additive Synthesis 7 Harmonics and Pitch • Notice that even though these new waveforms contain more than one frequency component, they are still periodic. • Because the frequencis of components are integer multiples of some fundamental frequency, they are called harmonics. • Signals with harmonic spectra have a fundamental frequency and therefore have a periodic waveform (the reverse is, of course, also true). • Pitch is our subjective response to the fundamental frequency. • The relative amplitudes of the harmonics contribute to the timbre of a sound, but do not necessarily alter the pitch. Music 171: Additive Synthesis 8 Clarinet Analysis • A clarinet is generally considered to be closed-open. • Its tone (shown here in the steady state) can be viewed in both time and frequency domain. 0.15 0.1 0.05 0 −0.05 amplitude −0.1 1.022 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 0.8 435 Hz 732 Hz 0.6 1171 Hz 0.4 1025 Hz magnitude 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 and 732 Hz (as well as others), can approximate a synthesis of the clarinet (in the steady state). Music 171: Additive Synthesis 9 Additive Synthesis • Discrete signals (bandlimited by half the sampling rate) may be represented as the sum of N sinusoids of arbitrary amplitudes, phases, AND frequencies: N x(t)= X Ak cos(ωkt + φk) k=0 • We may therefore, synthesize a sound by setting up a bank of oscillators, each set to the appropriate amplitude, phase and frequency. • The output of each oscillator is added to produce a synthesized sound, and thus the synthesis technique is called additive synthesis. Music 171: Additive Synthesis 10 Additive Synthesis Pros and Cons Pros • Additive synthesis provides the maximum flexibility in the types of sound that can be synthesized. • In certain cases, it can realize tones that are “indistinguishable from real tones.” Cons • It is often necessary to do signal analysis before using additive synthesis to produce specific sounds. • Often requires many oscillators to produce good quality sounds—computationally demanding! • Attacks difficult. • Many functions are useful only for a limited range of pitch and loudness, e.g.: – the timbre of a piano played at A4 is different from one played at A2; – the timbre of a trumpet played loudly is quite different from one played softly at the same pitch. Music 171: Additive Synthesis 11 Modeling Transient Attacks • It is possible to use some knowledge of acoustics to determine functions: – e.g.: higher frequency harmonics are often the last to appear in the attack but the first to decay. – implement using a separate envelope on each harmonic with a steeper attack/decay for lower frequencies. • The duration of the attack and decay greatly influence the quality of a tone: – wind instruments tend to have long attacks, while – percussion instruments tend to have short attacks. Music 171: Additive Synthesis 12 ADSR Envelope • Recall the ADSR envelope (attack, decay, sustain, release) is an envelope that attempts to mimic the behaviour of sound produced by acoustic instruments. 1 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 Figure 6: An ADSR envelope. • Amplitude envelopes can occur on the overal sound or on individual sinusoidal components. Music 171: Additive Synthesis 13 Sinusoid with an ADSR Envelope 2 1 0 −1 Amplitude −2 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 Time (s) 1 0.5 0 Attack Steady State Decay −0.5 Amplitude −1 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 Time (s) 2 1 0 −1 Amplitude −2 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 Time (s) Figure 7: A sinusoid with an amplitude envelope. Music 171: Additive Synthesis 14 Pitch and Frequency • There is a nonlinear relationship between pitch perception and frequency. – e.g., the pitch interval of an octave corresponds to a frequency ratio of 2:1. – thus octaves in higher registers span more frequencies • We will often encounter a pitch notation wich designates a pitch with an octave: C4 is middle C. • The pitch A4 or “A440” is often used as a reference, and is an A at 440 Hz. • What is the frequency one octave below A440? • In equal-tempered tuning, there are 12 evenly spaced tones in an octave, called semi-tones: – The frequency n semitones above A440 is 440 × 2n/12 Hz. – The frequency n semitones below A440 is − 440 × 2 n/12 Hz. Music 171: Additive Synthesis 15.