Sound Design Toolkit 075 Physically informed sound synthesis for everyday sounds

- Main Page
- Modules
- Data Structures
- Files

Typedefs | Functions
SDTResonators.h: Solid resonators

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

## Functions
SDTResonator * | SDTResonator_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...
double | SDTResonator_getMomentum (SDTResonator *x)
| Gets the momentum of the object. More...
double | SDTResonator_getNModes (SDTResonator *x)
| Gets the number of resonance modes. More...
double | SDTResonator_getNPickups (SDTResonator *x)
| Gets the number of pickup points. More...
void | SDTResonator_setPosition (SDTResonator *x, unsigned int pickup, unsigned int mode, double f)
| Sets a modal displacement at a given pickup point. More...
void | SDTResonator_setVelocity (SDTResonator *x, unsigned int pickup, unsigned int mode, 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 pickup, unsigned int mode, double f)
| Sets the weight for a given mode and pickup. More...
void | SDTResonator_setMass (SDTResonator *x, unsigned int pickup, unsigned int mode, double f)
| Sets the mass 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...
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] |  |

void SDTResonator_free | ( | SDTResonator * | x | ) |

Object destructor.

Parameters

  [in] | x | Pointer to the instance to destroy

double SDTResonator_getMomentum | ( | SDTResonator * | x | ) |

Gets the momentum of the object.

Returns
  Object momentum, in Kg * m/s

double SDTResonator_getNModes | ( | SDTResonator * | x | ) |

Gets the number of resonance modes.

Returns
  Number of resonance modes

double 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] | pickup | Pickup 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] | pickup | Pickup point

Returns
  Object velocity, in m/s

SDTResonator* SDTResonator_new | ( | unsigned int | nModes,
|  | unsigned int | nPickups
| ) |  |

Object constructor.

Parameters

  [in] | nModes | Number of resonant modes
  [in] | nPickups | Number 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] | mode | Mode 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] | mode | Mode number
  [in] |  |

void SDTResonator_setMass | ( | SDTResonator * | x,
|  | unsigned int | pickup,
|  | unsigned int | mode,
|  | double | f
| ) |  |

Sets the mass for a given mode and pickup.

Parameters

  [in] | pickup | Pickup number
  [in] | mode | Mode number
  [in] |  |

void SDTResonator_setPosition | ( | SDTResonator * | x,
|  | unsigned int | pickup,
|  | unsigned int | mode,
|  | double | f
| ) |  |

Sets a modal displacement at a given pickup point.

Parameters

  [in] | pickup | Pickup point
  [in] | mode | Mode number
  [in] |  |

void SDTResonator_setVelocity | ( | SDTResonator * | x,
|  | unsigned int | pickup,
|  | unsigned int | mode,
|  | double | f
| ) |  |

Sets a modal velocity at a given pickup point.

Parameters

  [in] | pickup | Pickup point
  [in] | mode | Mode number
  [in] |  |

void SDTResonator_setWeight | ( | SDTResonator * | x,
|  | unsigned int | pickup,
|  | unsigned int | mode,
|  | double | f
| ) |  |

Sets the weight for a given mode and pickup.

Parameters

  [in] | pickup | Pickup number
  [in] | mode | Mode number
  [in] |  |