ViolinInstrument Class Reference

Main class for violin synthesis (if in doubt, use this one). More...

#include <violin_instrument.h>

List of all members.

Public Member Functions

 ViolinInstrument (int random_seed=0)
 Constructor.
 ~ViolinInstrument ()
 Destructor; nothing special.
void reset ()
 Stops all movement.
void finger (int which_string, double ratio_from_nut)
 Places finger on the string.
void pluck (int which_string, double ratio_from_bridge, double pluck_force)
 Plucks a string.
void bow (int which_string, double bow_ratio_from_bridge, double bow_force, double bow_velocity)
 Sets the bow's action.
void wait_samples (short *buffer, int num_samples)
 Advances time and writes data to a buffer.
String_Physical get_physical_constants (int which_string)
 Returns a string's physical constants.
void set_physical_constants (int which_string, String_Physical pc_new)
 Sets a string's physical constants.

Detailed Description

Main class for violin synthesis (if in doubt, use this one).


Constructor & Destructor Documentation

ViolinInstrument::ViolinInstrument ( int  random_seed = 0  ) 

Constructor.

Parameters:
[in] random_seed Initializes the randomness (for added noise in the model).

Member Function Documentation

void ViolinInstrument::finger ( int  which_string,
double  ratio_from_nut 
)

Places finger on the string.

Finger remains in place until moved.

Parameters:
[in] which_string Instrument string (0,1,2,3); higher string numbers are higher in pitch. 0 is the G string).
[in] ratio_from_nut Measured as a fraction of string length.
void ViolinInstrument::pluck ( int  which_string,
double  ratio_from_bridge,
double  pluck_force 
)

Plucks a string.

The pluck is simulated like a bow that pulls until it slips for the first time; as a result, you cannot predict when the pluck has finished "starting".

Parameters:
[in] which_string Instrument string (0,1,2,3); higher string numbers are higher in pitch. 0 is the G string).
[in] ratio_from_bridge Measured as a fraction of string length.
[in] pluck_force Measured in 0.0 to 1.0 (ARBITRARY).
Todo:
Re-think the pluck force paramater + constants
void ViolinInstrument::bow ( int  which_string,
double  bow_ratio_from_bridge,
double  bow_force,
double  bow_velocity 
)

Sets the bow's action.

Bow actions are assumed to continue until changed.

Parameters:
[in] which_string Instrument string (0,1,2,3); higher string numbers are higher in pitch. 0 is the G string).
[in] bow_ratio_from_bridge Measured as a fraction of string length.
[in] bow_force Measured in Newtons.
[in] bow_velocity Measured in meters / second.
void ViolinInstrument::wait_samples ( short *  buffer,
int  num_samples 
)

Advances time and writes data to a buffer.

Recommended: use MonoWav to get the short *buffer if you want to write a wav file. For realtime use, figure out the buffer on your own. :)

Parameters:
[out] *buffer Place to write output.
[in] num_samples Number of samples to advance.
Warning:
You are responsible for allocating sufficient memory for the buffer.
String_Physical ViolinInstrument::get_physical_constants ( int  which_string  ) 

Returns a string's physical constants.

This method is not recommended for normal use; it is merely a curiosity for people wanting to experiment.

Parameters:
[in] which_string Instrument string (0,1,2,3); higher string numbers are higher in pitch. 0 is the G string).
void ViolinInstrument::set_physical_constants ( int  which_string,
String_Physical  pc_new 
)

Sets a string's physical constants.

This method is not recommended for normal use; it is merely a curiosity for people wanting to experiment.

Parameters:
[in] which_string Instrument string (0,1,2,3); higher string numbers are higher in pitch. 0 is the G string).
[in] pc_new String physical constants.

The documentation for this class was generated from the following files:
Generated on Mon Jun 27 20:50:13 2011 for Artifastring by  doxygen 1.6.3