44

Aerophones in Flatland - microsoft.com · GPU Implementation R G B A 𝑝 𝐯 𝐯 state Per Fragment 𝒗 𝑝 𝒗 𝒗 𝑝 𝒗 State structure stores: • 𝛽value (boundary-ness)

  • Upload
    others

  • View
    5

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Aerophones in Flatland - microsoft.com · GPU Implementation R G B A 𝑝 𝐯 𝐯 state Per Fragment 𝒗 𝑝 𝒗 𝒗 𝑝 𝒗 State structure stores: • 𝛽value (boundary-ness)
Page 2: Aerophones in Flatland - microsoft.com · GPU Implementation R G B A 𝑝 𝐯 𝐯 state Per Fragment 𝒗 𝑝 𝒗 𝒗 𝑝 𝒗 State structure stores: • 𝛽value (boundary-ness)

Aerophones in FlatlandInteractive Wave Simulation of Wind Instruments

Andrew Allen

Nikunj Raghuvanshi

Page 3: Aerophones in Flatland - microsoft.com · GPU Implementation R G B A 𝑝 𝐯 𝐯 state Per Fragment 𝒗 𝑝 𝒗 𝒗 𝑝 𝒗 State structure stores: • 𝛽value (boundary-ness)

Spectrogram

Simulation Domain

Mouthpiece

Page 4: Aerophones in Flatland - microsoft.com · GPU Implementation R G B A 𝑝 𝐯 𝐯 state Per Fragment 𝒗 𝑝 𝒗 𝒗 𝑝 𝒗 State structure stores: • 𝛽value (boundary-ness)

Wind Instruments

BellMouthpiece Bore, Toneholes

reedmouth bore

Non-linear Linear

Feedback

Resonant Cavity

Page 5: Aerophones in Flatland - microsoft.com · GPU Implementation R G B A 𝑝 𝐯 𝐯 state Per Fragment 𝒗 𝑝 𝒗 𝒗 𝑝 𝒗 State structure stores: • 𝛽value (boundary-ness)

Excitation models: Single Reed (Clarinet)

Dalmont, J.P., Gilbert J., and Ollivier, S. 2003.

Page 6: Aerophones in Flatland - microsoft.com · GPU Implementation R G B A 𝑝 𝐯 𝐯 state Per Fragment 𝒗 𝑝 𝒗 𝒗 𝑝 𝒗 State structure stores: • 𝛽value (boundary-ness)

Excitation models: Lips (Trumpet)

Adachi and Sato. 1996.

Page 7: Aerophones in Flatland - microsoft.com · GPU Implementation R G B A 𝑝 𝐯 𝐯 state Per Fragment 𝒗 𝑝 𝒗 𝒗 𝑝 𝒗 State structure stores: • 𝛽value (boundary-ness)

Excitation models: Air Jet (Flute)

de La Cuadra. 2006.

Page 8: Aerophones in Flatland - microsoft.com · GPU Implementation R G B A 𝑝 𝐯 𝐯 state Per Fragment 𝒗 𝑝 𝒗 𝒗 𝑝 𝒗 State structure stores: • 𝛽value (boundary-ness)

Bell

Realtime synthesis: Digital Waveguides

Bell radiation

Mouthpiece Bore

breath pressure

+shift

shift

+

× Bell reflection

SMITH, JULIUS O. 2010. Physical Audio Signal Processing.

http://ccrma.stanford.edu/˜jos/pasp/

(online book, accessed Jan 2014).

Page 9: Aerophones in Flatland - microsoft.com · GPU Implementation R G B A 𝑝 𝐯 𝐯 state Per Fragment 𝒗 𝑝 𝒗 𝒗 𝑝 𝒗 State structure stores: • 𝛽value (boundary-ness)

Bell

Realtime synthesis: Digital Waveguides

Bell radiation

Mouthpiece Bore

breath

+shift

shift

+

×

Non-linear

excitation model

Bell reflection

= frequency-dependent filter

Page 10: Aerophones in Flatland - microsoft.com · GPU Implementation R G B A 𝑝 𝐯 𝐯 state Per Fragment 𝒗 𝑝 𝒗 𝒗 𝑝 𝒗 State structure stores: • 𝛽value (boundary-ness)

Bell

Realtime synthesis: Digital Waveguides

Bell radiation

Mouthpiece Bore

breath

+

Tonehole

radiation

Tonehole

reflection

Tonehole

shift

shift

+

×

Non-linear

excitation model

Bell reflection

Tonehole

radiation

Tonehole

reflection

Tonehole

= frequency-dependent filter

Page 11: Aerophones in Flatland - microsoft.com · GPU Implementation R G B A 𝑝 𝐯 𝐯 state Per Fragment 𝒗 𝑝 𝒗 𝒗 𝑝 𝒗 State structure stores: • 𝛽value (boundary-ness)

Bell

Our approach

Bell radiation

breath pressure

Tonehole

radiation

Tonehole

reflection

shift

shift

Bell reflection

Tonehole

radiation

Tonehole

reflection

2D wave simulation on GPU

Mouthpiece Bore

Color = pressure

Borrow and adapt

Non-linear

excitation model

+

+

×

Non-linear

excitation model

Page 12: Aerophones in Flatland - microsoft.com · GPU Implementation R G B A 𝑝 𝐯 𝐯 state Per Fragment 𝒗 𝑝 𝒗 𝒗 𝑝 𝒗 State structure stores: • 𝛽value (boundary-ness)
Page 13: Aerophones in Flatland - microsoft.com · GPU Implementation R G B A 𝑝 𝐯 𝐯 state Per Fragment 𝒗 𝑝 𝒗 𝒗 𝑝 𝒗 State structure stores: • 𝛽value (boundary-ness)
Page 14: Aerophones in Flatland - microsoft.com · GPU Implementation R G B A 𝑝 𝐯 𝐯 state Per Fragment 𝒗 𝑝 𝒗 𝒗 𝑝 𝒗 State structure stores: • 𝛽value (boundary-ness)

Advantages

• Signal processing networks require expertise to design and ensure physical plausibility.

• Geometric manipulation is intuitive.

• Guaranteed physical plausibility.

• Lower expertise bar for musical experimentation.

Page 15: Aerophones in Flatland - microsoft.com · GPU Implementation R G B A 𝑝 𝐯 𝐯 state Per Fragment 𝒗 𝑝 𝒗 𝒗 𝑝 𝒗 State structure stores: • 𝛽value (boundary-ness)

Challenges

• System is driven non-linearly and has perceptually salient transients (note beginnings/ends).

• Direct time-domain finite-difference solution.

• Standard finite difference generates artifacts on changing geometry.

• Need millimeter-scale resolution.

• Numerical stability requires small time-steps for wave equation.

• ~3.8mm resolution at 128,000Hz on the GPU.

Page 16: Aerophones in Flatland - microsoft.com · GPU Implementation R G B A 𝑝 𝐯 𝐯 state Per Fragment 𝒗 𝑝 𝒗 𝒗 𝑝 𝒗 State structure stores: • 𝛽value (boundary-ness)

Linear Wave Equation

𝜕𝑝

𝜕𝑡+ 𝜎′𝑝 = −𝜌𝑐2𝛻 ∙ 𝐯

𝛽𝜕𝐯

𝜕𝑡+ 𝜎′𝐯 = 𝛽2

−𝛻𝑝

𝜌+ 𝜎′𝐯𝑏

(𝜎′ = 1 + 𝛽 − 𝜎)

Page 17: Aerophones in Flatland - microsoft.com · GPU Implementation R G B A 𝑝 𝐯 𝐯 state Per Fragment 𝒗 𝑝 𝒗 𝒗 𝑝 𝒗 State structure stores: • 𝛽value (boundary-ness)

