"""cymsim: simulation of a drumstick strike on a plate or cymbal. A plate is described by a ``Design`` (material, bounding box, outline, thickness field, stress-free profile) and sampled on a grid into a ``Plate``. Two models share that discretization. The *linear model* computes the modes of the plate once (``compute_modes``) and synthesizes any strike from them in about a second (``synthesize``). The *full model* steps the geometrically nonlinear plate equations in time with PyTorch, on a GPU when one is available (``simulate``); it is slower by orders of magnitude but captures the pitch glide and the wash of a hard hit. Both return a ``Sound``. import cymsim plate = cymsim.presets.crash_16().evaluate(spacing=0.008) modes = cymsim.compute_modes(plate, fmax=16000) sound = cymsim.synthesize(modes, cymsim.Strike(velocity=3.0), cymsim.Listener(distance=0.5)) sound.to_wav("crash.wav") """ from . import constants, loss, presets from .design import Design, DesignError from .grid import Grid, make_grid from .linear import Modes, compute_modes, synthesize from .material import ALUMINUM, BRONZE, MILD_STEEL, STAINLESS_STEEL, Material, Thermal from .params import Listener, Strike from .plate import Plate from .sound import Sound from .spectrogram import Spectrogram __version__ = "0.1.0" __all__ = [ "Design", "DesignError", "Grid", "make_grid", "Material", "Thermal", "STAINLESS_STEEL", "MILD_STEEL", "BRONZE", "ALUMINUM", "Plate", "Strike", "Listener", "Modes", "compute_modes", "synthesize", "simulate", "Simulation", "Sound", "Spectrogram", "presets", "constants", "loss", "plot", ] def simulate(*args, **kwargs): """The full model; see ``cymsim.full.simulate``. Requires ``torch`` (``pip install cymsim[full]``).""" from .full import simulate as _simulate return _simulate(*args, **kwargs) def __getattr__(name): import importlib if name == "Simulation": return importlib.import_module(".full.simulation", __name__).Simulation if name == "plot": return importlib.import_module(".plot", __name__) raise AttributeError(f"module 'cymsim' has no attribute {name!r}")