|
 |
Some ideas regarding Chladni. Untested code in Nim (sorry) as it has to
fit into my pattern and audio synthesis stuff, but it should not be to
complex to convert to POV-Ray (I'm tempted).
for a rectangulare plate:
proc chladniRect*(ampA, ampB, m, n, Lx, Ly: float): Pattern =
proc fn(x, y, z: float): float =
ampA * sin(PI * m * x / Lx) * sin(PI * n * y / Ly) +
ampB * sin(PI * n * x / Lx) * sin(PI * m * y / Ly)
initPattern(fn)
proc chladniRectFreq*(m, n, Lx, Ly, waveSpeed: float): float =
(waveSpeed / 2.0) * sqrt((m/Lx)*(m/Lx) + (n/Ly)*(n/Ly))
type
PlateMaterial* = object
E: float # Young's modulus (Pa) - stiffness
rho: float # density (kg/m³)
nu: float # Poisson's ratio - lateral contraction
h: float # thickness (m)
const
Steel* = PlateMaterial(
E: 200e9, rho: 7800.0, nu: 0.28, h: 0.001
)
Aluminium* = PlateMaterial(
E: 70e9, rho: 2700.0, nu: 0.33, h: 0.001
)
Glass* = PlateMaterial(
E: 70e9, rho: 2500.0, nu: 0.23, h: 0.001
)
Wood* = PlateMaterial( # spruce, along grain
E: 12e9, rho: 450.0, nu: 0.35, h: 0.003
)
Brass* = PlateMaterial(
E: 100e9, rho: 8500.0, nu: 0.35, h: 0.001
)
proc waveSpeed*(mat: PlateMaterial): float =
## Flexural wave speed in thin plate
let B = mat.E * mat.h * mat.h * mat.h /
(12.0 * (1.0 - mat.nu * mat.nu)) # bending stiffness
let rhoH = mat.rho * mat.h # mass per unit area
sqrt(B / rhoH) # simplified phase velocity
now the other way around:
f_mn = (c / 2) * sqrt((m/Lx)^2 + (n/Ly)^2)
invert
(2f/c)² = (m/Lx)^ + (n/Ly)^
now finde modes at frequency
loop over modes, get chladni and sum
this should then be convered to a spectrogram and create the sound from
that.
It can be extended to 3d room modes so one can simulate small room
acoustics (below Schroeder freq) and walk trough a .df3 media room that
show the soundfield.
ingo
Post a reply to this message
|
 |