Perfectly matched layer (PML)

𝜕𝑝

𝜕𝑡+ 𝜎′𝑝 = −𝜌𝑐2𝛻 ∙ 𝐯

𝛽𝜕𝐯

𝜕𝑡+ 𝜎′𝐯 = 𝛽2

−𝛻𝑝

𝜌+ 𝜎′𝐯𝑏

(𝜎′ = 1 + 𝛽 − 𝜎) 𝜎 ≠ 0

𝜎 = 0

Page 18: Aerophones in Flatland - microsoft.com · GPU Implementation R G B A 𝑝 𝐯 𝐯 state Per Fragment 𝒗 𝑝 𝒗 𝒗 𝑝 𝒗 State structure stores: • 𝛽value (boundary-ness)

Dynamic Geometry

Tone Holes, Valves, Slides, Mutes

Page 19: Aerophones in Flatland - microsoft.com · GPU Implementation R G B A 𝑝 𝐯 𝐯 state Per Fragment 𝒗 𝑝 𝒗 𝒗 𝑝 𝒗 State structure stores: • 𝛽value (boundary-ness)

Abrupt geometric changes: clicks

Page 20: Aerophones in Flatland - microsoft.com · GPU Implementation R G B A 𝑝 𝐯 𝐯 state Per Fragment 𝒗 𝑝 𝒗 𝒗 𝑝 𝒗 State structure stores: • 𝛽value (boundary-ness)

Our formulation (time-varying PML)

• 𝛽(𝒙, 𝑡) ∈ [0,1] introduces smoothly-varying dynamic geometry.

• 𝐯𝑏 enforces boundary conditions and input flow from mouthpiece.

• Handles all phenomena we model.

𝜕𝑝

𝜕𝑡+ (1 − 𝛽 + 𝜎)𝑝 = −𝜌𝑐2𝛻 ∙ 𝐯

𝛽𝜕𝐯

𝜕𝑡+ 1 − 𝛽 + 𝜎 𝐯 = 𝛽2

−𝛻𝑝

𝜌+ (1 − 𝛽 + 𝜎)𝐯𝑏

Page 21: Aerophones in Flatland - microsoft.com · GPU Implementation R G B A 𝑝 𝐯 𝐯 state Per Fragment 𝒗 𝑝 𝒗 𝒗 𝑝 𝒗 State structure stores: • 𝛽value (boundary-ness)

Our formulation (time-varying PML)

𝛽𝜕𝐯

𝜕𝑡+ 1 − 𝛽 + 𝜎 𝐯 = 𝛽2

−𝛻𝑝

𝜌+ 1 − 𝛽 + 𝜎 𝐯𝑏

𝛽𝜕𝐯

𝜕𝑡+ 1 − 𝛽 + 𝜎 𝐯 = 𝛽2

−𝛻𝑝

𝜌+ 1 − 𝛽 + 𝜎 𝐯𝑏

𝛽 = 1: Air

𝛽𝜕𝐯

𝜕𝑡+ 1 − 𝛽 + 𝜎 𝐯 = 𝛽2

−𝛻𝑝

𝜌+ 1 − 𝛽 + 𝜎 𝐯𝑏

𝛽 = 0: Boundary

Smoothly interpolates

between Boundary and

Air state in every cell(𝜎 = 0 inside domain)

Page 22: Aerophones in Flatland - microsoft.com · GPU Implementation R G B A 𝑝 𝐯 𝐯 state Per Fragment 𝒗 𝑝 𝒗 𝒗 𝑝 𝒗 State structure stores: • 𝛽value (boundary-ness)

Our formulation: natural transients

• The transition rate of β controls the smoothness of the transition.

• Results in a simple conditional-free update equation for the entire domain.

Off On

