Sound Design Toolkit  078
Physically informed sound synthesis for everyday sounds
SDTMotor.h: Combustion engines

Typedefs

typedef struct SDTMotor SDTMotor
 Opaque data structure representing a combustion engine object.
 
typedef struct SDTMotor SDTMotor
 Opaque data structure representing a combustion engine object.
 

Functions

SDTMotorSDTMotor_new (long maxDelay)
 Object constructor. More...
 
void SDTMotor_free (SDTMotor *x)
 Object destructor. More...
 
void SDTMotor_setFilters (SDTMotor *x, double damp, double dc)
 Update filter coefficients. Should be always called after setting the sampling rate with SDT_setSampleRate(). More...
 
void SDTMotor_setRpm (SDTMotor *x, double f)
 Sets the Revolutions Per Minute (RPM) of the engine. More...
 
void SDTMotor_setThrottle (SDTMotor *x, double f)
 Sets the throttle load. More...
 
void SDTMotor_setFourStroke (SDTMotor *x)
 Simulates the operation cycle of a four-stroke engine.
 
void SDTMotor_setTwoStroke (SDTMotor *x)
 Simulates the operation cycle of a two-stroke engine.
 
void SDTMotor_setNCylinders (SDTMotor *x, int i)
 Sets the number of cylinders in the engine block. More...
 
void SDTMotor_setCylinderSize (SDTMotor *x, double f)
 Sets the size of each single cylinder. The total volume of the engine is this value multiplied by the number of cylinders. More...
 
void SDTMotor_setCompressionRatio (SDTMotor *x, double f)
 Sets the compression ratio of the engine. The compression ratio is computed dividing the cylinder volume at maximum expansion (piston down) by its volume at maximum compression (piston up). More...
 
void SDTMotor_setSparkTime (SDTMotor *x, double f)
 Sets the width of the ignition pulse, compared to a full operation cycle. More...
 
void SDTMotor_setAsymmetry (SDTMotor *x, double f)
 Sets the amount of irregularity in the operation cycle. More...
 
void SDTMotor_setBackfire (SDTMotor *x, double f)
 Sets the amount of backfiring when the engine revs down. More...
 
void SDTMotor_setIntakeSize (SDTMotor *x, double f)
 Sets the average length of the intake pipes. More...
 
void SDTMotor_setExtractorSize (SDTMotor *x, double f)
 Sets the average length of the extractor pipes. More...
 
void SDTMotor_setExhaustSize (SDTMotor *x, double f)
 Sets the length of the main exhaust pipe. More...
 
void SDTMotor_setExpansion (SDTMotor *x, double f)
 Sets the amount of expansion of the main exhaust pipe. This is a feature commonly found in two-stroke engines, to avoid the passage of fresh fuel mixture into the exhaust system. More...
 
void SDTMotor_setMufflerSize (SDTMotor *x, double f)
 Sets the average length of the muffler chambers. More...
 
void SDTMotor_setMufflerFeedback (SDTMotor *x, double f)
 Sets the amount of energy dissipated by the muffler chambers. More...
 
void SDTMotor_setOutletSize (SDTMotor *x, double f)
 Sets the length of the exhaust outlet. More...
 
void SDTMotor_dsp (SDTMotor *x, double *outs)
 Signal processing routine. Call this function at sample rate to synthesize the engine sound. The output is written in an array of three doubles. The first value represents the sound picked up at the intakes, from the front of the vehicle; the second represents the engine vibrations, mostly heard inside the cabin; the third and last output represents the sound coming from the exhaust outlet, towards the rear of the vehicle. More...
 

Detailed Description

From a mechanical point of view, an internal combustion engine converts chemical energy into kinetic energy by means of a series of controlled explosions. From an acoustical point of view, the previously described setup is basically a set of resonating pipes, excited by the explosions happening in the combustion chambers. Resonances happening inside intake pipes, cylinders, exhaust collectors, exhaust pipe, exhaust muffler and final outlet are simulated by means of digital waveguides, whose inputs, lengths and feedback gains are controlled by a physical model of the engine operation cycle representing the behavior of the engine block. Four mechanical components are simulated: Piston motion, fuel ignition, intake valves operation and exhaust valves operation. The model provides also a simulation of exhaust backfiring, a phenomenon which occurs especially in sports or muscle cars, where the very rich fuel mixture sometimes doesn't burn completely in the cylinders and self ignites later in the hotter parts of the exhaust system.

