Subtractive Synthesis
Opposite of additive synthesis
Start with an audio signal with an equal amount of energy at all frequencies (white noise)
Use filters to remove frequency components from original audio signal to create desired signal
Filtering in the Frequency Domain
Let X[Z] be a signal expressed in the complex frequency domain
The process of filtering is equivalent to multiplying the signal X[Z] by some filtering signal H[Z] to generate a new signal Y[Z]: Y[Z]=X[Z]H[Z].
Filtering in the Time Domain
In the time domain, the filtering process is expressed as convolution.
A time signal x[n] filtered by a filter defined by impulse response h[n] yields a new signal y[n]: y[n] = x[n] * y[n]. (* represents convolution here, not multiplication)
h[n] (the impulse response) is the output of the filter in the time domain when fed a signal of {1,0,0,0,...}, that is, a single impulse and then no other input.
Convolution
Given: x[] = original waveform, h[] = impulse response of filter
Output signal after filtering is y[j] = x[j] * h[j] = SUMm=0...j(x[m]h[j-m]) for j=0,1,...
Example: x[n] = {2, 2, 3, 3, 4}, h[n] = {1, 1, 2}. Thus, y[n] = {2, 4, 9, 10, 13, 10, 8}.
Digital Filter Properties
Linearity: If filter output for input signal x1[n] is y1[n] and output for input signal x2[n] is y2[n], then the output for input Ax1[n] + Bx2[n] is Ay1[n] + By2[n].
Causal: A filter's output is only dependent on past and present inputs.
Time invariance: The response of a filter does not change as time goes by.
Recursive: Some output of the filter is fed back into the filter to determine future outputs.
Digital Filter Equation
If a filter is linear, causal and
time-invariant, it can be described by the equation:
y[n] =
SUMi=0..M(aix[n-i])
-
SUMi=1..N(biy[n-i])
The response of any digital filter can be characterized by its complex transfer function H[Z].
If we know the transfer function H[Z] of a filter, we can calculate the Z-transform of its response to any signal by multiplying H[Z] by the Z-transform of the input signal.
The Z Transform
Given a discrete waveform x[n] defined for all values of n, its Z-transform is defined as X[Z] = SUMn=-inf...inf(x[n]Z-n) where Z is a complex variable and inf is infinity.
Z-1 is the unit sample operator (represents one unit of delay)
H[Z] = Y[Z]/X[Z]
Z Transform is a more general case of the Fourier transform (replace Z with eiw and what do you get?
x[n-k] <==> Z-kX[Z]
Poles and Zeroes of a Filter
Take the Z transform of the digital filter equation and solve for H[Z].
Y[Z] = SUMi=0..M(aiz-iX[Z]) - SUMi=1..N(biz-iY[Z])
H[Z] = Y[Z]/X[Z] =
(a0 +
a1Z-1
+ ... +
aMZ-M)/(1
+
b1Z-1
+ ... +
bNZ-N)
= a0(PRODi=1..M (1 -
ziZ-1)/PRODi=1..N(1
-
piZ-1)
zi represent zeroes, pi represent poles
Zeroes cause H[Z] to become zero - these represent frequencies that are attenuated (weakened) as they pass through the filter
Poles cause H[Z] to become infinite - these represent frequencies that are amplified (strengthened) as they pass through the filter
Filter Example
Filter equation: y[n] = x[n] + 0.8y[n-1]
Take Z transform: Y[Z] = X[Z] + 0.8Z-1Y[Z]
Solve for H[Z] = Y[Z]/X[Z] = 1/(1 - 0.8Z-1)
Plot H[eiw] for w=0..pi for frequency response of filter from f=0 to f=R/2.
Program filter.cpp
Set zeroes and poles of the filter (amplitude and phase), number of zeroes and poles (M,N) and number of calculation points (K)
Plot resulting list of numbers to yield frequency response curve of filter.
Program also displays H[Z] equation: From this, you can derive original filter equation for y[n].
Csound Noise Sources
ar rand xamp
Generates a uniform random sequence of data values between -xamp and
xamp
ar buzz xamp, xcps, knh,
ifn
Generates a set of knh equal-strength harmonic partials, beginning with
the
fundamental frequency (xcps), whose combined amplitude is xamp. ifn is the
function table number for a sine wave.
Types of Filters
Lowpass - weakens high frequencies
Highpass - weakens low frequencies
Bandpass - weakens frequencies outside of a specified bandwidth of frequencies
Band-reject - opposite of bandpass filter
Filters In Csound
ar tone asig, khp
First order recursive lowpass filter
ar atone asig, khp
First order recursive highpass filter
asig = original audio signal, khp = half-power point (frequency where filter causes power of signal to be reduced by a factor of 2)
ar reson asig, kcf, kbw,
kscl
Second order bandpass filter
ar areson asig, kcf, kbw,
kscl
Second order band-reject filter
asig = original audio signal
kcp = center frequency of filter
kbw = bandwidth (between half-power points)
kscl = scale factor (1 means peak output = 1)
Csound example (subtractive synthesis using white noise)
; p4 = noise amp, p5 = peak bw, p6 = rate of bandwidth open
and close
instr 1
a1 rand p4
k1 oscil p5, p6, 1
a2 tone a1, kl
out a2
endin
f1 0 1024 8 0 256 0.5 256 1 256 0.5 256 0 ; in score
(GEN08 - generates a cubic spline point through endpoints; smooth curve, no discontinuities)
Csound example (subtractive synthesis using pink noise)
; p4 = note amp, p5 = note fundamental frequency
instr 1
a1 buzz p4, p5, 6, 1
a2 reson a1, p5, p5/2
a3 reson a1, 3*p5, p5/2
a4 reson a1, 5*p5, p5/2
a5 balance a2+a3+a4, a1 ; equalize power with original signal
out a5
endin
f1 0 8192 10 1 ; in score
COURSE
INFORMATION | HOMEWORK ASSIGNMENTS
COURSE PROJECT
| CS240 HELP
DESK