Page 23: Aerophones in Flatland - microsoft.com · GPU Implementation R G B A 𝑝 𝐯 𝐯 state Per Fragment 𝒗 𝑝 𝒗 𝒗 𝑝 𝒗 State structure stores: • 𝛽value (boundary-ness)

Wall losses

• 2D simulations support transverse resonances

• Wall loss modeling is required (unlike 1D models)

Off On

Page 24: Aerophones in Flatland - microsoft.com · GPU Implementation R G B A 𝑝 𝐯 𝐯 state Per Fragment 𝒗 𝑝 𝒗 𝒗 𝑝 𝒗 State structure stores: • 𝛽value (boundary-ness)

High-amplitude non-linearity

• Brass instruments have high amplitudes inside the bore.

• Makes brass sound brighter.

Off On

Page 25: Aerophones in Flatland - microsoft.com · GPU Implementation R G B A 𝑝 𝐯 𝐯 state Per Fragment 𝒗 𝑝 𝒗 𝒗 𝑝 𝒗 State structure stores: • 𝛽value (boundary-ness)

𝒗𝑦

𝒗𝑥

𝒗𝑦

𝒗𝑥

GPU Implementation

• Solving Finite Difference uses a 5-point 2D stencil.

• Neighbor pressures and velocities are used to update center pressure.

𝑝𝐿

𝑝𝐷

𝑝𝑅

𝑝𝑈

𝑝

Page 26: Aerophones in Flatland - microsoft.com · GPU Implementation R G B A 𝑝 𝐯 𝐯 state Per Fragment 𝒗 𝑝 𝒗 𝒗 𝑝 𝒗 State structure stores: • 𝛽value (boundary-ness)

GPU Implementation

R G B A

𝑝 𝐯𝑥 𝐯𝑦 state

Per Fragment

𝒗𝑦

𝒗𝑥𝑝

𝒗𝑦

𝑝 𝒗𝑥

State structure stores:

• 𝛽 value (boundary-ness)

• 𝜎 value (PML)

• Is Excitation?

• Is Listener?

• Values for each cell are stored in color channels.

• Simulation grid is represented as a 2D texture.

• Four copies of the simulation are stored in one large texture.

• Ping-pong with R/Ws on one texture.

• Output pressure written out in block in reserved space on FBO

Page 27: Aerophones in Flatland - microsoft.com · GPU Implementation R G B A 𝑝 𝐯 𝐯 state Per Fragment 𝒗 𝑝 𝒗 𝒗 𝑝 𝒗 State structure stores: • 𝛽value (boundary-ness)

Framebuffer Texture

GPU Implementation

• Values for each cell are stored in color channels.

• Simulation grid is represented as a 2D texture.

• Four copies of the simulation are stored in one large texture.

• Ping-pong with R/Ws on one texture.

• Output pressure written out in block in reserved space on FBO

R G B A

𝑝 𝐯𝑥 𝐯𝑦 state

Per Fragment

Page 28: Aerophones in Flatland - microsoft.com · GPU Implementation R G B A 𝑝 𝐯 𝐯 state Per Fragment 𝒗 𝑝 𝒗 𝒗 𝑝 𝒗 State structure stores: • 𝛽value (boundary-ness)

1 2

3 4

GPU Implementation

• Values for each cell are stored in color channels.

• Simulation grid is represented as a 2D texture.

• Four copies of the simulation are stored in one large texture.

• Ping-pong with R/Ws on one texture.

• Output pressure written out in block in reserved space on FBO

R G B A

𝑝 𝐯𝑥 𝐯𝑦 state

Framebuffer Texture

Per Fragment

Page 29: Aerophones in Flatland - microsoft.com · GPU Implementation R G B A 𝑝 𝐯 𝐯 state Per Fragment 𝒗 𝑝 𝒗 𝒗 𝑝 𝒗 State structure stores: • 𝛽value (boundary-ness)

1 2

3 4

GPU Implementation

• Values for each cell are stored in color channels.

• Simulation grid is represented as a 2D texture.

