Source-based synthesis approaches and physical modeling 2 · An excerpt from Dialodiadi by Diego...

Post on 25-Dec-2019

1 views 0 download

transcript

1

Source-based synthesis approaches and physical modeling 2

source Models 3.3 ..

Oscillations, propagation, delays The Karplus-Strong algorithm

2

Plucked strings

After the pluck, the string vibrates freely Spectrum is almost harmonic

Partials decay exponentially in time Decay time depends on frequency Lowest partials “survive” longer

3

4

3.3.1. IIR Comb filter

comb filter

Poles

Harmonic spectrum with fundamental at f0=Fs/ m Hz resembles spectrum of a string with dissipation if Fs=44.1 kHz, m=100

f0=441 Hz

IIR comb filter

“Pseudo-physical” interpretation Perturbation propagates into the string Gets reflected at the borders with dissipation (0<g<1) Fundamental frequency depends on string length, i.e. on path covered by the perturbation, i.e. on delay m

In case of different “boundary condition”, e.g. negative reflection (-1<g<0)

Poles:

Harmonic spectrum, partials are only odd multiples of fundamental frequency f0=Fs/ 2m Hz

5

IIR comb filter

Problem: dissipation is independent on frequency same decay for all partials because poles are all at the same distance from the unit circle

6

Low-pass comb filter

7

Insert a low-pass filter into the loop, e.g., a first-order FIR low-pass

at each passage the high-frequency components are attenuated more strongly than low-frequencies components introduces frequency-dependent decay introduces an additional half-sample delay, too!

Pitch: f0=Fs/ (m+0.5) Hz if Fs=44.1 kHz, m=100

f0≈439 Hz

https://ccrma.stanford.edu/~jos/Mohonk05/Karplus_Strong_Algorithm.html

Karplus strong algorithm

First published in 1983 (Computer Music Journal) Uses low-pass comb filter as main computational structure

Free evolution of the filter after impulse or random initial state

Control parameters Fundamental frequency (filter parameter m) Decay-time (filter parameter g)

8

Improving KS: fractional delays

Problem: string length and f0 are quantized (delays are integers) fixed (cannot be varied smoothly in time)

Solution: “fractional-delay” filter replacing z-m

should have ideally flat response should have ideally linear phase response with slope τ (then constant phase delay τ)

Several approximate filter designs available

FIR: Lagrange filters IIR: Thiran filters … we skip the topic

9

Karplus-Strong algorithm: physical interpretation

10

3.2.2 Sound propagation in elastic media

D’ 'Alembert equation

Ideal string y is transversal displacement given tension T, and density µ,

then c = (T/µ)1/2 is wave speed inside the string Ideal (cylindrical) bores

y is acoustic pressure inside the bore c is sound speed in air

2D or 3D media x is a vector of coordinates

11

T

µ

12

The Wave Equation: ideal string

Restorative Force = Inertial Force y(x,t) = string displacement T = tension force μ = mass per unit length

c2 = T / μ c = speed of propagation

T

µ

13

The Wave Equation: ideal cylindrical bore

Same wave equation applies to other elastic media. E.g., Air column of clarinet (cylindrical):

Displacement y -> Air pressure deviation (p) Transverse Velocity -> Longitudinal volume velocity of air in the bore (u) speed of propagation: c

3D equation:

where

D'Alembert equation and waves

Factorization

Solution:

Two functions – traveling waves – that translate rigidly with velocity c, with two opposite directions

y+(t) right-going, y-(t) left-going. Shapes of the waves y+, y- are determined by initial conditions, e.g.

Wave impedance: string: Z0 = sqrt (T μ) = T / c tube: Z0 = ρc / A

14

15

Traveling Wave Solution

E.g., plucked string:

Boundary conditions

Solution at the boundary of the spatial domain is constrained e.g.: ideal string fixed at both ends, x=0 and x=L

16 fixed end free end

KS and D'Alembert solution

Output y[n] is a traveling wave in response to input x[n] Boundary conditions

Fixed-Fixed: two negative reflections (y changes sign) at the two ends. Then y does not change sign in a whole loop

e.g., string fixed at both ends. Harmonic spectrum with all partials Fixed-Free: negative reflection at one end, positive at the other end. Then y changes sign in a whole loop

e.g., acoustical bore open at one end and closed at the other end (like in a clarinet). Harmonic spectrum with odd partials only

Parameters Coefficient g (or low-pass filter Hlp): correction to D'Alembert equation accounting for dissipation Delay m:

depends on string length: 2L=c mTs

17

18

Physical interpretation of Karplus-Strong

Delay line is initialized with noise (random numbers) Therefore, assuming a displacement-wave simulation (y+, y-):

Initial string displacement = sum of delay-line halves Initial string velocity determined by the difference of delay-line halves

The Karplus-Strong “string" is thus plucked and struck by random amounts along the entire length of the string Karplus-Strong feedback filter corresponds to the simplest possible damping filter for an ideal string

Distributed elements, resonators: Waveguide models

chapt. 3.4

19

History

1962: Kelly-Lochbaum model of the vocal tract Based on delay lines, “transmission-line modeling”

1983: First formulation of Karplus-Strong algorithm 1985: Julius O. Smith III research at Stanford University

Extensions of KS and definition of “waveguide modeling” Several patents

1990s: first generation of synthesizers based on physical models, particularly waveguide models

Yamaha VL1, EX5, Korg Prophecy, Z1, … 2000s: improvements and multi-dimensional generalizations Today: Less popular, still used for specific models

More popular approaches: time-stepping methods (finite difference or finite element simulations): see e.g. http://www.ness-music.eu/

20

Wave variables and delay lines

Space-time discretization of the D'Alembert solution acoustic pressure in bore, or force/displacement of string

Time sampling period Ts , space sampling step: Xs= cTs Xs is the distance sound propagates in one time sampling period Ts substituting:

21

22

Digital Waveguide Solution

Digital Waveguide (Smith 1987). Constructs the solution using DSP. From continuous solution:

y(t,x) = y+(ct-x) + y-(ct+x) Sampled solution is:

T, X = time, space sample size T = X / c x = m X t = n T

y(nT, mX) = y+[n-m] + y-[n+m] wave variables:

y+[n] = y+ (nT) y-[n] = y- (nT)

23

Waveguide DSP Model

Two-rail model

Signal is sum of rails at a point.

24

More Compact Representation

Only need to evaluate it at certain points. Lump delay filters together between these points. Bore (or string) length L= m Xs

can be generalized to any L using fractional delays

Conical bores

A very similar structure can be outlined for numerically simulating a pressure distribution in an ideal lossless conical bore Spherical propagation (in spherical coordinates)

substituting

25

26

Wave variables vs. Kirchhoff variables

wave equation (bore): both pressure and volume velocity

wave impedance Z0 relates pressure and volume velocity waves

wave var. è Kirchhoff var.

Kirchhoff var. è wave var.

These results provide the basis for developing 1-D waveguide structures.

27

Wave variables vs. Kirchhoff variables

string: force and velocity wave variables

wave impedance Z0

wave var. è Kirchhoff var.

Kirchhoff var. è wave var.

Boundary conditions and reflections

Boundary conditions for “Kirchhoff” variables (string force, velocity; bore pressure, flow) turn into reflection conditions for wave variables

String Fixed termination (v=0) => v+= - v-, f+= f- (velocity, force) Free termination: the opposite

Bore Closed termination (u=0) => u+= - u-, p+= p- (flow, pressure) Open termination (p=0): the opposite => u+= u-, p+= - p-

Then reflections are multiplications by -1 or +1

28

string fixed termination

string free termination

29

Boundary conditions

Rigid terminations Ideal reflection.

Lossy terminations Reflection plus frequency-dependent attenuation.

30

Example: tube

closed in x=0 u(0,n) = 0 = u+(0,n) + u-(0,n) = [p+(0,n) - p-(0,n)] / Z0

p+(0,n) = p-(0,n) open in x=L

p(L,n) = 0 = p+(L,n) + p-(L,n) p-(L,n) = - p+(L,n)

1 -1

p+(L,n)

p-(L,n)

p+(0,n)

p-(0,n)

closed termination

open termination

31

Reflection

Radiating impedance ZR in x=L p(L,n) = ZR u(L,n)

