44

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

  • Upload
    others

  • View
    3

  • 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