• Four copies of the simulation are stored in one large texture.

• Ping-pong with R/Ws on one texture.

• Output pressure written out in block in reserved space on FBO

Framebuffer Texture

𝑡 − 2

𝑡𝑡 + 1

R G B A

𝑝 𝐯𝑥 𝐯𝑦 state

𝑡 − 1

Page 30: Aerophones in Flatland - microsoft.com · GPU Implementation R G B A 𝑝 𝐯 𝐯 state Per Fragment 𝒗 𝑝 𝒗 𝒗 𝑝 𝒗 State structure stores: • 𝛽value (boundary-ness)

1 2

3 4

GPU Implementation

• Values for each cell are stored in color channels.

• Simulation grid is represented as a 2D texture.

• Four copies of the simulation are stored in one large texture.

• Ping-pong with R/Ws on one texture.

• Output pressure written out in block in reserved space on FBO

Framebuffer Texture

𝑡 + 1

𝑡 − 1𝑡

R G B A

𝑝 𝐯𝑥 𝐯𝑦 state

𝑡 − 2

Page 31: Aerophones in Flatland - microsoft.com · GPU Implementation R G B A 𝑝 𝐯 𝐯 state Per Fragment 𝒗 𝑝 𝒗 𝒗 𝑝 𝒗 State structure stores: • 𝛽value (boundary-ness)

1 2

3 4

GPU Implementation

• Values for each cell are stored in color channels.

• Simulation grid is represented as a 2D texture.

• Four copies of the simulation are stored in one large texture.

• Ping-pong with R/Ws on one texture.

• Output pressure written out in block in reserved space on FBO

Framebuffer Texture

𝑡

𝑡 − 2𝑡 − 1

R G B A

𝑝 𝐯𝑥 𝐯𝑦 state

𝑡 + 1

Page 32: Aerophones in Flatland - microsoft.com · GPU Implementation R G B A 𝑝 𝐯 𝐯 state Per Fragment 𝒗 𝑝 𝒗 𝒗 𝑝 𝒗 State structure stores: • 𝛽value (boundary-ness)

1 2

3 4

GPU Implementation

• Values for each cell are stored in color channels.

• Simulation grid is represented as a 2D texture.

• Four copies of the simulation are stored in one large texture.

• Ping-pong with R/Ws on one texture.

• Output pressure written out in block in reserved space on FBO

Framebuffer Texture

𝑡 − 1

𝑡 + 1𝑡 − 2

R G B A

𝑝 𝐯𝑥 𝐯𝑦 state

𝑡

Page 33: Aerophones in Flatland - microsoft.com · GPU Implementation R G B A 𝑝 𝐯 𝐯 state Per Fragment 𝒗 𝑝 𝒗 𝒗 𝑝 𝒗 State structure stores: • 𝛽value (boundary-ness)

1 2

3 4

GPU Implementation

• Values for each cell are stored in color channels.

• Simulation grid is represented as a 2D texture.

• Four copies of the simulation are stored in one large texture.

• Ping-pong with R/Ws on one texture.

• Output pressure written out in block in reserved space on FBO

Framebuffer Texture

𝑡 − 2

𝑡𝑡 + 1

R G B A

𝑝 𝐯𝑥 𝐯𝑦 state

𝑡 − 1

Page 34: Aerophones in Flatland - microsoft.com · GPU Implementation R G B A 𝑝 𝐯 𝐯 state Per Fragment 𝒗 𝑝 𝒗 𝒗 𝑝 𝒗 State structure stores: • 𝛽value (boundary-ness)

1 2

3 4

GPU Implementation

Framebuffer Texture

𝑡 − 2

𝑡𝑡 + 1

R G B A

𝑝 𝐯𝑥 𝐯𝑦 state

𝑡 − 1

• Values for each cell are stored in color channels.

• Simulation grid is represented as a 2D texture.

• Four copies of the simulation are stored in one large texture.