substituting wave variables: p+(L,n) + p-(L,n) = ZR [p+(L,n) + p-(L,n)] / Z0

Outgoing wave as function of incoming wave: p-(L,n) = R p+(L,n)

with R = [ZR - Z0 ] / [ZR + Z0 ] R(z)

example: Karplus Strong R = g or R = g Hlp

1 R

p+(L,n)

p-(L,n)

p+(0,n)

p-(0,n)

closed termination

ZR

impedance termination

3.4.2 Propagation in non-ideal media

Dissipation energy dissipated by air, internal material losses, non-ideal terminations (e.g. transmitted by string to piano soundboard)

Dispersion wave speed is a function of frequency

Both modeled by including appropriate filters example: closed-closed cylindrical bore with dissipation and dispersion

32

Dissipation

Simplest approximation: Solution for small d1 (frequency independent dissipation):

More accurate approximation

term d2: frequency-dependent dissipation constant g replaced by low-pass filter Hloss(z) Many techniques to estimate Hloss from real sounds

33

z− m

− mp− [n]

H H

p+[n]

p [m,n]p [0,n]

zdisp loss

1 1

34

Dissipation: Lossy Wave Equation

Losses due to yielding termination drag by surrounding air internal friction

Lossy wave equation Ky’’ = µ ÿ + ε ∂y/∂t

Traveling wave solution

with

35

Lossy Wave Equation

DSP model

Group losses and delays.

36

Dispersion

Stiffness of the string introduces another restorative force.

For small ϵ:

waves are dispersed during propagation Partials are not harmonic anymore

Inharmonicity index

e.g. piano strings: stiffness increase the frequency of higher harmonics

Unit delays substituted by all-pass filter Hdisp: phase delay matches frequency dependent speed Many techniques to estimate Hdisp from real sounds

37

Dispersion simulation

Consolidating

example without and with dispersion

z− m

− mp− [n]

H H

p+[n]

p [m,n]p [0,n]

zdisp loss

1 1

38

Waveguide models examples

Waveguide String Sound Example: Mandolin

Waveguide Wind Sound Example: Clarinet

http://soundlab.cs.princeton.edu/learning/tutorials/phys.html

Examples: Commuted synthesis

Instrumental timbre given by its “body” Soundboard in piano, body of guitar, violin, …

Commuted synthesis (early 2000s): excitation, string, body Excitation E(z) and body response B(z) can be sampled Body and string can be commuted (it's all linear) “Aggregate” excitation A(z)=E(z)B(z) fed into waveguide string model

Works well only for plucked strings

39

Examples

(overview only)

40

41

A musical example

An excerpt from Dialodiadi by Diego Dall’Osto for flute, clarinet and electronics, 1995 The synthetic sounds are realized using a commercial physical model synthesizer (Yamaha VL1)

synthetic flute and clarinet dynamic control of air pressure, embouchure, vibrato etc.

In the excerpt we have a dialog between real and synthetic clarinet, exploring new performance models

Wind instrument

Scattering junction computes outgoing waves as function of incoming waves and inputs (in Kirchhoff variables)

42

43

Bowed string

Scattering junction computes outgoing waves as function of inputs and incoming wave

Similar structure for hammer - string interaction in pianos Piano Piano with strongly non linear bridge

https://ccrma.stanford.edu/~jos/pasp/Sound_Examples.html

44

Non linear elements

e.g. clarinet, quasi static reed model flow depends of pressure difference Δp = pm - p = pm- (p+ + p-)

  u = f(Δp) substituting wave variable

u = (p+ - p-) / Z0 solving for p-

p- = g(p+, pm)

p+ - p- = Z0 f [pm- (p+ + p-)]

p- = g(p+)

u = f(Δp)

45

Example: piano

Piano M is the mass of hammer, q(t) position of the hammer at the contact point, f0(t) force applied by performer, fq(t) reaction force of the string, s(t) position of the string at the contact poin h(t) = q(t) - s(t) felt compression

felt nonlinearity M

h

q

s

46

Piano

hammer string trajectories

47

Guitar: non linear overdrive

Soft clipping

Simulation of a basic distorted electric guitar with amplifier feedback the amplified guitar waveforms couple back to the strings with some gain and delay