Sound Design Toolkit  078
Physically informed sound synthesis for everyday sounds
SDTResonators.h: Solid resonators

Typedefs

typedef struct SDTResonator SDTResonator
 Opaque data structure representing a solid resonator object.
 
typedef struct SDTResonator SDTResonator
 Opaque data structure representing a solid resonator object.
 

Functions

SDTResonatorSDTResonator_new (unsigned int nModes, unsigned int nPickups)
 Object constructor. More...
 
void SDTResonator_free (SDTResonator *x)
 Object destructor. More...
 
double SDTResonator_getPosition (SDTResonator *x, unsigned int pickup)
 Gets the displacement of the object at a given pickup point. More...
 
double SDTResonator_getVelocity (SDTResonator *x, unsigned int pickup)
 Gets the velocity of the object at a given pickup point. More...
 
int SDTResonator_getNPickups (SDTResonator *x)
 Gets the number of pickup points. More...
 
void SDTResonator_setPosition (SDTResonator *x, unsigned int pickup, double f)
 Sets a modal displacement at a given pickup point. More...
 
void SDTResonator_setVelocity (SDTResonator *x, unsigned int pickup, double f)
 Sets a modal velocity at a given pickup point. More...
 
void SDTResonator_setFrequency (SDTResonator *x, unsigned int mode, double f)
 Sets the resonant frequency for a given mode. More...
 
void SDTResonator_setDecay (SDTResonator *x, unsigned int mode, double f)
 Sets the decay for a given mode. More...
 
void SDTResonator_setWeight (SDTResonator *x, unsigned int mode, double f)
 Sets the weight for a given mode. More...
 
void SDTResonator_setGain (SDTResonator *x, unsigned int pickup, unsigned int mode, double f)
 Sets the pickup gain for a given mode and pickup. More...
 
void SDTResonator_setFragmentSize (SDTResonator *x, double f)
 Reduces the object into a smaller fragment. This paramenter influences various aspects of the object: Smaller fragments resonate louder and at higher frequencies, but with shorter decay times. More...
 
void SDTResonator_setActiveModes (SDTResonator *x, unsigned int i)
 Sets the number of active (actually computed) modes. More...
 
void SDTResonator_applyForce (SDTResonator *x, unsigned int pickup, double f)
 Applies a force to the resonator at a given pickup point. The force is distributed across the modes according to their normalized pickup gains (modal gain/sum of all gains). If the function is called multiple times in a single DSP cycle, the applied force gets accumulated. More...
 
double SDTResonator_computeEnergy (SDTResonator *x, unsigned int pickup, double f)
 Computes the total energy of the object, after applying all acting forces. More...
 
void SDTResonator_dsp (SDTResonator *x)
 Signal processing routine. Call this function at sample rate to update the internal state of the resonator. DO NOT call this function if you plan to use any of the interactor DSP methods instead! See the SDTInteractors.h module documentation for further information.
 

Detailed Description

Physical model of a solid resonator, represented as a set of parallel mass-spring-damper mechanical oscillators. Each oscillator corresponds to a normal mode of resonance of the object, with the oscillation period, the mass and the damping coefficient of each oscillator corresponding respectively to the resonance frequency, the magnitude and the decay time of each mode. Resonant modes can be mixed and weighted with different gains, to simulate different pickup points on the resonating object. A single mode with a resonant frequency of 0 Hz, infinite decay time and unity pickup gain behaves like an inertial point mass. The model uses the impulse invariant method as discretization scheme.

Function Documentation

void SDTResonator_applyForce ( SDTResonator x,
unsigned int  pickup,
double  f 
)

Applies a force to the resonator at a given pickup point. The force is distributed across the modes according to their normalized pickup gains (modal gain/sum of all gains). If the function is called multiple times in a single DSP cycle, the applied force gets accumulated.

Parameters
[in]
double SDTResonator_computeEnergy ( SDTResonator x,
unsigned int  pickup,
double  f 
)

Computes the total energy of the object, after applying all acting forces.

Parameters
[in]pickupPickup point
[in]fExternal force applied at the pickup point
Returns
Sum of kinetic and potential energy, in J
void SDTResonator_free ( SDTResonator x)

Object destructor.

Parameters
[in]xPointer to the instance to destroy
int SDTResonator_getNPickups ( SDTResonator x)

Gets the number of pickup points.

Returns
Number of pickup points
double SDTResonator_getPosition ( SDTResonator x,
unsigned int  pickup 
)

Gets the displacement of the object at a given pickup point.

Parameters
[in]pickupPickup point
Returns
Object displacement, in m
double SDTResonator_getVelocity ( SDTResonator x,
unsigned int  pickup 
)

Gets the velocity of the object at a given pickup point.

Parameters
[in]pickupPickup point
Returns
Object velocity, in m/s
SDTResonator * SDTResonator_new ( unsigned int  nModes,
unsigned int  nPickups 
)

Object constructor.

Parameters
[in]nModesNumber of resonant modes
[in]nPickupsNumber of pickup points
Returns
Pointer to the new instance
void SDTResonator_setActiveModes ( SDTResonator x,
unsigned int  i 
)

Sets the number of active (actually computed) modes.

Parameters
[in]
void SDTResonator_setDecay ( SDTResonator x,
unsigned int  mode,
double  f 
)

Sets the decay for a given mode.

Parameters
[in]modeMode number
[in]
void SDTResonator_setFragmentSize ( SDTResonator x,
double  f 
)

Reduces the object into a smaller fragment. This paramenter influences various aspects of the object: Smaller fragments resonate louder and at higher frequencies, but with shorter decay times.

Parameters
[in]
void SDTResonator_setFrequency ( SDTResonator x,
unsigned int  mode,
double  f 
)

Sets the resonant frequency for a given mode.

Parameters
[in]modeMode number
[in]
void SDTResonator_setGain ( SDTResonator x,
unsigned int  pickup,
unsigned int  mode,
double  f 
)

Sets the pickup gain for a given mode and pickup.

Parameters
[in]pickupPickup number
[in]modeMode number
[in]
void SDTResonator_setPosition ( SDTResonator x,
unsigned int  pickup,
double  f 
)

Sets a modal displacement at a given pickup point.

Parameters
[in]pickupPickup point
[in]
void SDTResonator_setVelocity ( SDTResonator x,
unsigned int  pickup,
double  f 
)

Sets a modal velocity at a given pickup point.

Parameters
[in]pickupPickup point
[in]
void SDTResonator_setWeight ( SDTResonator x,
unsigned int  mode,
double  f 
)

Sets the weight for a given mode.

Parameters
[in]modeMode number
[in]