• Ping-pong with R/Ws on one texture.

• Write output pressure (sound) to reserved space on the FBO.

Page 35: Aerophones in Flatland - microsoft.com · GPU Implementation R G B A 𝑝 𝐯 𝐯 state Per Fragment 𝒗 𝑝 𝒗 𝒗 𝑝 𝒗 State structure stores: • 𝛽value (boundary-ness)

Clarinet

Chalumeau melody Altissimo melody (register key)

Page 36: Aerophones in Flatland - microsoft.com · GPU Implementation R G B A 𝑝 𝐯 𝐯 state Per Fragment 𝒗 𝑝 𝒗 𝒗 𝑝 𝒗 State structure stores: • 𝛽value (boundary-ness)

Saxophone

Simple melody Fast Squeaks

Page 37: Aerophones in Flatland - microsoft.com · GPU Implementation R G B A 𝑝 𝐯 𝐯 state Per Fragment 𝒗 𝑝 𝒗 𝒗 𝑝 𝒗 State structure stores: • 𝛽value (boundary-ness)

Flute

“Robot” Performer Wind Controller Interface

Page 38: Aerophones in Flatland - microsoft.com · GPU Implementation R G B A 𝑝 𝐯 𝐯 state Per Fragment 𝒗 𝑝 𝒗 𝒗 𝑝 𝒗 State structure stores: • 𝛽value (boundary-ness)

Bugle & Trumpet (brasses)

Lips Overblowing Valve System

Page 39: Aerophones in Flatland - microsoft.com · GPU Implementation R G B A 𝑝 𝐯 𝐯 state Per Fragment 𝒗 𝑝 𝒗 𝒗 𝑝 𝒗 State structure stores: • 𝛽value (boundary-ness)

Trumpet w/o Bell and w/ Mutes

Bell On/Off Straight, Cup and Harmon Mute

Page 40: Aerophones in Flatland - microsoft.com · GPU Implementation R G B A 𝑝 𝐯 𝐯 state Per Fragment 𝒗 𝑝 𝒗 𝒗 𝑝 𝒗 State structure stores: • 𝛽value (boundary-ness)

“Slide Whistle” and “Menorah”

Dynamic Bore Geometry Interlocking Valve System

Page 41: Aerophones in Flatland - microsoft.com · GPU Implementation R G B A 𝑝 𝐯 𝐯 state Per Fragment 𝒗 𝑝 𝒗 𝒗 𝑝 𝒗 State structure stores: • 𝛽value (boundary-ness)

“Tuba?” and “Hybrid”

Implausible-to-construct Instrument Reed, Lips, Valve, Tonehole, Bell

Page 42: Aerophones in Flatland - microsoft.com · GPU Implementation R G B A 𝑝 𝐯 𝐯 state Per Fragment 𝒗 𝑝 𝒗 𝒗 𝑝 𝒗 State structure stores: • 𝛽value (boundary-ness)

Comparisons to STK (Digital Waveguides)

Low note High note

Page 43: Aerophones in Flatland - microsoft.com · GPU Implementation R G B A 𝑝 𝐯 𝐯 state Per Fragment 𝒗 𝑝 𝒗 𝒗 𝑝 𝒗 State structure stores: • 𝛽value (boundary-ness)

Conclusions and Future Work

• First system for real-time 2D simulation of Aerophones

• Improving the control of excitation mechanisms

• Automatic tuning of geometry

• Generalized excitation model

• Modeling of larynx/syrinx (speech synthesis/bird song)

Page 44: Aerophones in Flatland - microsoft.com · GPU Implementation R G B A 𝑝 𝐯 𝐯 state Per Fragment 𝒗 𝑝 𝒗 𝒗 𝑝 𝒗 State structure stores: • 𝛽value (boundary-ness)

Thank You! Questions?

Special thanks for providing performances –

• Kyle Rowan, clarinetist

• Paul Hembree, trumpeter