Simple Synthesizer Part 1

Download Report

Transcript Simple Synthesizer Part 1

Simple Synthesizer Part 3
Based on Floss Manuals (Pure Data)
“Building a Simple Synthesizer”
By Derek Holzer
Slides by Denny Lin
Copyright © 2011 by Denny Lin
1
Filters
• Low Pass Filter: Allows frequencies below cutoff
to pass through
• High Pass Filter: Allows frequencies above cutoff
to pass through
• Band Pass Filter: Allows frequencies within a
certain range to pass through; range is specified
by its central frequency and its width is specified
by the resonance value
• Voltage Controlled Filter: Similar to band pass
filter, but the central frequency and resonance
can be controlled by audio signals
Copyright © 2011 by Denny Lin
2
Filters and Subtractive Synthesis
• Subtractive synthesis starts with a sound
that is rich in harmonics, and then
selectively subtract harmonics to get a
desired sound
• Low pass, high pass, band pass, or
voltage controlled filters can be used to
remove undesirable harmonics, and the
gain of the resulting waveforms can be
modulated by an envelope generator
Copyright © 2011 by Denny Lin
3
Phone voice using Subtractive
Synthesis
• The frequency response
of telephones is between
300Hz and 3000Hz
• Can reproduce the sound
characteristics of a
telephone by subtracting
signals outside the
telephone frequency
response
• Effect of filter is
intensified by placing
filters in series
(cascading)
Copyright © 2011 by Denny Lin
4
Envelopes and generators
• Envelopes can be used to describe how a pitch or a sound
amplitude changes over time
• An ADSR generator is often used to control sound amplitude
changes of an oscillator
• The four components in an envelope generator are:
–
–
–
–
Attack
Decay
Sustain
Release
• Some older synthesizers added a Hold component:
– ADSHR (Korg MS-20)
– AHDSR
• ADSR generators can be made from both the line~ and vline~
objects
• Envelopes also be drawn and stored in arrays
Copyright © 2011 by Denny Lin
5
Using the line~ generator
• The line and line~ objects take messages that
have only two numbers:
– Target level
– Time in milliseconds
• New messages will over-ride a ramp in progress
• The audio version of the line object is line~
• Can build ADSR envelopes when used with
delay objects
Copyright © 2011 by Denny Lin
6
ADSR Envelope and line~ messages
Attack
Decay
Sustain Release
DGain
AGain
ADelay ATime DDelay DTime
STime
RTime
Where DElapsed = ADelay + ATime + DDelay
and SElapsed = DElapsed + DTime + STime
trigger bang bang bang
ADelay
DElapsed
SElapsed
AGain ATime
DGain DTime
0 RTime
Copyright © 2011 by Denny Lin
7
An ADSR generator using line~
Copyright © 2011 by Denny Lin
8
Using the vline~ generator
• The vline~ object has three inlets that take three parameters:
– Target level
– TIme in milliseconds
– Delay value
• The left inlet can also take sequences of messages that contain
target, time, and delay values. A sequence of messages can be
used to specify an ADSR envelope
• The message:
– 0.8 1000 5, 0.5 1000 1500, 0 500 3300
– Ramp up to 0.8 in 1000ms after 5ms delay, ramp down to 0.5 in 1000ms
after 1500ms delay, and ramp down to 0 in 500 ms after 3300ms delay
• All delay values are counted from the beginning of the message, so
must take into account elapsed time performing previous
instructions in the message
Copyright © 2011 by Denny Lin
9
ADSR Envelope and vline~ message
Attack
Decay
Sustain Release
DGain
AGain
ADelay
ATime DDelay
DTime
STime
RTime
AGain ATime ADelay, DGain DTime DElapsed, 0 RTime SElapsed
Where DElapsed = ADelay + ATime + DDelay
and SElapsed = DElapsed + DTime + STime
Copyright © 2011 by Denny Lin
10
An ADSR generator using vline~
Copyright © 2011 by Denny Lin
11
Drawing and Storing an Envelope
• An envelope can be
directly drawn by hand in
an array graph
• This patch uses the line~
object to produce x-axis
values from 0 to 99 in 4
seconds
• The audio envelope
controls the amplitude of
the oscillator
Copyright © 2011 by Denny Lin
12
Controlling Sound Amplitude
• A slider can be used to control the gain
when connected to the cold inlet of a
multiplication object; output contains
zipper noise
• Zipper noise can be eliminated using the
line~ object
• Sound amplitude can be controlled by
envelopes generated by line~, vline~, and
read from an array by tabread4~
Copyright © 2011 by Denny Lin
13