This GitLab instance reached the end of its service life. It won't be possible to create new users or projects.

Please read the deprecation notice for more information concerning the deprecation timeline

Visit migration.git.tu-berlin.de to import your old projects to the new GitLab platform 📥

Commit afa00bde by Henrik von Coler

Added physical modeling examples!

parent 008c5200
// karplus_strong.dsp
//
// Slightly modified version of the
// Karplus-Strong plucked string algorithm.
//
// see: 'Making Virtual Electric Guitars and Associated Effects Using Faust'
// (Smith, )
//
// - one-pole lowpass in the feedback
//
// Henrik von Coler
// 2020-06-07
import("all.lib");
////////////////////////////////////////////////////////////////////////////////
// Control parameters as horizonal sliders:
////////////////////////////////////////////////////////////////////////////////
freq = hslider("freq Hz", 50, 20, 1000, 1) : si.smoo; // Hz
// initial filter for the excitation noise
initial_filter = hslider("initial_filter Hz",1000,10,10000,1) : si.smoo;
lop = hslider("lop Hz",1000,10,10000,1) : si.smoo;
level = hslider("level", 1, 0, 10, 0.01);
gate = button("gate");
gain = hslider("gain", 1, 0, 1, 0.01);
////////////////////////////////////////////////////////////////////////////////
// processing elements:
////////////////////////////////////////////////////////////////////////////////
diffgtz(x) = (x-x') > 0;
decay(n,x) = x - (x>0)/n;
release(n) = + ~ decay(n);
trigger(n) = diffgtz : release(n) : > (0.0);
P = SR/freq;
// Resonator:
resonator = (+ : delay(4096, P) * gain) ~ si.smooth(1.0-2*(lop/ma.SR));
////////////////////////////////////////////////////////////////////////////////
// processing function:
////////////////////////////////////////////////////////////////////////////////
process = noise : si.smooth(1.0-2*(initial_filter/ma.SR)):*(level)
: *(gate : trigger(P)): resonator <: _,_;
\ No newline at end of file
// waveguide_string.dsp
//
// waveguide model of a string
//
// - one-pole lowpass termination
//
// Henrik von Coler
// 2020-06-09
import("all.lib");
// use '(pm.)l2s' to calculate number of samples
// from length in meters:
segment(maxLength,length) = waveguide(nMax,n)
with{
nMax = maxLength : l2s;
n = length : l2s/2;
};
// one lowpass terminator
fc = hslider("lowpass",1000,10,10000,1);
rt = rTermination(basicBlock,*(-1) : si.smooth(1.0-2*(fc/ma.SR)));
// one gain terminator with control
gain = hslider("gain",0.99,0,1,0.01);
lt = lTermination(*(-1)* gain,basicBlock);
idString(length,pos,excite) = endChain(wg)
with{
nUp = length*pos;
nDown = length*(1-pos);
wg = chain(lt : segment(6,nUp) : in(excite) : out : segment(6,nDown) : rt); // waveguide chain
};
length = hslider("length",1,0.1,10,0.01);
process = idString(length,0.15, button("pluck")) <: _,_;
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment