Artifastring

1.6

Artifastring ("artificial fast string") is a highly optimized physical simulation of a violin for sound synthesis.

1. Quick start

1.1 Download

The latest tarball release can be downloaded from: http://percival-music.ca/artifastring/artifastring-latest.tar.gz

Development takes place at: https://github.com/gperciva/artifastring

1.2 Compile

Requires a typical development environment including g++ with the scons build system being recommended.

scons -h

If you do not have scons then you can still compile with the .c and .h files directly. This is demonstrated in 4. Use in code.

1.3 Generate audio

./actions2wav twinkle.actions

The format of the ".actions" file is described in 3. File format.

You may also use it in C++ code directly; this is described in 4. Use in code. Python bindings are available; see 5. Swig python bindings.

1.4 Generate video

Video can be produced with blender. At the moment, this is not integerated into the scons build system; instead, go to blender/ and follow the instructions in the README there.

2. Background

2.1 References

Artifastring is an implementation of modal bowed string physical modelling as described by:

2.2 Known limitations

Despite the recent dates, this model is relatively old (early 1990s?) and does not represent the most accurate simulation known to researchers. In particular, the friction of bowing is estimated with a hyperbolic curve, rather than a more accurate double-exponential curve, or hysteresis behaviour due to the rosin melting and cooling during bowing.

This model was not chosen for accuracy; rather for being simple yet still "good enough" for our desires. Don't criticize it for being "not sufficiently accurate" for whatever you want to do.

In addition, the modal dampening factors used here were determined experimentally for the D string (in Demoucron's thesis) -- we have not (yet) reproduced those experiments for the other strings. This may produce unrealistic behaviour, especially from the E string.

2.3 Acknowledgements

This project would not have been possible without initial work by my supervisor, Dr. Nick Bailey, in understanding and explaining the model (in language, diagrams, and code). Many thanks also to Dr. John Williamson and Dr. Martin Macauley for clarifying some more abstract parts of the model.

Many thanks also to Matthias Demoucron for clarifying some physical constants (especially the slope of friction charactistics v0) in personal email.

3. File format

The general syntax of each line is:

action_type   seconds   parameters...

Lines must be divided with tabs, with one command per line. A line beginning with a # hash is a comment.

There are four types of commands. All commands begin with the action_type and seconds. seconds is the absolute time since the beginning of the audio, not the relative time since the last command.

See files in the music/ directory for examples.

4. Use in code

Input code:

// simple.cpp
#include "artifastring/violin_instrument.h"
#include "artifastring/monowav.h"
int main () {
    // make objects
    MonoWav *wavfile = new MonoWav("output.wav");
    ViolinInstrument *violin = new ViolinInstrument();

    // get output buffer
    short *output = wavfile->request_fill(44100);

    // pluck the A string, near the middle of the string,
    // with moderately strong force
    violin->pluck(2, 0.45, 0.8);

    // wait 1 second
    violin->wait_samples(output, 44100);

    // automatically writes output file
    delete wavfile;
    delete violin;
}

To compile (after installing):

g++ simple.cpp -lartifastring

Manual compile (with no installation):

g++ violin_instrument.cpp violin_string.cpp monowav.cpp simple.cpp -o simple

5. Swig python bindings

SWIG bindings are built automatically if possible.

./play-file.py twinkle.actions

6. Copyright

Short answer: GNU GPL 3.0+

Long answer:

Copyright 2010--2011 Graham Percival

Artifastring is free software: you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation, either version 3 of
the License, or (at your option) any later version.

Artifastring is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public
License along with Artifastring.  If not, see
<http://www.gnu.org/licenses/>.

7. Future work

Development of Artifastring is (temporarily) stalled; now that the basic model is working, we want to actually use it to make music, demonstrate bowing patterns, and all sorts of related things. Those efforts take place in a separate code base, though.

As mentioned in 2.2 Known limitations, some of the physical constants (especially the modal dampening factors) are incorrect for strings other than the D string. Measuring these values for the other strings should only take a few hours once all the relevant hardware and software has been accumulated.

At some point, it would be nice to add support for other stringed instruments -- this should simply be a matter of measuring their physical constants, or perhaps simply finding such already-measured values in the literature. But that is a task we will consider after the current round of conference paper deadlines. :)

Generated on Mon Jun 27 20:50:13 2011 for Artifastring by  doxygen 1.6.3