3

Is there a well known algorithm for synthesising bowed string instruments (e.g. violins)?

I know for plucked strings (e.g. guitars) there's the karplus-strong algorithm, which I have succesfully implemented in the past.

Ideally I would like an algorithm describing a computer program for generating/synthesizing the digital signal.

For example, the karplus-strong algorithm can be summerized as follows:

  • Determine the period length of the frequency you want to synthesize and create a buffer of exactly that size

  • Fill the buffer with random numbers (white noise)

  • Iterate over the buffer, each time average each poitn with the next point then outputting it to the output stream.

  • Repeat for the desired amount of time while applying some damping

I wonder if something similar exists for bowed strings.

Footnote:

Now, I know nothing about the physics of how strings produce the sound, so I have no idea how one would derive such an algorithm. For the karplus-strong algorithm, I simply read it in the original paper and applied it "blindly". I would have never guessed that starting with a while noise and continuously damping it would produce a sound so similar to a plucked string.

EDIT:

As usual, the close parade has started.

Before voting to close this question, please consider the following:

  • This question is not about physics. It's not about the mechanics of the string vibration or interaction with the bow and air to produce the sound.

  • This question is about the existence of a specific well known algorithm to synthesize the sound. It's strictly a question about programming.

hasen
  • 161,647
  • 65
  • 194
  • 231
  • You might have better luck with this question at https://physics.stackexchange.com – RBarryYoung Nov 28 '21 at 15:57
  • @RBarryYoung It's not a question about physics. It's a question about how to program the thing. Not about the string/air/wave mechanism that produce the sound. – hasen Nov 28 '21 at 23:49
  • obtain samples, do oscilograms and spectrograms ... fit/parametrize with polynomial or goinometric ... a lot of research and data compiling to do ... – Spektre Nov 29 '21 at 08:26
  • 1
    "*the karplus-strong algorithm ... I wonder if something similar exists for bowed strings*". This is a question that folks at https://phyiscs.stackexchange.com are more likely to know. They also have more folks there with experience in turning ODEs and PDEs into numerical and simulation programs. And for the record, I did not vote to close your question. If you want it here, I am fine with it, I was just trying to point out that there are a lot more numerical and simulation programmers over there. – RBarryYoung Nov 29 '21 at 12:40

2 Answers2

3

Weirdly i was able to find some stuff on this on the Stanford chuck website.

The code is written in a language called ChucK which is apparently specific for audio programming. You will have to run to use this code snippet. But here is its implementation in chuck:

// patch
Bowed bow => dac;

// scale
[0, 2, 4, 7, 8, 11] @=> int scale[];

// infinite time loop
while( true )
{
    // set
    Math.random2f( 0, 1 ) => bow.bowPressure;
    Math.random2f( 0, 1 ) => bow.bowPosition;
    Math.random2f( 0, 12 ) => bow.vibratoFreq;
    Math.random2f( 0, 1 ) => bow.vibratoGain;
    Math.random2f( 0, 1 ) => bow.volume;

    // print
    <<< "---", "" >>>;
    <<< "bow pressure:", bow.bowPressure() >>>;
    <<< "bow position:", bow.bowPosition() >>>;
    <<< "vibrato freq:", bow.vibratoFreq() >>>;
    <<< "vibrato gain:", bow.vibratoGain() >>>;
    <<< "volume:", bow.volume() >>>;

    // set freq
    scale[Math.random2(0,scale.size()-1)] + 57 => Std.mtof => bow.freq;
    // go
    .8 => bow.noteOn;

    // advance time
    Math.random2f(.8, 2)::second => now;
}

Edit: The above is just the implementation, the source file for it is here.

  • 1
    Interesting find. This seems to just be the usage code. The actual implementation might be this. https://ccrma.stanford.edu/software/stk/Bowed_8h_source.html looking further into it – hasen Nov 29 '21 at 00:59
  • Hope you find it useful, ill update the post to reflect the source. – josephvictory Nov 29 '21 at 02:07
0

Not an algorithm, but there's an open source library (under a very liberal license) that implements synthesis algorithms in C++ for several instruments, including bowed strings.

The Synthesis ToolKit (STK)

Official homepage: https://ccrma.stanford.edu/software/stk/

Github link: https://github.com/thestk/stk

Files with code relevant to synthesis of bowed string instruments:

The comments in the code make references to two papers:

Julius Smith also has information about bowed string synthesis available on his (standford) website:

Bowed Strings section of the "Physical Audio Signal Processing" book

MUS420 Lecture Digital Waveguide Modeling of Bowed Strings

hasen
  • 161,647
  • 65
  • 194
  • 231