Adding two sinusoids of the same frequency Spectrum Additive

Adding two sinusoids of the same
frequency
CMPT 468: Additive Synthesis
Tamara Smyth, [email protected]
School of Computing Science,
Simon Fraser University
• Recall, we’ve shown that adding two sinusoids of the
same frequency but with possibly different
amplitudes and phases, produces another sinusoid
at that frequency.
September 17, 2013
3
sin(4πt)
2sin(4πt + π/4)
sum
Amplitude
2
1
0
−1
−2
−3
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 two sinusoids of the same frequency.
• We’ve also shown that every sinusoid can be
expressed as the sum of a sine and cosine function, or
equivalently, an “in-phase” and “phase-quadrature”
component.
1
CMPT 468: Additive Synthesis
Spectrum
Additive Synthesis
• The spectrum of a signal is a graphical representation
of the complex amplitudes, Aejφ, or phasors of its
frequency components.
• It follows that discrete signals (which are bandlimited)
may be represented as the sum of N sinusoids of
arbitrary amplitudes, phases, AND frequencies:
x(t) =
N
X
2
Ak cos(ωk t + φ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.
• 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.”
• It is often necessary to do signal analysis before using
additive synthesis to produce specific sounds.
• Signal analysis allows you to determine the amplitude,
phase and frequency functions for a signal and thus
the technique is also sometimes called Fourier
recomposition.
• The output of each oscillator is added to produce a
synthesized sound, and thus the synthesis technique is
called additive synthesis.
CMPT 468: Additive Synthesis
3
CMPT 468: Additive Synthesis
4
Additive Synthesis Caveat
Amplitude Envelopes
• Drawback: it often requires many oscillators to
produce good quality sounds, and can be very
computationally demanding.
• In his work, On the Sensations of Tone, Hermann von
Helmholtz characterized tones by the way in which
their amplitudes evolved over time, that is, by their
amplitude envelope.
• Also, many functions are useful only for a limited
range of pitch and loudness. For example,
• He described the envelope as having three parts:
– 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.
• It is possible however, to use some knowledge of
acoustics to determine functions. For example:
• 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.
– in specifying amplitude envelopes for each of the
oscillators, it is useful to know that in many
acoustic instruments, the higher harmonics attack
last and decay first.
CMPT 468: Additive Synthesis
1. the attack: the time it takes the sound to rise to
its peak
2. the sustain: the steady state portion of the
sound (where the amplitude has negligiable chane)
3. the decay: the time it take for the sound to
decay or fade out.
5
CMPT 468: Additive Synthesis
ADSR Envelope
6
Sinusoid with an ADSR Envelope
2
Amplitude
• Another envelope, called ADSR (attack, decay,
sustain, release), has a fourth segment inserted
between the attack and the sustain—it attempts to
mimic the envelopes found in acoustic instruments.
1
0
−1
−2
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
Amplitude
Time (s)
1
0.9
1
0.5
Attack
0
Steady State
Decay
−0.5
0.8
−1
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
0.6
0.7
0.8
0.9
1
Time (s)
0.7
2
Amplitude
0.6
0.5
0.4
0.3
1
0
−1
−2
0.2
0
0.1
0.2
0.3
0.4
0.5
Time (s)
0.1
0
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
Figure 3: A sinusoid with an amplitude envelope.
1
Figure 2: An ADSR envelope.
• Amplitude envelopes can occur on the overal sound or
on individual sinusoidal components.
CMPT 468: Additive Synthesis
7
CMPT 468: Additive Synthesis
8
Periodic Waveforms
1
Amplitude
• A periodic waveform corresponds to a harmonic
spectrum, i.e., the spectrum consists of sinusoidal
components that are integer multiples of a
fundamental frequency.
0.5
0
−0.5
−1
• Periodic waveforms, or harmonic sounds, may be
thought of as those to which you may assign a pitch.
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
0.6
0.7
0.8
0.9
1
0.6
0.7
0.8
0.9
1
Time (s)
Amplitude
2
• Different “standard” periodic waveforms can be
created using additive synthesis:
– square
– triangle
– sawtooth
1
0
−1
−2
0
0.1
0.2
0.3
0.4
0.5
Time (s)
Amplitude
2
1
0
−1
−2
0
0.1
0.2
0.3
0.4
0.5
Time (s)
Figure 4: Summing sinusoids to produce other simple waveforms: square, triangle, and
sawtooth
9
Creating Standard Periodic Waveforms
• Standard waveforms are created by summing sinusoids
that have the proper frequency, amplitude and phase
relationships.
• The following table is a recipe for creating standard
waveforms:
CMPT 468: Additive Synthesis
Square Wave Spectrum
1
Amplitude
Phase
(cosine)
0.6
0.4
0
0
5
10
15
Frequency (Hz)
Triangle Wave Spectrum
1
Phase
(sine)
Magnitude
Harmonics
0.8
0.2
Table 1: Other Simple Waveforms Synthesized by Adding Sinusoids
Type
10
Spectra of Standard Waveforms
Magnitude
CMPT 468: Additive Synthesis
0.8
0.6
0.4
0.2
square
n = [1, 3, 5, ..., N]
(odd)
1/n
n = [1, 3, 5, ..., N]
(odd)
1/n2
−π/2
0
0
0
5
10
15
Frequency (Hz)
Sawtooth Wave Spectrum
1
sawtooth
n = [1, 2, 3, ..., N]
(even and odd)
1/n
0
−π/2
π/2
Magnitude
triangle
0
0.8
0.6
0.4
0.2
0
0
5
10
15
Frequency (Hz)
• Notice that the phase differs depending on whether
you use a sine or cosine function.
CMPT 468: Additive Synthesis
Figure 5: Spectra of complex waveforms
11
CMPT 468: Additive Synthesis
12
Harmonics and Pitch
Relating to Acoustics
• Notice that even though these new waveforms contain
more than one frequency component, they are still
periodic.
• Acoustic systems may vibrate at several frequencies,
and for pitched instruments, those frequencies are
(more or less) harmonically related.
• Because each of these frequency components are
integer multiples of some fundamental frequency
f0, they are called harmonics.
• For example, observe the period and corresponding
harmonic number / frequency for pressure waves in
acoustic tubes having
1. OPEN-OPEN (both ends open):
• Signals with harmonic spectra have a fundamental
frequency and therefore have a periodic waveform
(the reverse is, of course, also true).
OPEN−OPEN
PRESSURE VARIATIONS
f
• Pitch is our subjective response to the fundamental
frequency.
2f
3f
4f
2. CLOSED-OPEN (one end closed and the other
open):
• The harmonics contribute to the timbre of a sound,
but do not necessarily alter the pitch.
CLOSED−OPEN
PRESSURE VARIATIONS
f
3f
5f
7f
• To obtain any of these possible harmonics in the
produced sound, the excitation mechanism (e.g.
CMPT 468: Additive Synthesis
13
CMPT 468: Additive Synthesis
14
Pitch
blowing through a mouthpiece), must produce an
input signal that has a sinusoidal component
matching the frequency of that harmonic.
• There is a nonlinear relationship between pitch
perception and frequency.
• Listeners usually compare tones on the basis of the
musical interval separating them. For example, the
pitch interval of an octave corresponds to a frequency
ratio of 2:1.
• We will often encounter a pitch notation wich
designates a pitch with an octave: C4 is middle C.
• We often hear of the pitch A4 as “A440”, or A at 440
Hz. The pitch one octave below, A3 is therefore 220
Hz.
• In equal tempered tuning, there are 12 evenly spaced
tones in an octave, called semi-tones.
• How do you calculate the pitch 1 semitone above
A440?
CMPT 468: Additive Synthesis
15
CMPT 468: Additive Synthesis
16