Commit 61ba1018 by Henrik von Coler

Added sync_osc example!

parent afa00bde
// A simple oscillator with phase reset.
//
// Parameters
// freq: set the frequency in Hz
// reset: the phase is rest to 0 when going >= 0
//
// Todo: set trigger phase offset
//
// HvC
// 2020-08-30
import("stdfaust.lib");
// some basic stuff
sr = SR;
twopi = 2.0*ma.PI;
// define the waveform in table
ts = 1<<16; // size
time = (+(1) ~ _ ) , 1 : - ;
sinewave = ((float(time) / float(ts)) * twopi) : sin;
phase = os.hs_phasor(ts,freq,trig);
// read from table
sin_osc( freq) = rdtable(ts ,sinewave , int(phase)) ;
// generate a one sample impulse from the gate
trig = pm.impulseExcitation(reset);
reset = button ("reset");
freq = hslider("freq", 100, 0, 16000, 0.00001);
// offset = hslider("offset", 0, 0, 1, 0.00001);
process = sin_osc(freq);
\ No newline at end of file
......@@ -7,7 +7,6 @@
// Henrik von Coler
// 2020-06-09
import("all.lib");
// use '(pm.)l2s' to calculate number of samples
......@@ -21,7 +20,6 @@ with{
// one lowpass terminator
fc = hslider("lowpass",1000,10,10000,1);
rt = rTermination(basicBlock,*(-1) : si.smooth(1.0-2*(fc/ma.SR)));
......@@ -35,11 +33,13 @@ 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
exc = select2(gain>0.9,1,0);
length = hslider("length",1,0.1,10,0.01):si.smoo;
process = idString(length,0.15, button("trigger")) <: _,_;
\ 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