Main class for violin synthesis (if in doubt, use this one). More...
#include <violin_instrument.h>
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. | |
Main class for violin synthesis (if in doubt, use this one).
| ViolinInstrument::ViolinInstrument | ( | int | random_seed = 0 |
) |
Constructor.
| [in] | random_seed | Initializes the randomness (for added noise in the model). |
| void ViolinInstrument::finger | ( | int | which_string, | |
| double | ratio_from_nut | |||
| ) |
Places finger on the string.
Finger remains in place until moved.
| [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".
| [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). |
| 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.
| [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. :)
| [out] | *buffer | Place to write output. |
| [in] | num_samples | Number of samples to advance. |
| 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.
| [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.
| [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. |
1.6.3