Function Documentation

void SDTMotor_dsp ( SDTMotor x,
double *  outs 
)

Signal processing routine. Call this function at sample rate to synthesize the engine sound. The output is written in an array of three doubles. The first value represents the sound picked up at the intakes, from the front of the vehicle; the second represents the engine vibrations, mostly heard inside the cabin; the third and last output represents the sound coming from the exhaust outlet, towards the rear of the vehicle.

Parameters
[out]outsPointer to an array of three doubles, destination of the output
void SDTMotor_free ( SDTMotor x)

Object destructor.

Parameters
[in]xPointer to the instance to destroy
SDTMotor * SDTMotor_new ( long  maxDelay)

Object constructor.

Returns
Pointer to the new instance
void SDTMotor_setAsymmetry ( SDTMotor x,
double  f 
)

Sets the amount of irregularity in the operation cycle.

Parameters
[in]fCycle asymmetry [0,1]
void SDTMotor_setBackfire ( SDTMotor x,
double  f 
)

Sets the amount of backfiring when the engine revs down.

Parameters
[in]fChance of backfiring [0,1]
void SDTMotor_setCompressionRatio ( SDTMotor x,
double  f 
)

Sets the compression ratio of the engine. The compression ratio is computed dividing the cylinder volume at maximum expansion (piston down) by its volume at maximum compression (piston up).

Parameters
[in]fCompression ratio
void SDTMotor_setCylinderSize ( SDTMotor x,
double  f 
)

Sets the size of each single cylinder. The total volume of the engine is this value multiplied by the number of cylinders.

Parameters
[in]fCylinder volume, in cc
void SDTMotor_setExhaustSize ( SDTMotor x,
double  f 
)

Sets the length of the main exhaust pipe.

Parameters
[in]fExhaust size, in m
void SDTMotor_setExpansion ( SDTMotor x,
double  f 
)

Sets the amount of expansion of the main exhaust pipe. This is a feature commonly found in two-stroke engines, to avoid the passage of fresh fuel mixture into the exhaust system.

Parameters
[in]fExhaust expansion [0,1]
void SDTMotor_setExtractorSize ( SDTMotor x,
double  f 
)

Sets the average length of the extractor pipes.

Parameters
[in]fExtractor size, in m
void SDTMotor_setFilters ( SDTMotor x,
double  damp,
double  dc 
)

Update filter coefficients. Should be always called after setting the sampling rate with SDT_setSampleRate().

Parameters
[in]xPointer to a SDTMotor instance
void SDTMotor_setIntakeSize ( SDTMotor x,
double  f 
)

Sets the average length of the intake pipes.

Parameters
[in]fIntake size, in m
void SDTMotor_setMufflerFeedback ( SDTMotor x,
double  f 
)

Sets the amount of energy dissipated by the muffler chambers.

Parameters
[in]fMuffler feedback [0,1]
void SDTMotor_setMufflerSize ( SDTMotor x,
double  f 
)

Sets the average length of the muffler chambers.

Parameters
[in]fMuffler size, in m
void SDTMotor_setNCylinders ( SDTMotor x,
int  i 
)

Sets the number of cylinders in the engine block.

Parameters
[in]iNumber of cylinders [1,12]
void SDTMotor_setOutletSize ( SDTMotor x,
double  f 
)

Sets the length of the exhaust outlet.

Parameters
[in]fOutlet size, in m
void SDTMotor_setRpm ( SDTMotor x,
double  f 
)

Sets the Revolutions Per Minute (RPM) of the engine.

Parameters
[in]fRPM value
void SDTMotor_setSparkTime ( SDTMotor x,
double  f 
)

Sets the width of the ignition pulse, compared to a full operation cycle.

Parameters
[in]fIgnition time [0,1]
void SDTMotor_setThrottle ( SDTMotor x,
double  f 
)

Sets the throttle load.

Parameters
[in]fThrottle load [0,1]