_id
stringlengths
64
64
repository
stringlengths
7
61
name
stringlengths
5
45
content
stringlengths
0
943k
download_url
stringlengths
94
213
language
stringclasses
1 value
comments
stringlengths
0
20.9k
code
stringlengths
0
943k
b23d504e48c8971f7eeb75e75cbf9919b48ca6d425c6b83d14abed86848781b8
amstramgrame/amstramgrame
exfaust0.dsp
import("stdfaust.lib"); process = os.osc(440);
https://raw.githubusercontent.com/amstramgrame/amstramgrame/0a95b84df000a2f478703787e7bec77ad301880e/web/mkdocs/docs/scenari/hello-world/exfaust0/exfaust0.dsp
faust
import("stdfaust.lib"); process = os.osc(440);
2d0faf189f6117a8ad01a402c142f2549aea795f5b445969c1423e1237f61653
amstramgrame/amstramgrame
exfaust0.dsp
import("stdfaust.lib"); freq = 440; process = os.sawtooth(freq);
https://raw.githubusercontent.com/amstramgrame/amstramgrame/0a95b84df000a2f478703787e7bec77ad301880e/docs/gramophone/programming/exfaust0/exfaust0.dsp
faust
import("stdfaust.lib"); freq = 440; process = os.sawtooth(freq);
a04e8100ef970dfee778808b888b9b2e9689e33c04977d4f0a0965c3d136187d
amstramgrame/amstramgrame
exfaust1.dsp
import("stdfaust.lib"); process = os.osc(440)*button("on-off");
https://raw.githubusercontent.com/amstramgrame/amstramgrame/0a95b84df000a2f478703787e7bec77ad301880e/web/mkdocs/docs/scenari/hello-world/exfaust1/exfaust1.dsp
faust
import("stdfaust.lib"); process = os.osc(440)*button("on-off");
a2211a952fcca9dfc909c638d069bd6bd88c4ad6447d66dee172efc1d652f667
amstramgrame/amstramgrame
exfaust2.dsp
import("stdfaust.lib"); on = button("on-off"); process = os.osc(440)*on;
https://raw.githubusercontent.com/amstramgrame/amstramgrame/0a95b84df000a2f478703787e7bec77ad301880e/docs/scenari/hello-world/exfaust2/exfaust2.dsp
faust
import("stdfaust.lib"); on = button("on-off"); process = os.osc(440)*on;
cfc0ef5c8a476781cb2f4fd3c622e574fede2f30f5b8ff64d48d2562dda29bfb
amstramgrame/amstramgrame
exfaust1.dsp
import("stdfaust.lib"); freq = hslider("frequence",440,20,3000,1); process = os.osc(freq);
https://raw.githubusercontent.com/amstramgrame/amstramgrame/0a95b84df000a2f478703787e7bec77ad301880e/web/mkdocs/docs/scenari/hello-world-gramo/exfaust1/exfaust1.dsp
faust
import("stdfaust.lib"); freq = hslider("frequence",440,20,3000,1); process = os.osc(freq);
5409073f7034410b50c19d50d56053aa6248f0413f65566fb1227a1a190f25ce
amstramgrame/amstramgrame
exfaust3.dsp
import("stdfaust.lib"); on = button("on-off"); process = os.osc(hslider("frequence",440,20,3000,1))*on;
https://raw.githubusercontent.com/amstramgrame/amstramgrame/0a95b84df000a2f478703787e7bec77ad301880e/web/mkdocs/docs/scenari/hello-world/exfaust3/exfaust3.dsp
faust
import("stdfaust.lib"); on = button("on-off"); process = os.osc(hslider("frequence",440,20,3000,1))*on;
5876c860d6f7d65007f9c1e9673682c45815a78680f77cca19d658788c447950
amstramgrame/amstramgrame
exfaust4.dsp
import("stdfaust.lib"); on = button("on-off"); freq = hslider("frequence",440,20,3000,1); process = os.osc(freq)*on;
https://raw.githubusercontent.com/amstramgrame/amstramgrame/0a95b84df000a2f478703787e7bec77ad301880e/docs/scenari/hello-world/exfaust4/exfaust4.dsp
faust
import("stdfaust.lib"); on = button("on-off"); freq = hslider("frequence",440,20,3000,1); process = os.osc(freq)*on;
f937d59ed83561c528186baf3acd180f3080b60982f744ddaa13f1428fa94cb6
amstramgrame/amstramgrame
exfaust1.dsp
import("stdfaust.lib"); impFreq = hslider("impFreq",11,2,20,0.01) : si.smoo; process = os.lf_imptrain(impFreq);
https://raw.githubusercontent.com/amstramgrame/amstramgrame/0a95b84df000a2f478703787e7bec77ad301880e/web/mkdocs/docs/scenari/examples/exfaust1/exfaust1.dsp
faust
import("stdfaust.lib"); impFreq = hslider("impFreq",11,2,20,0.01) : si.smoo; process = os.lf_imptrain(impFreq);
deca68442c5046366d5280f482b1335871fd6aec8b049914a822ad4e8f2552fe
amstramgrame/amstramgrame
exfaust3.dsp
import("stdfaust.lib"); on = button("on-off[switch:1]"); freq = hslider("frequence[knob:3]",440,20,3000,1); process = os.osc(freq)*on;
https://raw.githubusercontent.com/amstramgrame/amstramgrame/0a95b84df000a2f478703787e7bec77ad301880e/web/mkdocs/docs/scenari/hello-world-gramo/exfaust3/exfaust3.dsp
faust
import("stdfaust.lib"); on = button("on-off[switch:1]"); freq = hslider("frequence[knob:3]",440,20,3000,1); process = os.osc(freq)*on;
1d993a600c6fa69566e16d3e4ae4d3d686b442b8e0cdf6290334b2287499b206
amstramgrame/amstramgrame
exfaust2.dsp
import("stdfaust.lib"); on = button("on-off[switch:1]"); freq = hslider("frequence[knob:2]",440,20,3000,1); process = os.osc(freq)*on;
https://raw.githubusercontent.com/amstramgrame/amstramgrame/0a95b84df000a2f478703787e7bec77ad301880e/web/mkdocs/docs/scenari/hello-world-gramo/exfaust2/exfaust2.dsp
faust
import("stdfaust.lib"); on = button("on-off[switch:1]"); freq = hslider("frequence[knob:2]",440,20,3000,1); process = os.osc(freq)*on;
afa1b7adf28a37ef564966a0e94542d21ef2d609984eb619803650a06f7a05f5
amstramgrame/amstramgrame
exfaust17.dsp
import("stdfaust.lib"); // parameters freq = hslider("freq[knob:3]",300,100,4000,0.01) : si.smoo; gate = button("gate[switch:1]") : si.smoo; // DSP process = os.osc(freq)*gate;
https://raw.githubusercontent.com/amstramgrame/amstramgrame/4df99bfbae994fc9dcb4012190335e29255b411e/web/mkdocs/docs/gramophone/programs/exfaust17/exfaust17.dsp
faust
parameters DSP
import("stdfaust.lib"); freq = hslider("freq[knob:3]",300,100,4000,0.01) : si.smoo; gate = button("gate[switch:1]") : si.smoo; process = os.osc(freq)*gate;
a7bde250789a3984ba51f5f7a6f128fa340f10dfe3010ffa9df30c72b11584ff
amstramgrame/amstramgrame
exfaust0.dsp
import("stdfaust.lib"); freq = hslider("freq[acc: 0 0 -10 0 10]",1050,100,2000,0.01) : si.smoo; gate = checkbox("gate[switch:1]") : si.smoo; process = os.osc(freq)*gate;
https://raw.githubusercontent.com/amstramgrame/amstramgrame/0a95b84df000a2f478703787e7bec77ad301880e/web/mkdocs/docs/scenari/gesture/exfaust0/exfaust0.dsp
faust
import("stdfaust.lib"); freq = hslider("freq[acc: 0 0 -10 0 10]",1050,100,2000,0.01) : si.smoo; gate = checkbox("gate[switch:1]") : si.smoo; process = os.osc(freq)*gate;
b8b3b98d1d78453971a67facc925bcf1509b54b018f78f4dad8a181a2616ddc5
amstramgrame/amstramgrame
exfaust2.dsp
import("stdfaust.lib"); freq = hslider("freq[acc: 0 1 -10 0 10]",200,100,2000,0.01) : si.smoo; gate = checkbox("gate[switch:1]") : si.smoo; process = os.osc(freq)*gate;
https://raw.githubusercontent.com/amstramgrame/amstramgrame/0a95b84df000a2f478703787e7bec77ad301880e/web/mkdocs/docs/scenari/gesture/exfaust2/exfaust2.dsp
faust
import("stdfaust.lib"); freq = hslider("freq[acc: 0 1 -10 0 10]",200,100,2000,0.01) : si.smoo; gate = checkbox("gate[switch:1]") : si.smoo; process = os.osc(freq)*gate;
41895899cde63cd3f374c2ae3f32ac8850ebcf7df6d393c9a673c371209eb9de
amstramgrame/amstramgrame
exfaust1.dsp
import("stdfaust.lib"); freq = hslider("freq[acc: 0 1 -10 0 10]",1050,100,2000,0.01) : si.smoo; gate = checkbox("gate[switch:1]") : si.smoo; process = os.osc(freq)*gate;
https://raw.githubusercontent.com/amstramgrame/amstramgrame/0a95b84df000a2f478703787e7bec77ad301880e/web/mkdocs/docs/scenari/gesture/exfaust1/exfaust1.dsp
faust
import("stdfaust.lib"); freq = hslider("freq[acc: 0 1 -10 0 10]",1050,100,2000,0.01) : si.smoo; gate = checkbox("gate[switch:1]") : si.smoo; process = os.osc(freq)*gate;
e438cf5099ce425096f93ba24b06d5e819d57cedf7d857152dbd88fe453f131e
amstramgrame/amstramgrame
exfaust3.dsp
import("stdfaust.lib"); freq = hslider("freq[acc: 0 0 -10 0 10]",200,100,2000,0.01) : si.smoo; gain = hslider("gain[acc: 1 0 -10 0 10]",0.5,0,1,0.01) : si.smoo; gate = checkbox("gate[switch:1]") : si.smoo; process = os.osc(freq)*gain*gate;
https://raw.githubusercontent.com/amstramgrame/amstramgrame/0a95b84df000a2f478703787e7bec77ad301880e/web/mkdocs/docs/scenari/gesture/exfaust3/exfaust3.dsp
faust
import("stdfaust.lib"); freq = hslider("freq[acc: 0 0 -10 0 10]",200,100,2000,0.01) : si.smoo; gain = hslider("gain[acc: 1 0 -10 0 10]",0.5,0,1,0.01) : si.smoo; gate = checkbox("gate[switch:1]") : si.smoo; process = os.osc(freq)*gain*gate;
11149682001b8240eb32117f7da2d5afcd3cdfb4854576d637013308da75bbe3
amstramgrame/amstramgrame
exfaust19.dsp
import("stdfaust.lib"); // parameters gate = button("gate[switch:1]"); gain = hslider("gain[acc: 0 1 -10 0 10]",0.5,0,1,0.01)^2; del = hslider("del[acc: 1 0 -10 0 10]",525,50,1000,1) : si.smoo; fb = hslider("fb[knob:2]",0.7,0.5,1,0.001); process = no.noise*gate*gain : fi.fb_fcomb(1024,del,1,fb);
https://raw.githubusercontent.com/amstramgrame/amstramgrame/4df99bfbae994fc9dcb4012190335e29255b411e/docs/gramophone/programs/exfaust19/exfaust19.dsp
faust
parameters
import("stdfaust.lib"); gate = button("gate[switch:1]"); gain = hslider("gain[acc: 0 1 -10 0 10]",0.5,0,1,0.01)^2; del = hslider("del[acc: 1 0 -10 0 10]",525,50,1000,1) : si.smoo; fb = hslider("fb[knob:2]",0.7,0.5,1,0.001); process = no.noise*gate*gain : fi.fb_fcomb(1024,del,1,fb);
f87e65e3654358851bbb2c94913b2e036661d5f38710107268c1dad8d86913d3
amstramgrame/amstramgrame
exfaust2.dsp
import("stdfaust.lib"); impFreq = hslider("impFreq",11,2,20,0.01) : si.smoo; resFreq = hslider("resFreq",1650,300,3000,0.01) : si.smoo; q = hslider("q[knob:3]",30,10,50,0.01) : si.smoo; process = os.lf_imptrain(impFreq) : fi.resonlp(resFreq,q,1);
https://raw.githubusercontent.com/amstramgrame/amstramgrame/0a95b84df000a2f478703787e7bec77ad301880e/docs/scenari/examples/exfaust2/exfaust2.dsp
faust
import("stdfaust.lib"); impFreq = hslider("impFreq",11,2,20,0.01) : si.smoo; resFreq = hslider("resFreq",1650,300,3000,0.01) : si.smoo; q = hslider("q[knob:3]",30,10,50,0.01) : si.smoo; process = os.lf_imptrain(impFreq) : fi.resonlp(resFreq,q,1);
ce9ed66bfadbc240b0a70eee564e0ff5333d3a04c8b046dc0bc0231470e6f0a1
amstramgrame/amstramgrame
exfaust3.dsp
import("stdfaust.lib"); gate = button("gate[switch:1]") : si.smoo; freqOsc = hslider("freqOsc[knob:2]",196,98,784,0.01) : si.smoo; posPied = hslider("posPied[acc: 0 0 -10 0 10 ]",0.5,0,1,0.01) : si.smoo; process = os.lf_saw(freqOsc) * gate : ve.crybaby(posPied);
https://raw.githubusercontent.com/amstramgrame/amstramgrame/0a95b84df000a2f478703787e7bec77ad301880e/web/mkdocs/docs/scenari/allier20/exfaust3/exfaust3.dsp
faust
import("stdfaust.lib"); gate = button("gate[switch:1]") : si.smoo; freqOsc = hslider("freqOsc[knob:2]",196,98,784,0.01) : si.smoo; posPied = hslider("posPied[acc: 0 0 -10 0 10 ]",0.5,0,1,0.01) : si.smoo; process = os.lf_saw(freqOsc) * gate : ve.crybaby(posPied);
2ca6b5785a25562058805c72af4419cd70d1ceb0bc682a825e367a9458f8f5a0
amstramgrame/amstramgrame
exfaust0.dsp
import("stdfaust.lib"); gain = hslider ("[2]volume", 0.5, 0.0, 1.0, 0.001); wah = hslider ("[1]wah[acc: 0 2 -10 0 10]", 0.5, 0, 1, 0.01); gate = button("gate[switch:1]"); freq = ba.midikey2hz (hslider ("[0]freq[knob:2]", 23, 23, 26, 1)); timbre(freq) = (os.osc (freq) + 0.5 *os.square(2*freq) + 0.25*os.triangle (3*freq))/3; process = (timbre(freq) : ve.crybaby(wah)) * gain *gate;
https://raw.githubusercontent.com/amstramgrame/amstramgrame/0a95b84df000a2f478703787e7bec77ad301880e/docs/scenari/paysage-sonore/exfaust0/exfaust0.dsp
faust
import("stdfaust.lib"); gain = hslider ("[2]volume", 0.5, 0.0, 1.0, 0.001); wah = hslider ("[1]wah[acc: 0 2 -10 0 10]", 0.5, 0, 1, 0.01); gate = button("gate[switch:1]"); freq = ba.midikey2hz (hslider ("[0]freq[knob:2]", 23, 23, 26, 1)); timbre(freq) = (os.osc (freq) + 0.5 *os.square(2*freq) + 0.25*os.triangle (3*freq))/3; process = (timbre(freq) : ve.crybaby(wah)) * gain *gate;
d1df7b86639b01a3cdb9df16f7780951a59d34074a5b7deda4f1d13d5eb73b6a
amstramgrame/amstramgrame
clarinet.dsp
import("stdfaust.lib"); // parameters gate = button("gate[switch:1]"); p = hslider("p[acc: 0 1 -10 0 10]",0.5,0,1,0.01); reed = hslider("reed[knob:3]",0.5,0,1,0.01) : si.smoo; bell = hslider("bell[acc: 2 0 -10 0 10]",0.5,0,1,0.01) : si.smoo; tube = hslider("note[knob:2]",60,40,70,3) : ba.midikey2hz : pm.f2l; // additional mappings pres = gate*p; process = pm.clarinetModel(tube,pres,reed,bell);
https://raw.githubusercontent.com/amstramgrame/amstramgrame/0a95b84df000a2f478703787e7bec77ad301880e/examples/clarinet.dsp
faust
parameters additional mappings
import("stdfaust.lib"); gate = button("gate[switch:1]"); p = hslider("p[acc: 0 1 -10 0 10]",0.5,0,1,0.01); reed = hslider("reed[knob:3]",0.5,0,1,0.01) : si.smoo; bell = hslider("bell[acc: 2 0 -10 0 10]",0.5,0,1,0.01) : si.smoo; tube = hslider("note[knob:2]",60,40,70,3) : ba.midikey2hz : pm.f2l; pres = gate*p; process = pm.clarinetModel(tube,pres,reed,bell);
ca9cd6fe1925f89e01f7f2380a995b6bd0fb9ec89aed7a48f3cdf6c6d0c2398c
amstramgrame/amstramgrame
exfaust22.dsp
import("stdfaust.lib"); // parameters gate = checkbox("gate[switch:1]"); stringLength = hslider("stringLength[knob:2]",1.5,0.5,3,0.01); bowVelocity = hslider("p[acc: 0 1 -10 0 10]",0.1,0,1,0.01)*gate; bowPressure = hslider("lips[gyr: 0 0 -10 0 10]",0.5,0,1,0.01) : si.smoo; bowPosition = hslider("dist[acc: 1 0 -10 0 10]",0.5,0,1,0.01) : si.smoo; process = pm.violinModel(stringLength,bowPressure,bowVelocity,bowPosition);
https://raw.githubusercontent.com/amstramgrame/amstramgrame/4df99bfbae994fc9dcb4012190335e29255b411e/docs/gramophone/programs/exfaust22/exfaust22.dsp
faust
parameters
import("stdfaust.lib"); gate = checkbox("gate[switch:1]"); stringLength = hslider("stringLength[knob:2]",1.5,0.5,3,0.01); bowVelocity = hslider("p[acc: 0 1 -10 0 10]",0.1,0,1,0.01)*gate; bowPressure = hslider("lips[gyr: 0 0 -10 0 10]",0.5,0,1,0.01) : si.smoo; bowPosition = hslider("dist[acc: 1 0 -10 0 10]",0.5,0,1,0.01) : si.smoo; process = pm.violinModel(stringLength,bowPressure,bowVelocity,bowPosition);
c455a4752d8be6c92d4b301ea4cd6b5edf0772f35455c1a2b18f42966b20bb31
amstramgrame/amstramgrame
exfaust0.dsp
import("stdfaust.lib"); gate = button("gate[switch:1]"); freqm = hslider("freqm[acc: 1 0 -10 0 10]",500,100,2000,1); modem = hslider("modem[knob:2]",1,0,4,1); tempo = 480; envtrig = ba.beat(tempo) * gate; del = hslider("del[acc: 0 1 -10 0 10]",0,0,0.1,0.01) : si.smoo; //fb = hslider("fb[knob:3]",0.5,0,0.8,0.01) : si.smoo; process = pm.strike(1,0.8,1,envtrig) : pm.marimbaModel(freqm,modem) : ef.echo(0.4,del,0.8);
https://raw.githubusercontent.com/amstramgrame/amstramgrame/0a95b84df000a2f478703787e7bec77ad301880e/docs/scenari/allier20/exfaust0/exfaust0.dsp
faust
fb = hslider("fb[knob:3]",0.5,0,0.8,0.01) : si.smoo;
import("stdfaust.lib"); gate = button("gate[switch:1]"); freqm = hslider("freqm[acc: 1 0 -10 0 10]",500,100,2000,1); modem = hslider("modem[knob:2]",1,0,4,1); tempo = 480; envtrig = ba.beat(tempo) * gate; del = hslider("del[acc: 0 1 -10 0 10]",0,0,0.1,0.01) : si.smoo; process = pm.strike(1,0.8,1,envtrig) : pm.marimbaModel(freqm,modem) : ef.echo(0.4,del,0.8);
b4701401ddbc2607f67676f145af1d9788a14f56047d99ec039ef4d560b8d207
amstramgrame/amstramgrame
exfaust7.dsp
import("stdfaust.lib"); gate = button("gate[switch:1]") : si.smoo; longueur_Debut = hslider("longueur_Debut[knob:2]",2,0,5,0.01) : si.smoo; longueur_Fin = hslider("longueur_Fin[knob:2]",2,0,5,0.01) : si.smoo; freqFilt = hslider("freqFilt[acc: 0 0 -10 0 10 ]",300,100,1000,0.1) : si.smoo; process = no.noise * en.ar(longueur_Debut,longueur_Fin,gate) : fi.resonbp(freqFilt,10,0.5);
https://raw.githubusercontent.com/amstramgrame/amstramgrame/0a95b84df000a2f478703787e7bec77ad301880e/docs/scenari/allier20/exfaust7/exfaust7.dsp
faust
import("stdfaust.lib"); gate = button("gate[switch:1]") : si.smoo; longueur_Debut = hslider("longueur_Debut[knob:2]",2,0,5,0.01) : si.smoo; longueur_Fin = hslider("longueur_Fin[knob:2]",2,0,5,0.01) : si.smoo; freqFilt = hslider("freqFilt[acc: 0 0 -10 0 10 ]",300,100,1000,0.1) : si.smoo; process = no.noise * en.ar(longueur_Debut,longueur_Fin,gate) : fi.resonbp(freqFilt,10,0.5);
7d10e46327cbd766cdd5cf186b87366e6be36f437cfd731a528e16ae77902d41
amstramgrame/amstramgrame
exfaust21.dsp
import("stdfaust.lib"); // parameters gate = checkbox("gate[switch:1]"); p = hslider("p[acc: 0 1 -10 0 10]",0.5,0,1,0.01) : si.smoo; lips = hslider("lips[acc: 2 0 -10 0 10]",0.5,0,1,0.01) : si.smoo; tube = hslider("note[acc: 1 0 -10 0 10]",60,40,70,3) : ba.midikey2hz : pm.f2l; dist = hslider("dist[knob:2]",0,0,1,0.01) : si.smoo; // mappings pres = gate*p; process = pm.brassModel(tube,lips,0,pres) : ef.cubicnl(dist,0)*0.95;
https://raw.githubusercontent.com/amstramgrame/amstramgrame/4df99bfbae994fc9dcb4012190335e29255b411e/docs/gramophone/programs/exfaust21/exfaust21.dsp
faust
parameters mappings
import("stdfaust.lib"); gate = checkbox("gate[switch:1]"); p = hslider("p[acc: 0 1 -10 0 10]",0.5,0,1,0.01) : si.smoo; lips = hslider("lips[acc: 2 0 -10 0 10]",0.5,0,1,0.01) : si.smoo; tube = hslider("note[acc: 1 0 -10 0 10]",60,40,70,3) : ba.midikey2hz : pm.f2l; dist = hslider("dist[knob:2]",0,0,1,0.01) : si.smoo; pres = gate*p; process = pm.brassModel(tube,lips,0,pres) : ef.cubicnl(dist,0)*0.95;
5b0e60e1180a8e7cc1bafca9f58d13f1f6dbf2c0245aa832201378933ac9b2ed
amstramgrame/amstramgrame
exfaust1.dsp
import("stdfaust.lib"); process = bong,bang :> _; bong = os.square(boEnv*150+no.noise*100*boEnv)*boEnv:fi.lowpass3e(100+800*boEnv); boEnv = button("bong[switch:1]"):ba.impulsify:en.ar(0.01,0.4); bang = no.noise:fi.bandpass(2,1000,3000)*baEnv:ef.echo(0.2,0.2,0.2)*2; baEnv = (hslider("bang[acc:1 0 -10 0 10]",4,0,10,1)>9):ba.impulsify:en.ar(0.01,0.2);
https://raw.githubusercontent.com/amstramgrame/amstramgrame/0a95b84df000a2f478703787e7bec77ad301880e/docs/scenari/allier20/exfaust1/exfaust1.dsp
faust
import("stdfaust.lib"); process = bong,bang :> _; bong = os.square(boEnv*150+no.noise*100*boEnv)*boEnv:fi.lowpass3e(100+800*boEnv); boEnv = button("bong[switch:1]"):ba.impulsify:en.ar(0.01,0.4); bang = no.noise:fi.bandpass(2,1000,3000)*baEnv:ef.echo(0.2,0.2,0.2)*2; baEnv = (hslider("bang[acc:1 0 -10 0 10]",4,0,10,1)>9):ba.impulsify:en.ar(0.01,0.2);
c3f453df283e36737d53c0168d93a3e84f15605a4dd1bc641e521d1f520d7450
amstramgrame/amstramgrame
exfaust1.dsp
import("stdfaust.lib"); gate = checkbox ("[2]ON / OFF"); gain = vslider("Volume", 0.8, 0, 1, 0.001) : si.smoo; freq = ba.midikey2hz (vslider ("[1]Freq_Note (LA, SIb, SI, DO)", 23, 23, 26, 1)); wah = vslider ("Wah[acc: 0 3 -10 0 10]", 0.5, 0, 1, 0.001) : si.smoo; timbre(freq) = (os.osc (freq) + 0.5 *os.osc (2*freq) + 0.25 * os.triangle(3*freq)); process = hgroup ("Digeridoo", (timbre(freq) : ve.crybaby(wah)) * gain) *gate;
https://raw.githubusercontent.com/amstramgrame/amstramgrame/0a95b84df000a2f478703787e7bec77ad301880e/web/mkdocs/docs/scenari/paysage-sonore/exfaust1/exfaust1.dsp
faust
import("stdfaust.lib"); gate = checkbox ("[2]ON / OFF"); gain = vslider("Volume", 0.8, 0, 1, 0.001) : si.smoo; freq = ba.midikey2hz (vslider ("[1]Freq_Note (LA, SIb, SI, DO)", 23, 23, 26, 1)); wah = vslider ("Wah[acc: 0 3 -10 0 10]", 0.5, 0, 1, 0.001) : si.smoo; timbre(freq) = (os.osc (freq) + 0.5 *os.osc (2*freq) + 0.25 * os.triangle(3*freq)); process = hgroup ("Digeridoo", (timbre(freq) : ve.crybaby(wah)) * gain) *gate;
7b0427a047f4fe2a843bdf766ef2d585435965e29684770886cf2e53e1e363f7
amstramgrame/amstramgrame
exfaust18.dsp
import("stdfaust.lib"); // parameters gate = button("gate[switch:1]"); pressure = hslider("pressure[acc: 0 1 -10 0 10]",0.5,0,1,0.01); reed = hslider("reed[knob:3]",0.5,0,1,0.01) : si.smooth(0.99); bell = hslider("bell[acc: 2 0 -10 0 10]",0.5,0,1,0.01) : si.smooth(0.99); tube = hslider("note[knob:2]",60,40,70,3) : ba.midikey2hz : pm.f2l : si.smooth(0.99); // additional mappings pres = gate*pressure : si.smooth(0.99); process = pm.clarinetModel(tube,pres,reed,bell);
https://raw.githubusercontent.com/amstramgrame/amstramgrame/4df99bfbae994fc9dcb4012190335e29255b411e/web/mkdocs/docs/gramophone/programs/exfaust18/exfaust18.dsp
faust
parameters additional mappings
import("stdfaust.lib"); gate = button("gate[switch:1]"); pressure = hslider("pressure[acc: 0 1 -10 0 10]",0.5,0,1,0.01); reed = hslider("reed[knob:3]",0.5,0,1,0.01) : si.smooth(0.99); bell = hslider("bell[acc: 2 0 -10 0 10]",0.5,0,1,0.01) : si.smooth(0.99); tube = hslider("note[knob:2]",60,40,70,3) : ba.midikey2hz : pm.f2l : si.smooth(0.99); pres = gate*pressure : si.smooth(0.99); process = pm.clarinetModel(tube,pres,reed,bell);
fafee5e68b977c062ee13f3c5a0da0e15ef6d40185f89b01b0e4b59d68debdf0
amstramgrame/amstramgrame
exfaust6.dsp
import("stdfaust.lib"); random (n,m) = (1 + no.noise)/2 * (m-n) + n : int; gain = hslider ("v:crépitements/volume", 1, 0.1, 1, 0.01); gate = checkbox ("gate[switch:1]"); echo = +~ (@(delLenght-1) : *(feedback)) with { duration = 400 * 0.001; feedback = 0.15; delLenght = ma.SR * duration; }; crepit = ba.beat (random (370, 380)) : echo; feu = os.osc (freqnoise* no.pink_noise); freqnoise = hslider ("v:feu/freq[knob:2]", 400, 20, 680, 1) : si.smoo; process = (feu * gate/3), (crepit * 2 * gain * gate);
https://raw.githubusercontent.com/amstramgrame/amstramgrame/0a95b84df000a2f478703787e7bec77ad301880e/web/mkdocs/docs/scenari/paysage-sonore/exfaust6/exfaust6.dsp
faust
import("stdfaust.lib"); random (n,m) = (1 + no.noise)/2 * (m-n) + n : int; gain = hslider ("v:crépitements/volume", 1, 0.1, 1, 0.01); gate = checkbox ("gate[switch:1]"); echo = +~ (@(delLenght-1) : *(feedback)) with { duration = 400 * 0.001; feedback = 0.15; delLenght = ma.SR * duration; }; crepit = ba.beat (random (370, 380)) : echo; feu = os.osc (freqnoise* no.pink_noise); freqnoise = hslider ("v:feu/freq[knob:2]", 400, 20, 680, 1) : si.smoo; process = (feu * gate/3), (crepit * 2 * gain * gate);
0d79fe7ea3f408250a90919518d9eec1156049c29501e75d07c2d6bdb2da8c9f
amstramgrame/amstramgrame
exfaust2.dsp
import("stdfaust.lib"); subSynth (ctFreq) = no.pink_noise : fi.lowpass(1, ctfreq1); ctfreq1 = hslider("cutoff_freq vagues[knob:2]",5500,30,15000,0.01) : si.smoo; gain = hslider("volume[knob:1]",1,0,1,0.01); shake_x = hslider("X rotation[acc: 0 1 -10 0 10]", 0, -100, 100, 0.01); declenche = _ : abs > 75; gate = shake_x : declenche; envelope = en.adsr(0.1,0.01,0.9,5,gate)*gain; subSynth2 = no.noise : fi.lowpass (1, 1700); process = subSynth2 * 0.04 + (subSynth(ctfreq1) * envelope) <:_,_;
https://raw.githubusercontent.com/amstramgrame/amstramgrame/0a95b84df000a2f478703787e7bec77ad301880e/docs/scenari/paysage-sonore/exfaust2/exfaust2.dsp
faust
import("stdfaust.lib"); subSynth (ctFreq) = no.pink_noise : fi.lowpass(1, ctfreq1); ctfreq1 = hslider("cutoff_freq vagues[knob:2]",5500,30,15000,0.01) : si.smoo; gain = hslider("volume[knob:1]",1,0,1,0.01); shake_x = hslider("X rotation[acc: 0 1 -10 0 10]", 0, -100, 100, 0.01); declenche = _ : abs > 75; gate = shake_x : declenche; envelope = en.adsr(0.1,0.01,0.9,5,gate)*gain; subSynth2 = no.noise : fi.lowpass (1, 1700); process = subSynth2 * 0.04 + (subSynth(ctfreq1) * envelope) <:_,_;
58f4a74fce6342e6773aecff244119ffc13ebf80d4b07bda99cd15e1210af06e
amstramgrame/amstramgrame
exfaust6.dsp
import("stdfaust.lib"); process = sy.fm(frqs(note1:gamme),indices)*lfo,sy.fm(frqs(note2:gamme),indices)*(1-lfo) :> _*onOff; frqs(f) = (f,3*f,5*f); indices = (120,500); note1 = hslider("freq1[acc:0 0 -10 0 10]",150,100,200,1); note2 = hslider("freq2[acc:1 0 -10 0 10]",200,150,300,1); onOff = button("on-off[switch:1]"):si.smoo; lfo = os.osc(speed)*0.5+0.5; speed = hslider("speed[knob:2]",3,1,10,0.1); gamme = _:ba.hz2midikey:int<: int(_/12)*12,(_%12<:_+(_==0)+(_==3)+(_==5)-(_==10)): +:ba.midikey2hz;
https://raw.githubusercontent.com/amstramgrame/amstramgrame/0a95b84df000a2f478703787e7bec77ad301880e/docs/scenari/allier20/exfaust6/exfaust6.dsp
faust
import("stdfaust.lib"); process = sy.fm(frqs(note1:gamme),indices)*lfo,sy.fm(frqs(note2:gamme),indices)*(1-lfo) :> _*onOff; frqs(f) = (f,3*f,5*f); indices = (120,500); note1 = hslider("freq1[acc:0 0 -10 0 10]",150,100,200,1); note2 = hslider("freq2[acc:1 0 -10 0 10]",200,150,300,1); onOff = button("on-off[switch:1]"):si.smoo; lfo = os.osc(speed)*0.5+0.5; speed = hslider("speed[knob:2]",3,1,10,0.1); gamme = _:ba.hz2midikey:int<: int(_/12)*12,(_%12<:_+(_==0)+(_==3)+(_==5)-(_==10)): +:ba.midikey2hz;
47e341e171bbeba4288ec5043ce6baf0f155a65702ea1c6aaf4f102eb7b3705e
amstramgrame/amstramgrame
exfaust20.dsp
import("stdfaust.lib"); // parameters gate = checkbox("gate[switch:1]") : si.smoo; freq0 = hslider("freq0[knob:2]",200,50,500,0.01) : si.smoo; ratio1 = hslider("ratio1[acc: 0 1 -10 0 10]",1.5,1,2,0.01) : si.smoo; ratio2 = hslider("ratio2[acc: 1 0 -10 0 10]",1.5,1,2,0.01) : si.smoo; index1 = hslider("index1[acc: 1 1 -10 0 10]",500,0,1000,0.01) : si.smoo; index2 = hslider("index2[knob:3]",500,0,1000,0.01) : si.smoo; // mappings freq1 = freq0*ratio1; freq2 = freq1*ratio2; process = sy.fm((freq0,freq1,freq2),(index1,index2))*gate;
https://raw.githubusercontent.com/amstramgrame/amstramgrame/4df99bfbae994fc9dcb4012190335e29255b411e/docs/gramophone/programs/exfaust20/exfaust20.dsp
faust
parameters mappings
import("stdfaust.lib"); gate = checkbox("gate[switch:1]") : si.smoo; freq0 = hslider("freq0[knob:2]",200,50,500,0.01) : si.smoo; ratio1 = hslider("ratio1[acc: 0 1 -10 0 10]",1.5,1,2,0.01) : si.smoo; ratio2 = hslider("ratio2[acc: 1 0 -10 0 10]",1.5,1,2,0.01) : si.smoo; index1 = hslider("index1[acc: 1 1 -10 0 10]",500,0,1000,0.01) : si.smoo; index2 = hslider("index2[knob:3]",500,0,1000,0.01) : si.smoo; freq1 = freq0*ratio1; freq2 = freq1*ratio2; process = sy.fm((freq0,freq1,freq2),(index1,index2))*gate;
fe6c442489e6a14d6cfb60b4f043a535ec10e20f5d09b7abdacc54efa8ab7304
amstramgrame/amstramgrame
exfaust5.dsp
import("stdfaust.lib"); process = os.sawtooth(freq:gamme:si.smooth(0.999)) : fi.lowpass3e(1000*env+10)*env:ef.echo(0.2,0.2,fdbk); gamme = _ : ba.hz2midikey : int <: // cette fonction sert à jouer les notes de la gamme int(_/12)*12,(_%12<:_+(_==0)+(_==3)+(_==5)-(_==10)) : + : ba.midikey2hz; freq = hslider("freq[acc:0 0 -10 0 10]",400,200,800,1); fdbk = hslider("feedback[knob:2]",0,0,0.9,0.01); env = button("on[switch:1]"):en.adsr(0.3,0.1,1,0.3):si.smooth(0.9); // le smooth supprime les 'pop' quand on appuie sur le boutton.
https://raw.githubusercontent.com/amstramgrame/amstramgrame/0a95b84df000a2f478703787e7bec77ad301880e/web/mkdocs/docs/scenari/allier20/exfaust5/exfaust5.dsp
faust
cette fonction sert à jouer les notes de la gamme le smooth supprime les 'pop' quand on appuie sur le boutton.
import("stdfaust.lib"); process = os.sawtooth(freq:gamme:si.smooth(0.999)) : fi.lowpass3e(1000*env+10)*env:ef.echo(0.2,0.2,fdbk); int(_/12)*12,(_%12<:_+(_==0)+(_==3)+(_==5)-(_==10)) : + : ba.midikey2hz; freq = hslider("freq[acc:0 0 -10 0 10]",400,200,800,1); fdbk = hslider("feedback[knob:2]",0,0,0.9,0.01); env = button("on[switch:1]"):en.adsr(0.3,0.1,1,0.3):si.smooth(0.9);
50b86fec51d583b4da4e221612ca856abaf8b2ac19605a4594d621416dc5344d
amstramgrame/amstramgrame
exfaust4.dsp
import ("stdfaust.lib"); gain = hslider ("Volume", 0.8, 0, 1, 0.001) : si.smoo; gate = checkbox ("On / Off[switch:1]"); basse = ba.beat (bpm_basse) : pm.djembe(75, 0.2, 0.3, 1); tone = ba.beat (bpm_tone) : pm.djembe(300, 0.7, 0.3, 0.7); slap = ba.beat (bpm_slap) : pm.djembe(550, 0.9, 0.3, 0.4); s = hslider ("Sel[knob:2]", 0, 0, 2, 1); bpm_basse = 60; bpm_tone = hslider ("Bpm_tone[acc: 0 0 -10 0 10]", 120, 60, 240, 1) : si.smoo; bpm_slap = hslider ("Bpm_slap[acc: 0 0 -10 0 10]", 60, 30, 120, 1) : si.smoo; process = (basse, basse + tone, basse + tone + slap) : select3 (s) * gate;
https://raw.githubusercontent.com/amstramgrame/amstramgrame/0a95b84df000a2f478703787e7bec77ad301880e/web/mkdocs/docs/scenari/paysage-sonore/exfaust4/exfaust4.dsp
faust
import ("stdfaust.lib"); gain = hslider ("Volume", 0.8, 0, 1, 0.001) : si.smoo; gate = checkbox ("On / Off[switch:1]"); basse = ba.beat (bpm_basse) : pm.djembe(75, 0.2, 0.3, 1); tone = ba.beat (bpm_tone) : pm.djembe(300, 0.7, 0.3, 0.7); slap = ba.beat (bpm_slap) : pm.djembe(550, 0.9, 0.3, 0.4); s = hslider ("Sel[knob:2]", 0, 0, 2, 1); bpm_basse = 60; bpm_tone = hslider ("Bpm_tone[acc: 0 0 -10 0 10]", 120, 60, 240, 1) : si.smoo; bpm_slap = hslider ("Bpm_slap[acc: 0 0 -10 0 10]", 60, 30, 120, 1) : si.smoo; process = (basse, basse + tone, basse + tone + slap) : select3 (s) * gate;
cf1b406792a60be80e662ae6e3cbe5891d9fc2691e6df9b0869e214a7985e7dc
amstramgrame/amstramgrame
exfaust7.dsp
import("stdfaust.lib"); random (n,m) = (1 + no.noise)/2 * (m-n) + n : int; gain = hslider ("v:Crépitements/volume", 0.9, 0.1, 1, 0.01); gate = checkbox ("ON / OFF"); echo = +~ (@(delLenght-1) : *(feedback)) with { duration = 400 * 0.001; feedback = 0.15; delLenght = ma.SR * duration; }; crepit = ba.beat (random (370, 380)) : echo; feu = os.osc (freqosc * no.pink_noise); freqosc = hslider ("v:Feu/intensité flamme", 500, 200, 800, 1) : si.smoo; ctfreq = hslider ("v:Feu/ctfreq", 300, 40, 700, 1) : si.smoo; gain2 = hslider ("v:Feu/volume", 1, 0.1, 1, 0.01) : si.smoo; process = (feu * gate * gain2) : fi.lowpass (1,ctfreq) /1.5, (crepit * gain* gate)/1.5;
https://raw.githubusercontent.com/amstramgrame/amstramgrame/0a95b84df000a2f478703787e7bec77ad301880e/web/mkdocs/docs/scenari/paysage-sonore/exfaust7/exfaust7.dsp
faust
import("stdfaust.lib"); random (n,m) = (1 + no.noise)/2 * (m-n) + n : int; gain = hslider ("v:Crépitements/volume", 0.9, 0.1, 1, 0.01); gate = checkbox ("ON / OFF"); echo = +~ (@(delLenght-1) : *(feedback)) with { duration = 400 * 0.001; feedback = 0.15; delLenght = ma.SR * duration; }; crepit = ba.beat (random (370, 380)) : echo; feu = os.osc (freqosc * no.pink_noise); freqosc = hslider ("v:Feu/intensité flamme", 500, 200, 800, 1) : si.smoo; ctfreq = hslider ("v:Feu/ctfreq", 300, 40, 700, 1) : si.smoo; gain2 = hslider ("v:Feu/volume", 1, 0.1, 1, 0.01) : si.smoo; process = (feu * gate * gain2) : fi.lowpass (1,ctfreq) /1.5, (crepit * gain* gate)/1.5;
22d318a1aa4ce273bbb75bf5e9c86bf351a7b17c37f449d9404eba066396ba74
amstramgrame/amstramgrame
exfaust11.dsp
import("stdfaust.lib"); // enveloppe env = button("gate[switch:1]"):en.adsr(1,0.1,0.6,1):si.smooth(0.9); // Synth freq_synth = hslider("freq_synth[acc: 0 0 -10 0 10]",360,60,1200,1); synth = os.osc(freq_synth) : ef.echo(0.2,0.2,0.3); // Reverb roomsize = hslider("Room Size[knob:2]", 0.5, 0, 1, 0.05); reverb = _<: (*(g)*fixedgain : re.mono_freeverb(combfeed, allpassfeed, damping, spatSpread)),*(1-g), *(1-g) :> _ with{ scaleroom = 0.28; offsetroom = 0.7; allpassfeed = 0.5; scaledamp = 0.1; fixedgain = 0.1; origSR = 44100; damping = 0.2*scaledamp*origSR/ma.SR; combfeed = roomsize*scaleroom*origSR/ma.SR + offsetroom; spatSpread = 0.5*46*ma.SR/origSR: int; g = 0.4; }; // DSP process = synth*env*0.8 : reverb;
https://raw.githubusercontent.com/amstramgrame/amstramgrame/4df99bfbae994fc9dcb4012190335e29255b411e/docs/gramophone/programs/exfaust11/exfaust11.dsp
faust
enveloppe Synth Reverb DSP
import("stdfaust.lib"); env = button("gate[switch:1]"):en.adsr(1,0.1,0.6,1):si.smooth(0.9); freq_synth = hslider("freq_synth[acc: 0 0 -10 0 10]",360,60,1200,1); synth = os.osc(freq_synth) : ef.echo(0.2,0.2,0.3); roomsize = hslider("Room Size[knob:2]", 0.5, 0, 1, 0.05); reverb = _<: (*(g)*fixedgain : re.mono_freeverb(combfeed, allpassfeed, damping, spatSpread)),*(1-g), *(1-g) :> _ with{ scaleroom = 0.28; offsetroom = 0.7; allpassfeed = 0.5; scaledamp = 0.1; fixedgain = 0.1; origSR = 44100; damping = 0.2*scaledamp*origSR/ma.SR; combfeed = roomsize*scaleroom*origSR/ma.SR + offsetroom; spatSpread = 0.5*46*ma.SR/origSR: int; g = 0.4; }; process = synth*env*0.8 : reverb;
4fa9381bae4324a19aec002b0ef1191bf80ebd53c34884d2fafb5a46e2830409
amstramgrame/amstramgrame
exfaust2.dsp
import("stdfaust.lib"); process = par(i,4,os.osc(noteSelector(selAccord,i))+os.osc(noteSelector(selAccord,i)*2 : si.smooth(0.999))) :> _/5 : _*0.1 : effet*onOff; noteSelector(accord,note) = 54,57,61,68, 52,54,59,62, 52,55,62,64 : ba.selectn(12,int(accord*4)+int(note)):ba.midikey2hz; selAccord = hslider("accord[acc:0 0 -10 0 10]",1,0,2,1); gain = hslider("gain[acc:1 0 -10 0 10]",0,0,0.5,0.01); vibrato = hslider("vibrato[knob:2]",1,1,5,0.01); onOff = button("on-off[switch:1]"):si.smoo; effet = ef.cubicnl(gain,0):fi.highpass3e(500+400*os.osc(vibrato));
https://raw.githubusercontent.com/amstramgrame/amstramgrame/0a95b84df000a2f478703787e7bec77ad301880e/docs/scenari/allier20/exfaust2/exfaust2.dsp
faust
import("stdfaust.lib"); process = par(i,4,os.osc(noteSelector(selAccord,i))+os.osc(noteSelector(selAccord,i)*2 : si.smooth(0.999))) :> _/5 : _*0.1 : effet*onOff; noteSelector(accord,note) = 54,57,61,68, 52,54,59,62, 52,55,62,64 : ba.selectn(12,int(accord*4)+int(note)):ba.midikey2hz; selAccord = hslider("accord[acc:0 0 -10 0 10]",1,0,2,1); gain = hslider("gain[acc:1 0 -10 0 10]",0,0,0.5,0.01); vibrato = hslider("vibrato[knob:2]",1,1,5,0.01); onOff = button("on-off[switch:1]"):si.smoo; effet = ef.cubicnl(gain,0):fi.highpass3e(500+400*os.osc(vibrato));
c59727941261cbf61f52a1e3fbef3763561c937f77214b29077b9848ad5b5e32
amstramgrame/amstramgrame
exfaust16.dsp
import("stdfaust.lib"); // parameters impFreq = hslider("impFreq[acc: 1 0 -10 0 10]",11,2,20,0.01) : si.smoo; resFreq = hslider("resFreq[acc: 0 1 -10 0 10]",1650,300,3000,0.01) : si.smoo; distDrive = hslider("distDrive[knob:2]",0,0,1,0.01) : si.smoo; q = hslider("q[knob:3]",30,10,50,0.01) : si.smoo; del = hslider("del[acc: 0 1 -10 0 10]",0.2,0,0.4,0.01) : si.smoo; fb = hslider("fb[acc: 1 0 -10 0 10]",0.5,0,1,0.01) : si.smoo; gate = button("gate[switch:1]"); // DSP process = os.lf_imptrain(impFreq)*gate : fi.resonlp(resFreq,q,1) : ef.echo(0.4,del,fb) : ef.cubicnl(distDrive,0)*0.95;
https://raw.githubusercontent.com/amstramgrame/amstramgrame/4df99bfbae994fc9dcb4012190335e29255b411e/docs/gramophone/programs/exfaust16/exfaust16.dsp
faust
parameters DSP
import("stdfaust.lib"); impFreq = hslider("impFreq[acc: 1 0 -10 0 10]",11,2,20,0.01) : si.smoo; resFreq = hslider("resFreq[acc: 0 1 -10 0 10]",1650,300,3000,0.01) : si.smoo; distDrive = hslider("distDrive[knob:2]",0,0,1,0.01) : si.smoo; q = hslider("q[knob:3]",30,10,50,0.01) : si.smoo; del = hslider("del[acc: 0 1 -10 0 10]",0.2,0,0.4,0.01) : si.smoo; fb = hslider("fb[acc: 1 0 -10 0 10]",0.5,0,1,0.01) : si.smoo; gate = button("gate[switch:1]"); process = os.lf_imptrain(impFreq)*gate : fi.resonlp(resFreq,q,1) : ef.echo(0.4,del,fb) : ef.cubicnl(distDrive,0)*0.95;
f39079d430e58af1e9d377dea5cdb06d3c893136dbc1d10b1a724f9adfb5c4c6
amstramgrame/amstramgrame
exfaust13.dsp
import("stdfaust.lib"); // Bouton On/Off gate = button("drop[switch:1]"); // Freq Bulle freq_bulle = hslider("freq_bulle[acc: 0 0 -10 0 10]",600,150,3000,1); // Feedback Echo fdb_echo = hslider("fdb_echo[knob:2]",0.5,0,0.9,0.01) : si.smoo; // Longueur Delay del_echo = hslider("del_echo[acc: 1 0 -10 0 10]",0.25,0.1,0.4,0.01) : si.smoo; // Bulle bubble(f0,trig) = os.osc(f) * (exp(-damp*time) : si.smooth(0.99)) with { damp = 0.043*f0 + 0.0014*f0^(3/2); f = f0*(1+sigma*time); sigma = eta * damp; eta = 0.075; time = 0 : (select2(trig>trig'):+(1)) ~ _ : ba.samp2sec; }; // DSP process = gate : bubble(freq_bulle) : ef.echo(0.4,del_echo,fdb_echo) * 0.8;
https://raw.githubusercontent.com/amstramgrame/amstramgrame/4df99bfbae994fc9dcb4012190335e29255b411e/docs/gramophone/programs/exfaust13/exfaust13.dsp
faust
Bouton On/Off Freq Bulle Feedback Echo Longueur Delay Bulle DSP
import("stdfaust.lib"); gate = button("drop[switch:1]"); freq_bulle = hslider("freq_bulle[acc: 0 0 -10 0 10]",600,150,3000,1); fdb_echo = hslider("fdb_echo[knob:2]",0.5,0,0.9,0.01) : si.smoo; del_echo = hslider("del_echo[acc: 1 0 -10 0 10]",0.25,0.1,0.4,0.01) : si.smoo; bubble(f0,trig) = os.osc(f) * (exp(-damp*time) : si.smooth(0.99)) with { damp = 0.043*f0 + 0.0014*f0^(3/2); f = f0*(1+sigma*time); sigma = eta * damp; eta = 0.075; time = 0 : (select2(trig>trig'):+(1)) ~ _ : ba.samp2sec; }; process = gate : bubble(freq_bulle) : ef.echo(0.4,del_echo,fdb_echo) * 0.8;
3a84fc4df8c5e4a8c6c95f94ef995ce4a8dd19086f22cf8639fb906cf0a71022
amstramgrame/amstramgrame
tictac.dsp
// Gramophone program "TicTac" import("stdfaust.lib"); // parameters impFreq = hslider("impFreq[acc: 1 0 -10 0 10]",11,2,20,0.01) : si.smoo; resFreq = hslider("resFreq[acc: 0 1 -10 0 10]",1650,300,3000,0.01) : si.smoo; distDrive = hslider("distDrive[knob:2]",0,0,1,0.01) : si.smoo; q = hslider("q[knob:3]",30,10,50,0.01) : si.smoo; del = hslider("del[acc: 0 1 -10 0 10]",0.2,0,0.4,0.01) : si.smoo; fb = hslider("fb[acc: 1 0 -10 0 10]",0.5,0,1,0.01) : si.smoo; gate = button("gate[switch:1]"); // DSP process = os.lf_imptrain(impFreq)*gate : fi.resonlp(resFreq,q,1) : ef.echo(0.4,del,fb) : ef.cubicnl(distDrive,0)*0.95;
https://raw.githubusercontent.com/amstramgrame/amstramgrame/0a95b84df000a2f478703787e7bec77ad301880e/examples/tictac.dsp
faust
Gramophone program "TicTac" parameters DSP
import("stdfaust.lib"); impFreq = hslider("impFreq[acc: 1 0 -10 0 10]",11,2,20,0.01) : si.smoo; resFreq = hslider("resFreq[acc: 0 1 -10 0 10]",1650,300,3000,0.01) : si.smoo; distDrive = hslider("distDrive[knob:2]",0,0,1,0.01) : si.smoo; q = hslider("q[knob:3]",30,10,50,0.01) : si.smoo; del = hslider("del[acc: 0 1 -10 0 10]",0.2,0,0.4,0.01) : si.smoo; fb = hslider("fb[acc: 1 0 -10 0 10]",0.5,0,1,0.01) : si.smoo; gate = button("gate[switch:1]"); process = os.lf_imptrain(impFreq)*gate : fi.resonlp(resFreq,q,1) : ef.echo(0.4,del,fb) : ef.cubicnl(distDrive,0)*0.95;
d3bce01e613a2328865f7aae2ed143e64ed08c3e5398442dfe8cf5ac652c9753
amstramgrame/amstramgrame
exfaust3.dsp
import("stdfaust.lib"); subSynth (ctfreq1) = no.pink_noise : fi.lowpass(1, ctfreq1); gain = hslider("v: [1]VAGUES/[1]volume",1,0,1,0.001) : si.smoo; ctfreq1 = hslider("v: [1]VAGUES/[2]cutoff",2000,100,15000,0.001) : si.smoo; rel = hslider ("v: [1]VAGUES/[3]longueur_vague", 3.5, 2.0, 5.0, 0.001) : si.smoo; envelope = en.adsr(0.1,0.01,0.9,rel,gate1)*gain; shake_x = hslider("X rotation [acc: 0 1 -10 0 10]", 0, -100, 100, 0.001); declenche = _ : abs > 75; gate1 = shake_x : declenche; echo = +~ (@(delLenght-1) : *(feedback)) with { duration = 0.6; feedback = hslider ("v: [1]vagues/feedback", 0.35, 0, 0.85, 0.01); delLenght = ma.SR * duration; }; subSynth2 = no.noise : fi.lowpass (1, ctfreq2); ctfreq2 = hslider("v: [0]MER/[0]fréq cutoff", 1200,100,7000,0.01) : si.smoo; gain2 = hslider("v: [0]MER/[1]volume",0.08,0,0.5,0.001) : si.smoo; process = (subSynth2 * gain2)/2, (subSynth(ctfreq1) * envelope : echo)/2;
https://raw.githubusercontent.com/amstramgrame/amstramgrame/0a95b84df000a2f478703787e7bec77ad301880e/web/mkdocs/docs/scenari/paysage-sonore/exfaust3/exfaust3.dsp
faust
import("stdfaust.lib"); subSynth (ctfreq1) = no.pink_noise : fi.lowpass(1, ctfreq1); gain = hslider("v: [1]VAGUES/[1]volume",1,0,1,0.001) : si.smoo; ctfreq1 = hslider("v: [1]VAGUES/[2]cutoff",2000,100,15000,0.001) : si.smoo; rel = hslider ("v: [1]VAGUES/[3]longueur_vague", 3.5, 2.0, 5.0, 0.001) : si.smoo; envelope = en.adsr(0.1,0.01,0.9,rel,gate1)*gain; shake_x = hslider("X rotation [acc: 0 1 -10 0 10]", 0, -100, 100, 0.001); declenche = _ : abs > 75; gate1 = shake_x : declenche; echo = +~ (@(delLenght-1) : *(feedback)) with { duration = 0.6; feedback = hslider ("v: [1]vagues/feedback", 0.35, 0, 0.85, 0.01); delLenght = ma.SR * duration; }; subSynth2 = no.noise : fi.lowpass (1, ctfreq2); ctfreq2 = hslider("v: [0]MER/[0]fréq cutoff", 1200,100,7000,0.01) : si.smoo; gain2 = hslider("v: [0]MER/[1]volume",0.08,0,0.5,0.001) : si.smoo; process = (subSynth2 * gain2)/2, (subSynth(ctfreq1) * envelope : echo)/2;
081b0a563e32a28372acf724c0b2c5143c0d2ea520aab9d8cb13981e81c1af82
amstramgrame/amstramgrame
exfaust5.dsp
import ("stdfaust.lib"); basse = vgroup ("[0]Basse", ba.beat (bpm_basse) : pm.djembe (75, 0.2, 0.8, gain_basse) * checkbox ("[1]Play_basse")); gain_basse = hslider ("[0]Volume_basse", 0.9, 0.0, 1.0, 0.01); tone = vgroup ("[1]Tone", ba.beat (bpm_tone) : pm.djembe (300, 0.4, 0.45, gain_tone) * checkbox("[1]Play_tone")); gain_tone = hslider ("[0]Volume_tone", 0.6, 0.0, 1.0, 0.01); slap = vgroup ("[2]Slap", ba.beat (bpm_slap) : pm.djembe (550, 0.7, 0.5, gain_slap) * checkbox("[1]Play_slap")); gain_slap = hslider ("[0]Volume_slap", 0.3, 0.0, 1.0, 0.01); bpm_basse = hslider ("[2]BPM_basse 30 / 60 ", 30, 30, 60, 30); bpm_tone = 30, 60, 120, 240 : ba.selectn (4, select_tone); select_tone = hslider ("[2]BPM_tone 30 / 60 / 120 / 240", 0, 0, 3, 1); bpm_slap = 30, 60, 120, 240 : ba.selectn (4, select_slap); select_slap = hslider ("[2]BPM_slap 30 / 60 / 120 / 240", 0, 0, 3, 1); process = hgroup ("DJEMBÉ - SÉQUENCER", basse + tone + slap <:_,_);
https://raw.githubusercontent.com/amstramgrame/amstramgrame/0a95b84df000a2f478703787e7bec77ad301880e/web/mkdocs/docs/scenari/paysage-sonore/exfaust5/exfaust5.dsp
faust
import ("stdfaust.lib"); basse = vgroup ("[0]Basse", ba.beat (bpm_basse) : pm.djembe (75, 0.2, 0.8, gain_basse) * checkbox ("[1]Play_basse")); gain_basse = hslider ("[0]Volume_basse", 0.9, 0.0, 1.0, 0.01); tone = vgroup ("[1]Tone", ba.beat (bpm_tone) : pm.djembe (300, 0.4, 0.45, gain_tone) * checkbox("[1]Play_tone")); gain_tone = hslider ("[0]Volume_tone", 0.6, 0.0, 1.0, 0.01); slap = vgroup ("[2]Slap", ba.beat (bpm_slap) : pm.djembe (550, 0.7, 0.5, gain_slap) * checkbox("[1]Play_slap")); gain_slap = hslider ("[0]Volume_slap", 0.3, 0.0, 1.0, 0.01); bpm_basse = hslider ("[2]BPM_basse 30 / 60 ", 30, 30, 60, 30); bpm_tone = 30, 60, 120, 240 : ba.selectn (4, select_tone); select_tone = hslider ("[2]BPM_tone 30 / 60 / 120 / 240", 0, 0, 3, 1); bpm_slap = 30, 60, 120, 240 : ba.selectn (4, select_slap); select_slap = hslider ("[2]BPM_slap 30 / 60 / 120 / 240", 0, 0, 3, 1); process = hgroup ("DJEMBÉ - SÉQUENCER", basse + tone + slap <:_,_);
40aca98be02249865eb46a4c5989637a72e98dd0b79d56b4487839500c13ba71
amstramgrame/amstramgrame
exfaust14.dsp
import("stdfaust.lib"); // Bouton On/Off gate = checkbox("gate[switch:1]"); //Synth freq_synth = 60; synth = os.sawtooth(freq_synth+vibrato); //Distortion drive = hslider("drive[acc: 1 3 -10 0 10]",0,0,1,0.01) : si.smoo; distortion = ef.cubicnl(drive,0); //Filtre modulant 1 lfo1 = (os.sawtooth(2)+1)/2; freq_filt1 = hslider("freq_filt[knob:2]",500,60,2000,1); filtre1 = fi.resonlp(lfo1*freq_filt1,1,1); //Filtre modulant 2 vit_env = 1; lfo2 = (os.sawtooth(vit_env)+1)/2:si.smoo; freq_filt2 = freq_filt1 * 8; filtre2 = fi.resonlp(lfo2*freq_filt2,1,1); lfo_amp = (os.osc(freq_lfo2)+1)/4; amp = lfo_amp - (0.5 - lfo_amp); freq_lfo2 = 6; // vitesse du vibrato vitVib = hslider("vitesseVibrato[acc: 0 0 -10 0 10]",10,0,600,0.1) : si.smoo; // amplitude du vibrato ampVib = hslider("amplitudeVibrato[acc: 1 0 -10 0 10]",60,0,480,0.1) : si.smoo; // la fonction vibrato vibrato = os.osc(vitVib)*ampVib; //DSP process = synth * gate : distortion * 0.8 <: filtre1, filtre2 :> _ * amp;
https://raw.githubusercontent.com/amstramgrame/amstramgrame/4df99bfbae994fc9dcb4012190335e29255b411e/web/mkdocs/docs/gramophone/programs/exfaust14/exfaust14.dsp
faust
Bouton On/Off Synth Distortion Filtre modulant 1 Filtre modulant 2 vitesse du vibrato amplitude du vibrato la fonction vibrato DSP
import("stdfaust.lib"); gate = checkbox("gate[switch:1]"); freq_synth = 60; synth = os.sawtooth(freq_synth+vibrato); drive = hslider("drive[acc: 1 3 -10 0 10]",0,0,1,0.01) : si.smoo; distortion = ef.cubicnl(drive,0); lfo1 = (os.sawtooth(2)+1)/2; freq_filt1 = hslider("freq_filt[knob:2]",500,60,2000,1); filtre1 = fi.resonlp(lfo1*freq_filt1,1,1); vit_env = 1; lfo2 = (os.sawtooth(vit_env)+1)/2:si.smoo; freq_filt2 = freq_filt1 * 8; filtre2 = fi.resonlp(lfo2*freq_filt2,1,1); lfo_amp = (os.osc(freq_lfo2)+1)/4; amp = lfo_amp - (0.5 - lfo_amp); freq_lfo2 = 6; vitVib = hslider("vitesseVibrato[acc: 0 0 -10 0 10]",10,0,600,0.1) : si.smoo; ampVib = hslider("amplitudeVibrato[acc: 1 0 -10 0 10]",60,0,480,0.1) : si.smoo; vibrato = os.osc(vitVib)*ampVib; process = synth * gate : distortion * 0.8 <: filtre1, filtre2 :> _ * amp;
360537c00e9c22d25873a72c4cf71b6e718cb7ad9cf53b7eaaa537318c7e352c
amstramgrame/amstramgrame
exfaust15.dsp
import ("stdfaust.lib"); // Bouton On/Off gate = checkbox("gate[switch:1]"); // Impulsion de bruit randomer(rP) = rP:en.ar(0.001,0.001)*no.noise:fi.resonbp(rng+300,7,2); rng = no.noise:ba.latch(rPulse(no.noise)>0)*100+200; rPulse(noi) = ba.pulse((noi:ba.latch(ba.pulse(11025))*15000+30000)*rate); // Densite de la pluie rate = hslider("rate[acc:0 2 -10 0 10]",5,0.1,10,0.01); // Reverbe reverb = _<: (*(g)*fixedgain : re.mono_freeverb(combfeed, allpassfeed, damping, spatSpread)),*(1-g), *(1-g) :> _ with{ scaleroom = 0.28; offsetroom = 0.7; allpassfeed = 0.5; scaledamp = 0.1; fixedgain = 0.1; origSR = 44100; damping = 0.2*scaledamp*origSR/ma.SR; combfeed = 1*scaleroom*origSR/ma.SR + offsetroom; spatSpread = 0.5*46*ma.SR/origSR: int; g = 0.4; }; // Controle filtre en peigne del = hslider("del[acc: 1 0 -10 0 10]",200,50,400,1) : si.smoo; fb = hslider("fb[knob:2]",0.5,0,0.97,0.001); // DSP process = no.multinoise(10):par(i,10,randomer(rPulse(_))*0.4*gate : fi.lowpass(1,1000)):>_* 0.8 : fi.fb_fcomb(1024,del,1,fb) : reverb;
https://raw.githubusercontent.com/amstramgrame/amstramgrame/4df99bfbae994fc9dcb4012190335e29255b411e/web/mkdocs/docs/gramophone/programs/exfaust15/exfaust15.dsp
faust
Bouton On/Off Impulsion de bruit Densite de la pluie Reverbe Controle filtre en peigne DSP
import ("stdfaust.lib"); gate = checkbox("gate[switch:1]"); randomer(rP) = rP:en.ar(0.001,0.001)*no.noise:fi.resonbp(rng+300,7,2); rng = no.noise:ba.latch(rPulse(no.noise)>0)*100+200; rPulse(noi) = ba.pulse((noi:ba.latch(ba.pulse(11025))*15000+30000)*rate); rate = hslider("rate[acc:0 2 -10 0 10]",5,0.1,10,0.01); reverb = _<: (*(g)*fixedgain : re.mono_freeverb(combfeed, allpassfeed, damping, spatSpread)),*(1-g), *(1-g) :> _ with{ scaleroom = 0.28; offsetroom = 0.7; allpassfeed = 0.5; scaledamp = 0.1; fixedgain = 0.1; origSR = 44100; damping = 0.2*scaledamp*origSR/ma.SR; combfeed = 1*scaleroom*origSR/ma.SR + offsetroom; spatSpread = 0.5*46*ma.SR/origSR: int; g = 0.4; }; del = hslider("del[acc: 1 0 -10 0 10]",200,50,400,1) : si.smoo; fb = hslider("fb[knob:2]",0.5,0,0.97,0.001); process = no.multinoise(10):par(i,10,randomer(rPulse(_))*0.4*gate : fi.lowpass(1,1000)):>_* 0.8 : fi.fb_fcomb(1024,del,1,fb) : reverb;
87cdd15b98815739ef337c4ac70284eda1159ff0d7e710364c2118bfdf19b7f7
amstramgrame/amstramgrame
exfaust12.dsp
import("stdfaust.lib"); process = beat:>ef.cubicnl(0.1,0) : bitReducer(bits) : fi.fb_fcomb(1024,del,1,fb) * 0.8 : phaser(1,depth):reverb; gate = checkbox("gate[switch:1]"); kickVol = 1; env = rPulse * 1:en.ar(0.01,0.15); rPulse = ba.pulse((no.noise:ba.latch(ba.pulse(11025))*15000+30000)*rate); // Densite de la pluie //rate = hslider("rate[acc:0 2 -10 0 10]",10, 2,15,0.01); rate = 1.7 + (3 *gate); phaser(r,d) = _<: _,de.fdelay((os.osc(r)*0.5*d+0.5)*800+500,1001):>_*0.5; depth = hslider("depth[acc: 1 0 -10 0 10]",0.5,0,2,0.01); //period = hslider("period[knob:2]",0.4,0.1,1,0.01) : ba.sec2samp; beat = os.osc(env*40+20)*env*kickVol; bits = hslider("bits[knob:2]",8,1,8,1); bitReducer(bits) = _*(pow(2,bits)):int(_)/pow(2,bits); del = hslider("del[acc: 1 1 -10 0 10]",525,500,1000,1) : si.smoo; //fb = hslider("fb[acc: 0 1 -10 0 10]",0.9,0.8,0.98,0.001); fb = 0.96; // Reverbe reverb = _<: (*(g)*fixedgain : re.mono_freeverb(combfeed, allpassfeed, damping, spatSpread)),*(1-g), *(1-g) :> _ with{ scaleroom = 0.28; offsetroom = 0.7; allpassfeed = 0.5; scaledamp = 0.1; fixedgain = 0.1; origSR = 44100; damping = 0.2*scaledamp*origSR/ma.SR; combfeed = 1*scaleroom*origSR/ma.SR + offsetroom; spatSpread = 0.5*46*ma.SR/origSR: int; g = 0.4; };
https://raw.githubusercontent.com/amstramgrame/amstramgrame/4df99bfbae994fc9dcb4012190335e29255b411e/docs/gramophone/programs/exfaust12/exfaust12.dsp
faust
Densite de la pluie rate = hslider("rate[acc:0 2 -10 0 10]",10, 2,15,0.01); period = hslider("period[knob:2]",0.4,0.1,1,0.01) : ba.sec2samp; fb = hslider("fb[acc: 0 1 -10 0 10]",0.9,0.8,0.98,0.001); Reverbe
import("stdfaust.lib"); process = beat:>ef.cubicnl(0.1,0) : bitReducer(bits) : fi.fb_fcomb(1024,del,1,fb) * 0.8 : phaser(1,depth):reverb; gate = checkbox("gate[switch:1]"); kickVol = 1; env = rPulse * 1:en.ar(0.01,0.15); rPulse = ba.pulse((no.noise:ba.latch(ba.pulse(11025))*15000+30000)*rate); rate = 1.7 + (3 *gate); phaser(r,d) = _<: _,de.fdelay((os.osc(r)*0.5*d+0.5)*800+500,1001):>_*0.5; depth = hslider("depth[acc: 1 0 -10 0 10]",0.5,0,2,0.01); beat = os.osc(env*40+20)*env*kickVol; bits = hslider("bits[knob:2]",8,1,8,1); bitReducer(bits) = _*(pow(2,bits)):int(_)/pow(2,bits); del = hslider("del[acc: 1 1 -10 0 10]",525,500,1000,1) : si.smoo; fb = 0.96; reverb = _<: (*(g)*fixedgain : re.mono_freeverb(combfeed, allpassfeed, damping, spatSpread)),*(1-g), *(1-g) :> _ with{ scaleroom = 0.28; offsetroom = 0.7; allpassfeed = 0.5; scaledamp = 0.1; fixedgain = 0.1; origSR = 44100; damping = 0.2*scaledamp*origSR/ma.SR; combfeed = 1*scaleroom*origSR/ma.SR + offsetroom; spatSpread = 0.5*46*ma.SR/origSR: int; g = 0.4; };
17be14d6c42396ec3836797b8efbbdad1191f38e0046755fab8907f2abb2e547
amstramgrame/amstramgrame
exfaust3.dsp
declare name "Euclidian rain"; declare version "1.0"; declare author "Johann Philippe"; declare license "MIT"; declare copyright "(c) Johann Philippe 2022"; /* Rain with echo sounds based on karplus enveloppe, and triggered with euclidian rhythms. */ import("stdfaust.lib"); mpulse(smps_dur, trig) = pulsation with { count = ba.countdown(smps_dur, trig); pulsation = 0, 1 : select2(count > 0); }; mpulse_dur(duration, trig) = mpulse(ba.sec2samp(duration), trig); euclidian(onset, div, pulses, rotation, phasor) = res with { kph = int( ((phasor * div) % 1) * pulses); eucval = int((onset / pulses) * kph); cond(index) = 0, 1 : select2(eucval' != eucval); trig = 0, 1 : select2(kph' != kph); res = (trig & cond(kph)); }; // Controls MAX_F = 12000; MIN_F = 4000; add = hslider("freq_add[acc: 0 0 -10 0 10]", MIN_F, MIN_F, MAX_F / 2, 1); mult = hslider("freq_mult[knob:3]", MIN_F, MIN_F, MAX_F / 2, 1); amp = hslider("amp", 0.9, 0, 1, 0.01) : si.smoo; tog_amp = button("tog[switch:1]") : ba.toggle : si.smoo; metro_speed = hslider("metro[acc: 1 0 -10 0 10]", 50, 1, 300, 0.1); //DSP metro_freq = metro_speed / 60; smetro = ba.beat(metro_speed) + os.impulse : *(tog_amp); metro = euclidian( (abs(no.noise) + 1 * 1.55 : ba.sAndH(smetro + os.impulse)) , 2 , 64 , 0 , os.phasor(1, metro_freq)); rand = (abs(no.noise) * mult + add ): ba.sAndH(metro + os.impulse); plu = pm.pluckString(0.08, 1, 1, 1, 15, metro); karp = pm.ks(0.1, 0.1, plu) : fi.dcblocker; env = karp : an.amp_follower(0.001) : si.smoo; Q = 5; synt = pm.impulseExcitation(metro * tog_amp) : ve.oberheimBPF(rand / MAX_F, Q) : ve.oberheimBPF(rand / MAX_F, Q) : *(3) : co.compressor_mono(8,-5,0.01,0.01); echoed = synt : ef.echo(1, 0.05, 0.6) ; process = (synt + (echoed * 0.7) ) : *(amp) <: _,_;
https://raw.githubusercontent.com/amstramgrame/amstramgrame/4df99bfbae994fc9dcb4012190335e29255b411e/docs/gramophone/programs/exfaust3/exfaust3.dsp
faust
Rain with echo sounds based on karplus enveloppe, and triggered with euclidian rhythms. Controls DSP
declare name "Euclidian rain"; declare version "1.0"; declare author "Johann Philippe"; declare license "MIT"; declare copyright "(c) Johann Philippe 2022"; import("stdfaust.lib"); mpulse(smps_dur, trig) = pulsation with { count = ba.countdown(smps_dur, trig); pulsation = 0, 1 : select2(count > 0); }; mpulse_dur(duration, trig) = mpulse(ba.sec2samp(duration), trig); euclidian(onset, div, pulses, rotation, phasor) = res with { kph = int( ((phasor * div) % 1) * pulses); eucval = int((onset / pulses) * kph); cond(index) = 0, 1 : select2(eucval' != eucval); trig = 0, 1 : select2(kph' != kph); res = (trig & cond(kph)); }; MAX_F = 12000; MIN_F = 4000; add = hslider("freq_add[acc: 0 0 -10 0 10]", MIN_F, MIN_F, MAX_F / 2, 1); mult = hslider("freq_mult[knob:3]", MIN_F, MIN_F, MAX_F / 2, 1); amp = hslider("amp", 0.9, 0, 1, 0.01) : si.smoo; tog_amp = button("tog[switch:1]") : ba.toggle : si.smoo; metro_speed = hslider("metro[acc: 1 0 -10 0 10]", 50, 1, 300, 0.1); metro_freq = metro_speed / 60; smetro = ba.beat(metro_speed) + os.impulse : *(tog_amp); metro = euclidian( (abs(no.noise) + 1 * 1.55 : ba.sAndH(smetro + os.impulse)) , 2 , 64 , 0 , os.phasor(1, metro_freq)); rand = (abs(no.noise) * mult + add ): ba.sAndH(metro + os.impulse); plu = pm.pluckString(0.08, 1, 1, 1, 15, metro); karp = pm.ks(0.1, 0.1, plu) : fi.dcblocker; env = karp : an.amp_follower(0.001) : si.smoo; Q = 5; synt = pm.impulseExcitation(metro * tog_amp) : ve.oberheimBPF(rand / MAX_F, Q) : ve.oberheimBPF(rand / MAX_F, Q) : *(3) : co.compressor_mono(8,-5,0.01,0.01); echoed = synt : ef.echo(1, 0.05, 0.6) ; process = (synt + (echoed * 0.7) ) : *(amp) <: _,_;
f09d4d293040ca0f3997ee7c336ec5d47a777a6d28e29a67f1b4b71075b5486e
amstramgrame/amstramgrame
exfaust6.dsp
declare name "Particles in space"; declare version "1.0"; declare author "Johann Philippe"; declare license "MIT"; declare copyright "(c) Johann Philippe 2022"; /* Euclidian space particles based on filtered and echoed sawtooth */ import("stdfaust.lib"); mpulse(smps_dur, trig) = pulsation with { count = ba.countdown(smps_dur, trig); pulsation = 0, 1 : select2(count > 0); }; mpulse_dur(duration, trig) = mpulse(ba.sec2samp(duration), trig); euclidian(onset, div, pulses, rotation, phasor) = (cond & trig) with { kph = int( ((phasor * div) % 1) * pulses); eucval = int((onset / pulses) * kph); cond = 0, 1 : select2(eucval' != eucval); trig = 0, 1 : select2(kph' != kph); }; // Controls sw = button("trigger[switch:1]") : ba.toggle; metro_speed = hslider("metro[acc: 1 0 -10 0 10]", 50, 1, 300, 0.1); add = hslider("freq_add[acc: 0 0 -10 0 10]", 100, 50, 2500, 1); mult = hslider("freq_mult[knob:3]", 500, 250, 2500, 1); q = hslider("Q", 0.5, 0.1, 9.9, 0.01); gain = hslider("gain", 2, 0.0, 10, 0.01); // DSP origin_pulse = os.impulse; metro_freq = metro_speed / 60; smetro = ba.beat(metro_speed) : *(sw); metro = euclidian( abs(no.noise) + 1 * 1.55 : ba.sAndH(smetro | origin_pulse) , 2.654 , 64 , 0 , os.phasor(1, metro_freq)) : *(sw); rand = (abs(no.noise) * mult + add ) : ba.sAndH(metro | origin_pulse); ATQ_DUR = 0.001; f_env = metro : mpulse_dur(ATQ_DUR) : en.are(ATQ_DUR, 0.5) + 0.01; echo_mix(mix, sig) = sig : ef.echo(0.1, 0.1, 0.8) : _ * mix + sig * (1 - mix); env = metro : mpulse_dur(ATQ_DUR) : en.are(ATQ_DUR, 1); // Le filtre peut être changé pour obtenir des résultats très intéressants // aussi. Les filtres suivants sont intérressants : //os.sawtooth(rand) : fi.resonlp(f_env * 5000, q, 0.5); //os.sawtooth(rand) : ve.diodeLadder(f_env * 0.85, q); //os.sawtooth(rand) : ve.korg35LPF(f_env / 2, q); process = os.sawtooth(rand) : ve.korg35LPF(f_env / 2, q) : echo_mix(0.7) : _ * gain *env;
https://raw.githubusercontent.com/amstramgrame/amstramgrame/4df99bfbae994fc9dcb4012190335e29255b411e/web/mkdocs/docs/gramophone/programs/exfaust6/exfaust6.dsp
faust
Euclidian space particles based on filtered and echoed sawtooth Controls DSP Le filtre peut être changé pour obtenir des résultats très intéressants aussi. Les filtres suivants sont intérressants : os.sawtooth(rand) : fi.resonlp(f_env * 5000, q, 0.5); os.sawtooth(rand) : ve.diodeLadder(f_env * 0.85, q); os.sawtooth(rand) : ve.korg35LPF(f_env / 2, q);
declare name "Particles in space"; declare version "1.0"; declare author "Johann Philippe"; declare license "MIT"; declare copyright "(c) Johann Philippe 2022"; import("stdfaust.lib"); mpulse(smps_dur, trig) = pulsation with { count = ba.countdown(smps_dur, trig); pulsation = 0, 1 : select2(count > 0); }; mpulse_dur(duration, trig) = mpulse(ba.sec2samp(duration), trig); euclidian(onset, div, pulses, rotation, phasor) = (cond & trig) with { kph = int( ((phasor * div) % 1) * pulses); eucval = int((onset / pulses) * kph); cond = 0, 1 : select2(eucval' != eucval); trig = 0, 1 : select2(kph' != kph); }; sw = button("trigger[switch:1]") : ba.toggle; metro_speed = hslider("metro[acc: 1 0 -10 0 10]", 50, 1, 300, 0.1); add = hslider("freq_add[acc: 0 0 -10 0 10]", 100, 50, 2500, 1); mult = hslider("freq_mult[knob:3]", 500, 250, 2500, 1); q = hslider("Q", 0.5, 0.1, 9.9, 0.01); gain = hslider("gain", 2, 0.0, 10, 0.01); origin_pulse = os.impulse; metro_freq = metro_speed / 60; smetro = ba.beat(metro_speed) : *(sw); metro = euclidian( abs(no.noise) + 1 * 1.55 : ba.sAndH(smetro | origin_pulse) , 2.654 , 64 , 0 , os.phasor(1, metro_freq)) : *(sw); rand = (abs(no.noise) * mult + add ) : ba.sAndH(metro | origin_pulse); ATQ_DUR = 0.001; f_env = metro : mpulse_dur(ATQ_DUR) : en.are(ATQ_DUR, 0.5) + 0.01; echo_mix(mix, sig) = sig : ef.echo(0.1, 0.1, 0.8) : _ * mix + sig * (1 - mix); env = metro : mpulse_dur(ATQ_DUR) : en.are(ATQ_DUR, 1); process = os.sawtooth(rand) : ve.korg35LPF(f_env / 2, q) : echo_mix(0.7) : _ * gain *env;
25a9ca2c6cc12fd3ef11ef60349a2c6f7c9a41ae2614b2b8f543fec355703364
amstramgrame/amstramgrame
SAtonalSoftHarp.dsp
declare name "Atonal Soft Harp"; declare author "ER"; //Adapted from NLFeks by Julius Smith and Romain Michon; /* =============== DESCRIPTION ======================== : - Soft Atonal Harp - Swing = Plucking all the strings one by one - Left = Slow rhythm /Low frequencies/ Silence - Right = Fast rhythm/ High frequencies - Back = Short and dry notes - Front = Long and bright notes */ import("stdfaust.lib"); //==================== INSTRUMENT ======================= process = par(i, N, NFLeks(i)):>_; NFLeks(n) = filtered_excitation(n,P(freq(n)),freq(n)) : stringloop(freq(n)); //==================== GUI SPECIFICATION ================ N = 15; hand = hslider("h:[1]/Instrument Hand[acc:0 1 -10 0 10]", 10, 0, N, 1) : ba.automat(bps, 15, 0.0)// => gate with{ bps = hslider("h:[1]/Speed[style:knob][acc:0 1 -10 0 10]", 480, 180, 720, 1):si.smooth(0.999) : min(720) : max(180) : int; }; gain = 1; pickangle = 0.9; beta = 0.5; // String decay time in seconds: t60 = hslider("h:[2]Reverberation/ Resonance[unit:s][acc:2 1 -10 0 10]", 5, 0.5, 10, 0.01):min(10):max(0.5); // -60db decay time (sec) B = 0; L = -10 : ba.db2linear; //---------------------------------- FREQUENCY TABLE --------------------------- freq(0) = 200; freq(1) = 215; freq(2) = 230; freq(3) = 245; freq(4) = 260; freq(5) = 275; freq(d) = freq(d-6)*(2); //==================== SIGNAL PROCESSING ================ //----------------------- noiseburst ------------------------- // White noise burst (adapted from Faust's karplus.dsp example) // Requires music.lib (for no.noise) noiseburst(d,e) = no.noise : *(trigger(d,e)) with{ upfront(x) = (x-x') > 0; decay(n,x) = x - (x>0)/n; release(n) = + ~ decay(n); position(d) = abs(hand - d) < 0.5; trigger(d,n) = position(d) : upfront : release(n) : > (0.0); }; P(f) = ma.SR/f ; // fundamental period in samples Pmax = 4096; // maximum P (for delay-line allocation) ppdel(f) = beta*P(f); // pick position delay pickposfilter(f) = fi.ffcombfilter(Pmax,ppdel(f),-1); // defined in filter.lib excitation(d,e) = noiseburst(d,e) : *(gain); // defined in signal.lib rho(f) = pow(0.001,1.0/(f*t60)); // multiplies loop-gain // Original EKS damping filter: b1 = 0.5*B; b0 = 1.0-b1; // S and 1-S dampingfilter1(f,x) = rho(f) * ((b0 * x) + (b1 * x')); // Linear phase FIR3 damping filter: h0 = (1.0 + B)/2; h1 = (1.0 - B)/4; dampingfilter2(f,x) = rho(f) * (h0 * x' + h1*(x+x'')); loopfilter(f) = dampingfilter2(f); // or dampingfilter1 filtered_excitation(d,e,f) = excitation(d,e) : si.smooth(pickangle) : pickposfilter(f) : fi.levelfilter(L,f); // see filter.lib stringloop(f) = (+ : de.fdelay2(Pmax, P(f)-2)) ~ (loopfilter(f));
https://raw.githubusercontent.com/amstramgrame/amstramgrame/0a95b84df000a2f478703787e7bec77ad301880e/examples/playground/SAtonalSoftHarp.dsp
faust
Adapted from NLFeks by Julius Smith and Romain Michon; =============== DESCRIPTION ======================== : - Soft Atonal Harp - Swing = Plucking all the strings one by one - Left = Slow rhythm /Low frequencies/ Silence - Right = Fast rhythm/ High frequencies - Back = Short and dry notes - Front = Long and bright notes ==================== INSTRUMENT ======================= ==================== GUI SPECIFICATION ================ => gate String decay time in seconds: -60db decay time (sec) ---------------------------------- FREQUENCY TABLE --------------------------- ==================== SIGNAL PROCESSING ================ ----------------------- noiseburst ------------------------- White noise burst (adapted from Faust's karplus.dsp example) Requires music.lib (for no.noise) fundamental period in samples maximum P (for delay-line allocation) pick position delay defined in filter.lib defined in signal.lib multiplies loop-gain Original EKS damping filter: S and 1-S Linear phase FIR3 damping filter: or dampingfilter1 see filter.lib
declare name "Atonal Soft Harp"; import("stdfaust.lib"); process = par(i, N, NFLeks(i)):>_; NFLeks(n) = filtered_excitation(n,P(freq(n)),freq(n)) : stringloop(freq(n)); N = 15; with{ bps = hslider("h:[1]/Speed[style:knob][acc:0 1 -10 0 10]", 480, 180, 720, 1):si.smooth(0.999) : min(720) : max(180) : int; }; gain = 1; pickangle = 0.9; beta = 0.5; B = 0; L = -10 : ba.db2linear; freq(0) = 200; freq(1) = 215; freq(2) = 230; freq(3) = 245; freq(4) = 260; freq(5) = 275; freq(d) = freq(d-6)*(2); noiseburst(d,e) = no.noise : *(trigger(d,e)) with{ upfront(x) = (x-x') > 0; decay(n,x) = x - (x>0)/n; release(n) = + ~ decay(n); position(d) = abs(hand - d) < 0.5; trigger(d,n) = position(d) : upfront : release(n) : > (0.0); }; dampingfilter1(f,x) = rho(f) * ((b0 * x) + (b1 * x')); h0 = (1.0 + B)/2; h1 = (1.0 - B)/4; dampingfilter2(f,x) = rho(f) * (h0 * x' + h1*(x+x'')); filtered_excitation(d,e,f) = excitation(d,e) : si.smooth(pickangle) stringloop(f) = (+ : de.fdelay2(Pmax, P(f)-2)) ~ (loopfilter(f));
69914c7d5a61fafa3e1b8b9bf0ad981a29e7d340958a9486c9f88d2c8f102894
amstramgrame/amstramgrame
exfaust8.dsp
// Créons un petit instrument !! // On importe la bibliothèque de fonctions du language Faust pour // pouvoir programmer !! import("stdfaust.lib"); // Programmons un génèrateur de vagues et de bourrasques de vent pour // agrémenter nos paysages sonores !! // Il nous faut un bouton on/off pour activer le son !! Utilisons le bouton // (qui se presse) assignable du gramophone !! gate = button("gate[switch:1]") : si.smoo; // Générons du bruit blanc que nous pourrons sculpter pas la suite !! Bruit_Blanc = no.noise; // Sculptons le avec une enveloppe qui lui donnera la forme d'une vague // plus ou moins longue !! Enveloppe = en.ar(longueur_Debut,longueur_Fin,gate); // Réglons la longueur de la vague en l'assignant au potentiomètre (bouton // qui se tourne) programmable !! Ici la vague aura un début et une fin // symétrique !! Une petite impulsion sur le bouton on/off suffira à lancer // le son !! longueur_Debut = hslider("longueur_Debut[knob:2]",2,0,5,0.01) : si.smoo; longueur_Fin = hslider("longueur_Fin[knob:2]",2,0,5,0.01) : si.smoo; // Nous avons notre vague !! Il nous faut maintenant l'adoucir avec un // filtre !! Celui-ci nous permettra aussi de simuler le vent qui tourne !! Filtre = fi.resonbp(freqFilt,10,0.5); // Avec l'accéléromètre, modulons sa fréquence, c'est-à-dire sa hauteur // entre le grave et l'aigüe pour changer la vitesse du vent !! freqFilt = hslider("freqFilt[acc: 0 0 -10 0 10 ]",300,100,1000,0.1) : si.smoo; // Il ne nous reste plus qu'à relier le bruit, l'enveloppe et le filtre // dans une dernière ligne de code qui pourra être compilée par notre // navigateur !! process = Bruit_Blanc * Enveloppe : Filtre; // Notre simulateur de vagues et de vents est terminé !! Il sera parfait // pour créer de belles ambiances sonores et plonger nos auditeurs dans // une douce méditation !!
https://raw.githubusercontent.com/amstramgrame/amstramgrame/0a95b84df000a2f478703787e7bec77ad301880e/docs/scenari/allier20/exfaust8/exfaust8.dsp
faust
Créons un petit instrument !! On importe la bibliothèque de fonctions du language Faust pour pouvoir programmer !! Programmons un génèrateur de vagues et de bourrasques de vent pour agrémenter nos paysages sonores !! Il nous faut un bouton on/off pour activer le son !! Utilisons le bouton (qui se presse) assignable du gramophone !! Générons du bruit blanc que nous pourrons sculpter pas la suite !! Sculptons le avec une enveloppe qui lui donnera la forme d'une vague plus ou moins longue !! Réglons la longueur de la vague en l'assignant au potentiomètre (bouton qui se tourne) programmable !! Ici la vague aura un début et une fin symétrique !! Une petite impulsion sur le bouton on/off suffira à lancer le son !! Nous avons notre vague !! Il nous faut maintenant l'adoucir avec un filtre !! Celui-ci nous permettra aussi de simuler le vent qui tourne !! Avec l'accéléromètre, modulons sa fréquence, c'est-à-dire sa hauteur entre le grave et l'aigüe pour changer la vitesse du vent !! Il ne nous reste plus qu'à relier le bruit, l'enveloppe et le filtre dans une dernière ligne de code qui pourra être compilée par notre navigateur !! Notre simulateur de vagues et de vents est terminé !! Il sera parfait pour créer de belles ambiances sonores et plonger nos auditeurs dans une douce méditation !!
import("stdfaust.lib"); gate = button("gate[switch:1]") : si.smoo; Bruit_Blanc = no.noise; Enveloppe = en.ar(longueur_Debut,longueur_Fin,gate); longueur_Debut = hslider("longueur_Debut[knob:2]",2,0,5,0.01) : si.smoo; longueur_Fin = hslider("longueur_Fin[knob:2]",2,0,5,0.01) : si.smoo; Filtre = fi.resonbp(freqFilt,10,0.5); freqFilt = hslider("freqFilt[acc: 0 0 -10 0 10 ]",300,100,1000,0.1) : si.smoo; process = Bruit_Blanc * Enveloppe : Filtre;
d751252ae0958afe28a1ed7b76ef8b7598bdee67bf3b7ce5f337e6caecac95fb
amstramgrame/amstramgrame
exfaust4.dsp
// Créons un petit instrument !! // On importe la bibliothèque de fonctions du language Faust pour pouvoir programmer !! import("stdfaust.lib"); // Commençons par coder un petit synthétiseur !! // Il nous faut un bouton on/off pour activer et arréter le son !! // Utilisons le bouton (qui se presse) assignable du gramophone !! gate = button("gate[switch:1]") : si.smoo; // Nous avons maintenant besoin de générer du son !! // Un oscillateur en dent de scie sera parfait pour cela !! Synth = os.lf_saw(freqOsc) * gate; // Modulons sa fréquence, c'est-à-dire sa hauteur entre le grave et l'aigüe !! // Pour cela, utilisons les différents capteurs du Gramophone !! // l'accéléromètre, ses axes et ses courbes (croissantes, décroissantes, // en cloche, en creux) [acc: x x -10 0 10] // le potentiomètre (bouton qui se tourne) et qui n'est pas le volume [knob:2] // le capteur de lumière [knob:3] freqOsc = hslider("freqOsc[knob:2]",196,98,784,0.01) : si.smoo; // Nous avons notre synthétiseur !! // Rendons-le un plus riche en lui appliquant un effet.... Une WahWah par // exemple pour faire comme Jimi Hendrix !! // Utilisons la fonction du language Faust qui émule la pédale de notre // célèbre Guitar Hero !! WahWah = ve.crybaby(posPied); // Simulons la position du pied et modulons-la de la même façon que la // fréquence de l'oscillateur !! posPied = hslider("posPied[acc: 0 0 -10 0 10 ]",0.5,0,1,0.01) : si.smoo; // Il ne nous reste plus qu'à relier le synthétiseur et la pédale dans une // dernière ligne de code qui pourra être compilée par notre navigateur !! process = Synth : WahWah; // Notre instrument est fini !! Chargeons-le sur notre Gramophone et essayons // différentes affectations de nos variables (freqOsc et posPied) !! // On pourra même reproduire un gimmick d'une chanson super connue du groupe // "The Prodigy" !!
https://raw.githubusercontent.com/amstramgrame/amstramgrame/0a95b84df000a2f478703787e7bec77ad301880e/docs/scenari/allier20/exfaust4/exfaust4.dsp
faust
Créons un petit instrument !! On importe la bibliothèque de fonctions du language Faust pour pouvoir programmer !! Commençons par coder un petit synthétiseur !! Il nous faut un bouton on/off pour activer et arréter le son !! Utilisons le bouton (qui se presse) assignable du gramophone !! Nous avons maintenant besoin de générer du son !! Un oscillateur en dent de scie sera parfait pour cela !! Modulons sa fréquence, c'est-à-dire sa hauteur entre le grave et l'aigüe !! Pour cela, utilisons les différents capteurs du Gramophone !! l'accéléromètre, ses axes et ses courbes (croissantes, décroissantes, en cloche, en creux) [acc: x x -10 0 10] le potentiomètre (bouton qui se tourne) et qui n'est pas le volume [knob:2] le capteur de lumière [knob:3] Nous avons notre synthétiseur !! Rendons-le un plus riche en lui appliquant un effet.... Une WahWah par exemple pour faire comme Jimi Hendrix !! Utilisons la fonction du language Faust qui émule la pédale de notre célèbre Guitar Hero !! Simulons la position du pied et modulons-la de la même façon que la fréquence de l'oscillateur !! Il ne nous reste plus qu'à relier le synthétiseur et la pédale dans une dernière ligne de code qui pourra être compilée par notre navigateur !! Notre instrument est fini !! Chargeons-le sur notre Gramophone et essayons différentes affectations de nos variables (freqOsc et posPied) !! On pourra même reproduire un gimmick d'une chanson super connue du groupe "The Prodigy" !!
import("stdfaust.lib"); gate = button("gate[switch:1]") : si.smoo; Synth = os.lf_saw(freqOsc) * gate; freqOsc = hslider("freqOsc[knob:2]",196,98,784,0.01) : si.smoo; WahWah = ve.crybaby(posPied); posPied = hslider("posPied[acc: 0 0 -10 0 10 ]",0.5,0,1,0.01) : si.smoo; process = Synth : WahWah;
aef5ac3ae7a9afd7364ee1a91996ab6a35a48a7fc441959a0e03b9c403a478ef
amstramgrame/amstramgrame
Kisana.dsp
declare name "Kisana"; declare author "Yann Orlarey"; //Modifications GRAME July 2015 /* ========= DESCRITPION ============= - Kisana : 3-loops string instrument (based on Karplus-Strong) - Head = Silence - Tilt = High frequencies - Front = High + Medium frequencies - Bottom = High + Medium + Low frequencies - Left = Minimum brightness - Right = Maximum birghtness - Front = Long notes - Back = Short notes */ import("stdfaust.lib"); KEY = 60; // basic midi key NCY = 15; // note cycle length CCY = 15; // control cycle length BPS = 360; // general tempo (ba.beat per sec) process = kisana; //-------------------------------kisana---------------------------------- // USAGE: kisana : _,_; // 3-loops string instrument //----------------------------------------------------------------------- kisana = vgroup("Kisana", harpe(C,7,48), harpe(C,7,60), (harpe(C,7,72) : *(1.5), *(1.5)) :>*(checkbox("gate[switch:1]") : si.smoo)) with { l = -20 : ba.db2linear;//hslider("[1]Volume",-20, -60, 0, 0.01) : ba.db2linear; C = hslider("[2]Brightness[acc:0 1 -10 0 10]", 0.2, 0, 1, 0.01) : ba.automat(BPS, CCY, 0.0); }; //----------------------------------Harpe-------------------------------- // USAGE: harpe(C,10,60) : _,_; // C is the filter coefficient 0..1 // Build a N (10) strings harpe using a pentatonic scale // based on midi key b (60) // Each string is triggered by a specific // position of the "hand" //----------------------------------------------------------------------- harpe(C,N,b) = hand(b) <: par(i, N, position(i+1) : string(C,Penta(b).degree2Hz(i), att, lvl) : pan((i+0.5)/N) ) :> _,_ with { att = hslider("[3]Resonance[acc:2 1 -10 0 12]", 4, 0.1, 10, 0.01); hand(48) = vslider("h:[1]Instrument Hands/1 (Note %b)[unit:pk][acc:1 0 -10 0 14]", 0, 0, N, 1) : int : ba.automat(120, CCY, 0.0); hand(60) = vslider("h:[1]Instrument Hands/2 (Note %b)[unit:pk][acc:1 0 -10 0 14]", 2, 0, N, 1) : int : ba.automat(240, CCY, 0.0); hand(72) = vslider("h:[1]Instrument Hands/3 (Note %b)[unit:pk][acc:1 0 -10 0 10]", 4, 0, N, 1) : int : ba.automat(480, CCY, 0.0); //lvl = vslider("h:loop/level", 0, 0, 6, 1) : int : ba.automat(BPS, CCY, 0.0) : -(6) : ba.db2linear; lvl = 1; pan(p) = _ <: *(sqrt(1-p)), *(sqrt(p)); position(a,x) = abs(x - a) < 0.5; }; //----------------------------------Penta------------------------------- // Pentatonic scale with degree to midi and degree to Hz conversion // USAGE: Penta(60).degree2midi(3) ==> 67 midikey // Penta(60).degree2Hz(4) ==> 440 Hz //----------------------------------------------------------------------- Penta(key) = environment { A4Hz = 440; degree2midi(0) = key+0; degree2midi(1) = key+2; degree2midi(2) = key+4; degree2midi(3) = key+7; degree2midi(4) = key+9; degree2midi(d) = degree2midi(d-5)+12; degree2Hz(d) = A4Hz*semiton(degree2midi(d)-69) with { semiton(n) = 2.0^(n/12.0); }; }; //----------------------------------String------------------------------- // A karplus-strong string. // // USAGE: string(440Hz, 4s, 1.0, button("play")) // or button("play") : string(440Hz, 4s, 1.0) //----------------------------------------------------------------------- string(coef, freq, t60, level, trig) = no.noise*level : *(trig : trigger(freq2samples(freq))) : resonator(freq2samples(freq), att) with { resonator(d,a) = (+ : @(d-1)) ~ (average : *(a)); average(x) = (x*(1+coef)+x'*(1-coef))/2; trigger(n) = upfront : + ~ decay(n) : >(0.0); upfront(x) = (x-x') > 0.0; decay(n,x) = x - (x>0.0)/n; freq2samples(f) = 44100.0/f; att = pow(0.001,1.0/(freq*t60)); // attenuation coefficient random = +(12345)~*(1103515245); noise = random/2147483647.0; };
https://raw.githubusercontent.com/amstramgrame/amstramgrame/0a95b84df000a2f478703787e7bec77ad301880e/examples/playground/Kisana.dsp
faust
Modifications GRAME July 2015 ========= DESCRITPION ============= - Kisana : 3-loops string instrument (based on Karplus-Strong) - Head = Silence - Tilt = High frequencies - Front = High + Medium frequencies - Bottom = High + Medium + Low frequencies - Left = Minimum brightness - Right = Maximum birghtness - Front = Long notes - Back = Short notes basic midi key note cycle length control cycle length general tempo (ba.beat per sec) -------------------------------kisana---------------------------------- USAGE: kisana : _,_; 3-loops string instrument ----------------------------------------------------------------------- hslider("[1]Volume",-20, -60, 0, 0.01) : ba.db2linear; ----------------------------------Harpe-------------------------------- USAGE: harpe(C,10,60) : _,_; C is the filter coefficient 0..1 Build a N (10) strings harpe using a pentatonic scale based on midi key b (60) Each string is triggered by a specific position of the "hand" ----------------------------------------------------------------------- lvl = vslider("h:loop/level", 0, 0, 6, 1) : int : ba.automat(BPS, CCY, 0.0) : -(6) : ba.db2linear; ----------------------------------Penta------------------------------- Pentatonic scale with degree to midi and degree to Hz conversion USAGE: Penta(60).degree2midi(3) ==> 67 midikey Penta(60).degree2Hz(4) ==> 440 Hz ----------------------------------------------------------------------- ----------------------------------String------------------------------- A karplus-strong string. USAGE: string(440Hz, 4s, 1.0, button("play")) or button("play") : string(440Hz, 4s, 1.0) ----------------------------------------------------------------------- attenuation coefficient
declare name "Kisana"; declare author "Yann Orlarey"; import("stdfaust.lib"); process = kisana; kisana = vgroup("Kisana", harpe(C,7,48), harpe(C,7,60), (harpe(C,7,72) : *(1.5), *(1.5)) :>*(checkbox("gate[switch:1]") : si.smoo)) with { C = hslider("[2]Brightness[acc:0 1 -10 0 10]", 0.2, 0, 1, 0.01) : ba.automat(BPS, CCY, 0.0); }; harpe(C,N,b) = hand(b) <: par(i, N, position(i+1) : string(C,Penta(b).degree2Hz(i), att, lvl) : pan((i+0.5)/N) ) :> _,_ with { att = hslider("[3]Resonance[acc:2 1 -10 0 12]", 4, 0.1, 10, 0.01); hand(48) = vslider("h:[1]Instrument Hands/1 (Note %b)[unit:pk][acc:1 0 -10 0 14]", 0, 0, N, 1) : int : ba.automat(120, CCY, 0.0); hand(60) = vslider("h:[1]Instrument Hands/2 (Note %b)[unit:pk][acc:1 0 -10 0 14]", 2, 0, N, 1) : int : ba.automat(240, CCY, 0.0); hand(72) = vslider("h:[1]Instrument Hands/3 (Note %b)[unit:pk][acc:1 0 -10 0 10]", 4, 0, N, 1) : int : ba.automat(480, CCY, 0.0); lvl = 1; pan(p) = _ <: *(sqrt(1-p)), *(sqrt(p)); position(a,x) = abs(x - a) < 0.5; }; Penta(key) = environment { A4Hz = 440; degree2midi(0) = key+0; degree2midi(1) = key+2; degree2midi(2) = key+4; degree2midi(3) = key+7; degree2midi(4) = key+9; degree2midi(d) = degree2midi(d-5)+12; degree2Hz(d) = A4Hz*semiton(degree2midi(d)-69) with { semiton(n) = 2.0^(n/12.0); }; }; string(coef, freq, t60, level, trig) = no.noise*level : *(trig : trigger(freq2samples(freq))) : resonator(freq2samples(freq), att) with { resonator(d,a) = (+ : @(d-1)) ~ (average : *(a)); average(x) = (x*(1+coef)+x'*(1-coef))/2; trigger(n) = upfront : + ~ decay(n) : >(0.0); upfront(x) = (x-x') > 0.0; decay(n,x) = x - (x>0.0)/n; freq2samples(f) = 44100.0/f; random = +(12345)~*(1103515245); noise = random/2147483647.0; };
50a97d5412c5e82380a7d9137b4884b4ead5384bac0c273bc53f07ea56108e8b
amstramgrame/amstramgrame
SBird.dsp
declare name "bird"; declare author "Pierre Cochard"; //Modifications by Grame July 2014, June 2015; /* =============== DESCRIPTION ================= : - Bird singing generator. - Right = maximum speed of whistles. - Left = minimum speed/Rare birds, nearly silence. */ import("stdfaust.lib"); // PROCESS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - process = hgroup("Bird", mainOsc(noteTrig : rdm(72,94) : mtof , noteTrig) * envWrapper(noteTrig, ampEnv, amp_xp(2510)) <: _,_); // AUTO TRIGGER autoTrig = ba.beat(t) * (abs(no.noise) <= p) : trigger(48) with { t = hslider("[1]Speed (Granulator)[style:knob][acc:0 1 -10 0 10]", 240, 120, 480, 0.1) : si.smooth(0.999); p = hslider("[2]Probability (Granulator)[unit:%][style:knob][acc:0 1 -10 0 10]", 50, 25, 100, 1)*(0.01) : si.smooth(0.999); trigger(n) = upfront : release(n) : >(0.0) with { upfront(x) = (x-x') > 0.0; decay(n,x) = x - (x>0.0)/n; release(n) = + ~ decay(n); }; }; // BIRD TRIGGER noteTrig = autoTrig; // OSCILLATORS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - /* base */ carrierOsc(freq) = os.osc(freq); modOsc(freq) = os.triangleN(1,freq); /* fm oscillator */ mainOsc(freq,trig) = freq <: +(*(harmRatio <: +(*(envWrapper(trig,harmEnv,harm_xp(1700))))) : modOsc : *(modIndex <: +(*(envWrapper(trig,modIndexEnv,modIndex_xp(550)))))) <: +(*(envWrapper(trig,freqEnv,freq_xp(943)))) : carrierOsc; envWrapper(trig,env,sus) = trig : mstosamps(rdm(100,3000)), sus : hitLength : env; // FIXED PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - /* fm */ harmRatio = 0.063; modIndex = 3.24; // TIME FUNCTIONS - - - - - - - - - - - - - - - - - - - - - - - - - - - - metro(ms) = (%(+(1),mstosamps(ms))) ~_ : ==(1); mstosamps(ms) = ms : /(1000) * ma.SR : int; rdmInc = _ <: @(1), @(2) : + : *(2994.2313) : int : +(38125); rdm(rdmin,rdmax) = _,(fmod(_,rdmax - rdmin : int) ~ rdmInc : +(rdmin)) : gater : -(1) : abs; gater = (_,_,_ <: !,_,!,_,!,!,!,!,_ : select2) ~_; // MIDI RELATED - - - - - - - - - - - - - - - - - - - - - - - - - - - - - /* midi pitch */ mtof(midinote) = pow(2,(midinote - 69) / 12) * 440; // ENVELOPPES - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - /* envelope "reader" (phaser) */ hitLength(length,sustain) = *((==(length,@(length,1))), +(1))~_ <: gater(<(sustain)); /* amplitude envelope */ ampEnvbpf = ba.bpf.start(0, 0) : ba.bpf.point(amp_xp(60.241), 1.) : ba.bpf.point(amp_xp(461.847), 0.) : ba.bpf.point(amp_xp(582.329), 0.928) : ba.bpf.point(amp_xp(682.731), 0.5) : ba.bpf.point(amp_xp(983.936), 0.) : ba.bpf.point(amp_xp(1064.257), 0.) : ba.bpf.point(amp_xp(1345.382), 0.) : ba.bpf.point(amp_xp(1526.105), 0.) : ba.bpf.point(amp_xp(1746.988), 0.) : ba.bpf.point(amp_xp(1827.309), 0.) : ba.bpf.point(amp_xp(2088.353), 0.) : ba.bpf.point(amp_xp(2188.755), 0.) : /* sustain point */ ba.bpf.end(amp_xp(2510.040), 0.); ampEnv = ampEnvbpf; amp_xp(x) = x * ma.SR / 1000. * ampEnv_speed; ampEnv_speed = noteTrig : rdm(0,2000) : /(1000); /* freq envelope */ freqEnvbpf = ba.bpf.start(0, 0) : ba.bpf.point(freq_xp(147.751), 1.) : ba.bpf.point(freq_xp(193.213), 0.) : ba.bpf.point(freq_xp(318.233), yp) : ba.bpf.point(freq_xp(431.888), 0.) : ba.bpf.point(freq_xp(488.715), 0.434) : ba.bpf.point(freq_xp(613.735), yp) : ba.bpf.point(freq_xp(659.197), 1.) : ba.bpf.point(freq_xp(716.024), yp) : ba.bpf.point(freq_xp(806.948), 1.) : ba.bpf.point(freq_xp(829.679), yp) : /* sustain point */ ba.bpf.end(freq_xp(943.333), 0.); freqEnv = freqEnvbpf : si.smooth(0.999) : fi.lowpass(1, 3000); freq_xp(x) = x * ma.SR / 1000. * freqEnv_speed; freqEnv_speed = noteTrig : rdm(0,2000) : /(1000); yp = noteTrig : rdm(0,1000) : /(1000); /* harmRatio envelope */ harmEnvbpf = ba.bpf.start(0, 0.) : ba.bpf.point(harm_xp(863.454), 0.490) : ba.bpf.point(harm_xp(865), 0.) : ba.bpf.point (harm_xp(1305.221), 1.) : ba.bpf.point(harm_xp(1646.586), 0.) : /* sustain point */ ba.bpf.end(harm_xp(1700), 0.); harmEnv = harmEnvbpf : si.smooth(0.999) : fi.lowpass(1, 3000); harm_xp(x) = x * ma.SR / 1000. * harmEnv_speed; harmEnv_speed = noteTrig : rdm(0,2000) : /(1000); /* modIndex envelope */ modIndexEnvbpf = ba.bpf.start(0, 0.) : ba.bpf.point(modIndex_xp(240.964), 0.554) : ba.bpf.point(modIndex_xp(502.068), 0.) : /* sustain point */ ba.bpf.end(modIndex_xp(550), 0.); modIndexEnv = modIndexEnvbpf; modIndex_xp(x) = x * ma.SR / 1000. * modIndexEnv_speed; modIndexEnv_speed = noteTrig : rdm(0,2000) : /(1000);
https://raw.githubusercontent.com/amstramgrame/amstramgrame/0a95b84df000a2f478703787e7bec77ad301880e/examples/playground/notWorking/SBird.dsp
faust
Modifications by Grame July 2014, June 2015; =============== DESCRIPTION ================= : - Bird singing generator. - Right = maximum speed of whistles. - Left = minimum speed/Rare birds, nearly silence. PROCESS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - AUTO TRIGGER BIRD TRIGGER OSCILLATORS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - base fm oscillator FIXED PARAMETERS - - - - - - - - - - - - - - - - - - - - - - - - - - - fm TIME FUNCTIONS - - - - - - - - - - - - - - - - - - - - - - - - - - - - MIDI RELATED - - - - - - - - - - - - - - - - - - - - - - - - - - - - - midi pitch ENVELOPPES - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - envelope "reader" (phaser) amplitude envelope sustain point freq envelope sustain point harmRatio envelope sustain point modIndex envelope sustain point
declare name "bird"; declare author "Pierre Cochard"; import("stdfaust.lib"); process = hgroup("Bird", mainOsc(noteTrig : rdm(72,94) : mtof , noteTrig) * envWrapper(noteTrig, ampEnv, amp_xp(2510)) <: _,_); autoTrig = ba.beat(t) * (abs(no.noise) <= p) : trigger(48) with { t = hslider("[1]Speed (Granulator)[style:knob][acc:0 1 -10 0 10]", 240, 120, 480, 0.1) : si.smooth(0.999); p = hslider("[2]Probability (Granulator)[unit:%][style:knob][acc:0 1 -10 0 10]", 50, 25, 100, 1)*(0.01) : si.smooth(0.999); trigger(n) = upfront : release(n) : >(0.0) with { upfront(x) = (x-x') > 0.0; decay(n,x) = x - (x>0.0)/n; release(n) = + ~ decay(n); }; }; noteTrig = autoTrig; carrierOsc(freq) = os.osc(freq); modOsc(freq) = os.triangleN(1,freq); mainOsc(freq,trig) = freq <: +(*(harmRatio <: +(*(envWrapper(trig,harmEnv,harm_xp(1700))))) : modOsc : *(modIndex <: +(*(envWrapper(trig,modIndexEnv,modIndex_xp(550)))))) <: +(*(envWrapper(trig,freqEnv,freq_xp(943)))) : carrierOsc; envWrapper(trig,env,sus) = trig : mstosamps(rdm(100,3000)), sus : hitLength : env; harmRatio = 0.063; modIndex = 3.24; metro(ms) = (%(+(1),mstosamps(ms))) ~_ : ==(1); mstosamps(ms) = ms : /(1000) * ma.SR : int; rdmInc = _ <: @(1), @(2) : + : *(2994.2313) : int : +(38125); rdm(rdmin,rdmax) = _,(fmod(_,rdmax - rdmin : int) ~ rdmInc : +(rdmin)) : gater : -(1) : abs; gater = (_,_,_ <: !,_,!,_,!,!,!,!,_ : select2) ~_; mtof(midinote) = pow(2,(midinote - 69) / 12) * 440; hitLength(length,sustain) = *((==(length,@(length,1))), +(1))~_ <: gater(<(sustain)); ampEnvbpf = ba.bpf.start(0, 0) : ba.bpf.point(amp_xp(60.241), 1.) : ba.bpf.point(amp_xp(461.847), 0.) : ba.bpf.point(amp_xp(582.329), 0.928) : ba.bpf.point(amp_xp(682.731), 0.5) : ba.bpf.point(amp_xp(983.936), 0.) : ba.bpf.point(amp_xp(1064.257), 0.) : ba.bpf.point(amp_xp(1345.382), 0.) : ba.bpf.point(amp_xp(1526.105), 0.) : ba.bpf.point(amp_xp(1746.988), 0.) : ba.bpf.point(amp_xp(1827.309), 0.) : ba.bpf.point(amp_xp(2088.353), 0.) : ba.bpf.end(amp_xp(2510.040), 0.); ampEnv = ampEnvbpf; amp_xp(x) = x * ma.SR / 1000. * ampEnv_speed; ampEnv_speed = noteTrig : rdm(0,2000) : /(1000); freqEnvbpf = ba.bpf.start(0, 0) : ba.bpf.point(freq_xp(147.751), 1.) : ba.bpf.point(freq_xp(193.213), 0.) : ba.bpf.point(freq_xp(318.233), yp) : ba.bpf.point(freq_xp(431.888), 0.) : ba.bpf.point(freq_xp(488.715), 0.434) : ba.bpf.point(freq_xp(613.735), yp) : ba.bpf.point(freq_xp(659.197), 1.) : ba.bpf.point(freq_xp(716.024), yp) : ba.bpf.point(freq_xp(806.948), 1.) : ba.bpf.end(freq_xp(943.333), 0.); freqEnv = freqEnvbpf : si.smooth(0.999) : fi.lowpass(1, 3000); freq_xp(x) = x * ma.SR / 1000. * freqEnv_speed; freqEnv_speed = noteTrig : rdm(0,2000) : /(1000); yp = noteTrig : rdm(0,1000) : /(1000); harmEnvbpf = ba.bpf.start(0, 0.) : ba.bpf.point(harm_xp(863.454), 0.490) : ba.bpf.point(harm_xp(865), 0.) : ba.bpf.point (harm_xp(1305.221), 1.) : ba.bpf.end(harm_xp(1700), 0.); harmEnv = harmEnvbpf : si.smooth(0.999) : fi.lowpass(1, 3000); harm_xp(x) = x * ma.SR / 1000. * harmEnv_speed; harmEnv_speed = noteTrig : rdm(0,2000) : /(1000); modIndexEnvbpf = ba.bpf.start(0, 0.) : ba.bpf.point(modIndex_xp(240.964), 0.554) : ba.bpf.end(modIndex_xp(550), 0.); modIndexEnv = modIndexEnvbpf; modIndex_xp(x) = x * ma.SR / 1000. * modIndexEnv_speed; modIndexEnv_speed = noteTrig : rdm(0,2000) : /(1000);
4324cb7d8e7aa67c84a886e5e7b6bdaa744705c8ec6dc103abe24d94e6ebd7cf
moforte/sam-faust
flanger.dsp
// Created from flange.dsp 2015/06/21 import("stdfaust.lib"); import("layout2.dsp"); flanger_mono(dmax,curdel,depth,fb,invert,lfoshape) = _ <: _, (-:de.fdelay(dmax,curdel)) ~ *(fb) : _, *(select2(invert,depth,0-depth)) : + : *(1/(1+depth)); // ideal for dc and reinforced sinusoids (in-phase summed signals) process = ba.bypass1(fbp,flanger_mono_gui); // Kill the groups to save vertical space: meter_group(x) = flsg(x); ctl_group(x) = flkg(x); del_group(x) = flkg(x); lvl_group(x) = flkf(x); flangeview = lfo(freq); flanger_mono_gui = attach(flangeview) : flanger_mono(dmax,curdel,depth,fb,invert,lfoshape); sinlfo(freq) = (1 + os.oscrs(freq))/2; trilfo(freq) = 1.0-abs(os.saw1(freq)); lfo(f) = (lfoshape * trilfo(f)) + ((1-lfoshape) * sinlfo(f)); dmax = 2048; odflange = 44; // ~1 ms at 44.1 kHz = min delay dflange = ((dmax-1)-odflange)*del_group(vslider("[1] Delay [midi:ctrl 50][style:knob]", 0.22, 0, 1, 1)); freq = ctl_group(vslider("[1] Rate [midi:ctrl 2] [unit:Hz] [style:knob]", 0.5, 0, 10, 0.01)) : si.smooth(ba.tau2pole(freqT60/6.91)); freqT60 = 0.15661; depth = ctl_group(vslider("[3] Depth [midi:ctrl 3] [style:knob]", .75, 0, 1, 0.001)) : si.smooth(ba.tau2pole(depthT60/6.91)); depthT60 = 0.15661; fb = ctl_group(vslider("[5] Feedback [midi:ctrl 4] [style:knob]", 0, -0.995, 0.99, 0.001)) : si.smooth(ba.tau2pole(fbT60/6.91)); fbT60 = 0.15661; lfoshape = ctl_group(vslider("[7] Waveshape [midi:ctrl 54] [style:knob]", 0, 0, 1, 0.001)); curdel = odflange+dflange*lfo(freq); fbp = 1-int(flsg(vslider("[0] Enable [midi:ctrl 102][style:knob]",0,0,1,1))); invert = flsg(vslider("[1] Invert [midi:ctrl 49][style:knob]",0,0,1,1):int);
https://raw.githubusercontent.com/moforte/sam-faust/85be03f262e384c1befa9eaac237e052040b2cc1/faust-examples/flanger/flanger.dsp
faust
Created from flange.dsp 2015/06/21 ideal for dc and reinforced sinusoids (in-phase summed signals) Kill the groups to save vertical space: ~1 ms at 44.1 kHz = min delay
import("stdfaust.lib"); import("layout2.dsp"); flanger_mono(dmax,curdel,depth,fb,invert,lfoshape) = _ <: _, (-:de.fdelay(dmax,curdel)) ~ *(fb) : _, *(select2(invert,depth,0-depth)) process = ba.bypass1(fbp,flanger_mono_gui); meter_group(x) = flsg(x); ctl_group(x) = flkg(x); del_group(x) = flkg(x); lvl_group(x) = flkf(x); flangeview = lfo(freq); flanger_mono_gui = attach(flangeview) : flanger_mono(dmax,curdel,depth,fb,invert,lfoshape); sinlfo(freq) = (1 + os.oscrs(freq))/2; trilfo(freq) = 1.0-abs(os.saw1(freq)); lfo(f) = (lfoshape * trilfo(f)) + ((1-lfoshape) * sinlfo(f)); dmax = 2048; dflange = ((dmax-1)-odflange)*del_group(vslider("[1] Delay [midi:ctrl 50][style:knob]", 0.22, 0, 1, 1)); freq = ctl_group(vslider("[1] Rate [midi:ctrl 2] [unit:Hz] [style:knob]", 0.5, 0, 10, 0.01)) : si.smooth(ba.tau2pole(freqT60/6.91)); freqT60 = 0.15661; depth = ctl_group(vslider("[3] Depth [midi:ctrl 3] [style:knob]", .75, 0, 1, 0.001)) : si.smooth(ba.tau2pole(depthT60/6.91)); depthT60 = 0.15661; fb = ctl_group(vslider("[5] Feedback [midi:ctrl 4] [style:knob]", 0, -0.995, 0.99, 0.001)) : si.smooth(ba.tau2pole(fbT60/6.91)); fbT60 = 0.15661; lfoshape = ctl_group(vslider("[7] Waveshape [midi:ctrl 54] [style:knob]", 0, 0, 1, 0.001)); curdel = odflange+dflange*lfo(freq); fbp = 1-int(flsg(vslider("[0] Enable [midi:ctrl 102][style:knob]",0,0,1,1))); invert = flsg(vslider("[1] Invert [midi:ctrl 49][style:knob]",0,0,1,1):int);
24e1d76c03eec336fdce117b2ed7fbeaf6432112ff4ad475ef040ae548fcf0fe
moforte/sam-faust
chorus.dsp
import("stdfaust.lib"); import("layout2.dsp"); voices = 8; // MUST BE EVEN process = bypass1to2(cbp,chorus_mono(dmax,curdel,rate,sigma,do2,voices)); // to become ba.bypass1to2 in Faust's basics.lib: bypass1to2(bpc,e) = _ <: ((inswitch:e),_,_) : ba.select2stereo(bpc) with {inswitch = select2(bpc,_,0);}; ml = library("music.lib"); // /l/fdlo/music.lib fl = library("filter.lib"); el = library("effect.lib"); // /l/fdlo/effect.lib ol = library("oscillator.lib"); // /l/fdlo/oscillator.lib wo = library("waveoscs.dsp"); pi = 4.0*atan(1.0); dmax = 8192; curdel = dmax * ckg(vslider("[0] Delay [midi:ctrl 4] [style:knob]", 0.5, 0, 1, 1)) : fl.smooth(0.999); rateMax = 7.0; // Hz rateMin = 0.01; rateT60 = 0.15661; rate = ckg(vslider("[1] Rate [midi:ctrl 2] [unit:Hz] [style:knob]", 0.5, rateMin, rateMax, 0.0001)) : fl.smooth(fl.tau2pole(rateT60/6.91)); depth = ckg(vslider("[4] Depth [midi:ctrl 3] [style:knob]", 0.5, 0, 1, 0.001)) : fl.smooth(fl.tau2pole(depthT60/6.91)); depthT60 = 0.15661; delayPerVoice = 0.5*curdel/voices; sigma = delayPerVoice * ckg(vslider("[6] Deviation [midi:ctrl 58] [style:knob]",0.5,0,1,0.001)) : fl.smooth(0.999); periodic = 1; do2 = depth; // use when depth=1 means "multivibrato" effect (no original => all are modulated) cbp = 1-int(csg(vslider("[0] Enable [midi:ctrl 102][style:knob]",0,0,1,1))); chorus_mono(dmax,curdel,rate,sigma,do2,voices) = _ <: (*(1-do2)<:_,_),(*(do2) <: par(i,voices,voice(i)) :> _,_) : ml.interleave(2,2) : +,+ with { angle(i) = 2*pi*(i/2)/voices + (i%2)*pi/2; voice(i) = ml.fdelay(dmax,min(dmax,del(i))) * cos(angle(i)); del(i) = curdel*(i+1)/voices + dev(i); rates(i) = rate/float(i+1); dev(i) = sigma * wo.oscp(rates(i),i*2*pi/voices); }; chorus_stereo(dmax,curdel,rate,sigma,do2,voices) = _,_ <: *(1-do2),*(1-do2),(*(do2),*(do2) <: par(i,voices,voice(i)):>_,_) : ml.interleave(2,2) : +,+; voice(i) = ml.fdelay(dmax,min(dmax,del(i)))/(i+1) with { angle(i) = 2*pi*(i/2)/voices + (i%2)*pi/2; voice(i) = ml.fdelay(dmax,min(dmax,del(i))) * cos(angle(i)); del(i) = curdel*(i+1)/voices + dev(i); rates(i) = rate/float(i+1); dev(i) = sigma * wo.oscp(rates(i),i*2*pi/voices); };
https://raw.githubusercontent.com/moforte/sam-faust/85be03f262e384c1befa9eaac237e052040b2cc1/faust-examples/chorus/chorus.dsp
faust
MUST BE EVEN to become ba.bypass1to2 in Faust's basics.lib: /l/fdlo/music.lib /l/fdlo/effect.lib /l/fdlo/oscillator.lib Hz use when depth=1 means "multivibrato" effect (no original => all are modulated)
import("stdfaust.lib"); import("layout2.dsp"); process = bypass1to2(cbp,chorus_mono(dmax,curdel,rate,sigma,do2,voices)); bypass1to2(bpc,e) = _ <: ((inswitch:e),_,_) : ba.select2stereo(bpc) with {inswitch = select2(bpc,_,0);}; fl = library("filter.lib"); wo = library("waveoscs.dsp"); pi = 4.0*atan(1.0); dmax = 8192; curdel = dmax * ckg(vslider("[0] Delay [midi:ctrl 4] [style:knob]", 0.5, 0, 1, 1)) : fl.smooth(0.999); rateMin = 0.01; rateT60 = 0.15661; rate = ckg(vslider("[1] Rate [midi:ctrl 2] [unit:Hz] [style:knob]", 0.5, rateMin, rateMax, 0.0001)) : fl.smooth(fl.tau2pole(rateT60/6.91)); depth = ckg(vslider("[4] Depth [midi:ctrl 3] [style:knob]", 0.5, 0, 1, 0.001)) : fl.smooth(fl.tau2pole(depthT60/6.91)); depthT60 = 0.15661; delayPerVoice = 0.5*curdel/voices; sigma = delayPerVoice * ckg(vslider("[6] Deviation [midi:ctrl 58] [style:knob]",0.5,0,1,0.001)) : fl.smooth(0.999); periodic = 1; cbp = 1-int(csg(vslider("[0] Enable [midi:ctrl 102][style:knob]",0,0,1,1))); chorus_mono(dmax,curdel,rate,sigma,do2,voices) = _ <: (*(1-do2)<:_,_),(*(do2) <: par(i,voices,voice(i)) :> _,_) : ml.interleave(2,2) : +,+ with { angle(i) = 2*pi*(i/2)/voices + (i%2)*pi/2; voice(i) = ml.fdelay(dmax,min(dmax,del(i))) * cos(angle(i)); del(i) = curdel*(i+1)/voices + dev(i); rates(i) = rate/float(i+1); dev(i) = sigma * wo.oscp(rates(i),i*2*pi/voices); }; chorus_stereo(dmax,curdel,rate,sigma,do2,voices) = _,_ <: *(1-do2),*(1-do2),(*(do2),*(do2) <: par(i,voices,voice(i)):>_,_) : ml.interleave(2,2) : +,+; voice(i) = ml.fdelay(dmax,min(dmax,del(i)))/(i+1) with { angle(i) = 2*pi*(i/2)/voices + (i%2)*pi/2; voice(i) = ml.fdelay(dmax,min(dmax,del(i))) * cos(angle(i)); del(i) = curdel*(i+1)/voices + dev(i); rates(i) = rate/float(i+1); dev(i) = sigma * wo.oscp(rates(i),i*2*pi/voices); };
b25722812acbbeb36f69e73c603e440b3cd1c66ec2e61e4d6d387a7a6d8b2fb9
moforte/sam-faust
chorus.dsp
import("stdfaust.lib"); import("layout2.dsp"); voices = 8; // MUST BE EVEN process = bypass1to2(cbp,chorus_mono(dmax,curdel,rate,sigma,do2,voices)); // to become ba.bypass1to2 in Faust's basics.lib: bypass1to2(bpc,e) = _ <: ((inswitch:e),_,_) : ba.select2stereo(bpc) with {inswitch = select2(bpc,_,0);}; ml = library("music.lib"); // /l/fdlo/music.lib fl = library("filter.lib"); el = library("effect.lib"); // /l/fdlo/effect.lib ol = library("oscillator.lib"); // /l/fdlo/oscillator.lib wo = library("waveoscs.dsp"); pi = 4.0*atan(1.0); dmax = 8192; curdel = dmax * ckg(vslider("[0] Delay [midi:ctrl 55] [style:knob]", 0.5, 0, 1, 1)) : fl.smooth(0.999); rateMax = 7.0; // Hz rateMin = 0.01; rateT60 = 0.15661; rate = ckg(vslider("[1] Rate [midi:ctrl 56] [unit:Hz] [style:knob]", 0.5, rateMin, rateMax, 0.0001)) : fl.smooth(fl.tau2pole(rateT60/6.91)); depth = ckg(vslider("[4] Depth [midi:ctrl 57] [style:knob]", 0.5, 0, 1, 0.001)) : fl.smooth(fl.tau2pole(depthT60/6.91)); depthT60 = 0.15661; delayPerVoice = 0.5*curdel/voices; sigma = delayPerVoice * ckg(vslider("[6] Deviation [midi:ctrl 58] [style:knob]",0.5,0,1,0.001)) : fl.smooth(0.999); periodic = 1; do2 = depth; // use when depth=1 means "multivibrato" effect (no original => all are modulated) cbp = 1-int(csg(vslider("[0] Enable [midi:ctrl 103][style:knob]",0,0,1,1))); chorus_mono(dmax,curdel,rate,sigma,do2,voices) = _ <: (*(1-do2)<:_,_),(*(do2) <: par(i,voices,voice(i)) :> _,_) : ml.interleave(2,2) : +,+ with { angle(i) = 2*pi*(i/2)/voices + (i%2)*pi/2; voice(i) = ml.fdelay(dmax,min(dmax,del(i))) * cos(angle(i)); del(i) = curdel*(i+1)/voices + dev(i); rates(i) = rate/float(i+1); dev(i) = sigma * wo.oscp(rates(i),i*2*pi/voices); }; chorus_stereo(dmax,curdel,rate,sigma,do2,voices) = _,_ <: *(1-do2),*(1-do2),(*(do2),*(do2) <: par(i,voices,voice(i)):>_,_) : ml.interleave(2,2) : +,+; voice(i) = ml.fdelay(dmax,min(dmax,del(i)))/(i+1) with { angle(i) = 2*pi*(i/2)/voices + (i%2)*pi/2; voice(i) = ml.fdelay(dmax,min(dmax,del(i))) * cos(angle(i)); del(i) = curdel*(i+1)/voices + dev(i); rates(i) = rate/float(i+1); dev(i) = sigma * wo.oscp(rates(i),i*2*pi/voices); };
https://raw.githubusercontent.com/moforte/sam-faust/85be03f262e384c1befa9eaac237e052040b2cc1/faust-examples/effects/chorus.dsp
faust
MUST BE EVEN to become ba.bypass1to2 in Faust's basics.lib: /l/fdlo/music.lib /l/fdlo/effect.lib /l/fdlo/oscillator.lib Hz use when depth=1 means "multivibrato" effect (no original => all are modulated)
import("stdfaust.lib"); import("layout2.dsp"); process = bypass1to2(cbp,chorus_mono(dmax,curdel,rate,sigma,do2,voices)); bypass1to2(bpc,e) = _ <: ((inswitch:e),_,_) : ba.select2stereo(bpc) with {inswitch = select2(bpc,_,0);}; fl = library("filter.lib"); wo = library("waveoscs.dsp"); pi = 4.0*atan(1.0); dmax = 8192; curdel = dmax * ckg(vslider("[0] Delay [midi:ctrl 55] [style:knob]", 0.5, 0, 1, 1)) : fl.smooth(0.999); rateMin = 0.01; rateT60 = 0.15661; rate = ckg(vslider("[1] Rate [midi:ctrl 56] [unit:Hz] [style:knob]", 0.5, rateMin, rateMax, 0.0001)) : fl.smooth(fl.tau2pole(rateT60/6.91)); depth = ckg(vslider("[4] Depth [midi:ctrl 57] [style:knob]", 0.5, 0, 1, 0.001)) : fl.smooth(fl.tau2pole(depthT60/6.91)); depthT60 = 0.15661; delayPerVoice = 0.5*curdel/voices; sigma = delayPerVoice * ckg(vslider("[6] Deviation [midi:ctrl 58] [style:knob]",0.5,0,1,0.001)) : fl.smooth(0.999); periodic = 1; cbp = 1-int(csg(vslider("[0] Enable [midi:ctrl 103][style:knob]",0,0,1,1))); chorus_mono(dmax,curdel,rate,sigma,do2,voices) = _ <: (*(1-do2)<:_,_),(*(do2) <: par(i,voices,voice(i)) :> _,_) : ml.interleave(2,2) : +,+ with { angle(i) = 2*pi*(i/2)/voices + (i%2)*pi/2; voice(i) = ml.fdelay(dmax,min(dmax,del(i))) * cos(angle(i)); del(i) = curdel*(i+1)/voices + dev(i); rates(i) = rate/float(i+1); dev(i) = sigma * wo.oscp(rates(i),i*2*pi/voices); }; chorus_stereo(dmax,curdel,rate,sigma,do2,voices) = _,_ <: *(1-do2),*(1-do2),(*(do2),*(do2) <: par(i,voices,voice(i)):>_,_) : ml.interleave(2,2) : +,+; voice(i) = ml.fdelay(dmax,min(dmax,del(i)))/(i+1) with { angle(i) = 2*pi*(i/2)/voices + (i%2)*pi/2; voice(i) = ml.fdelay(dmax,min(dmax,del(i))) * cos(angle(i)); del(i) = curdel*(i+1)/voices + dev(i); rates(i) = rate/float(i+1); dev(i) = sigma * wo.oscp(rates(i),i*2*pi/voices); };
f980d77f5d520d1f39a36b9b4c1d0d8eb0b930f7b59a7338f8f34ec3899005ee
moforte/sam-faust
echo.dsp
// imported by echo.dsp and echomt.dsp import("stdfaust.lib"); import("layout2.dsp"); echo_group(x) = x; // Let layout2.dsp lay us out knobs_group(x) = ekg(x); switches_group(x) = esg(x); dmax = 32768; // one and done dmaxs = float(dmax)/44100.0; Nnines = 1.8; // Increase until you get the desired maximum amount of smoothing when fbs==1 fastpow2 = ffunction(float fastpow2(float), "fast_pow2.h", ""); fbspr(fbs) = 1.0 - fastpow2(-3.33219*Nnines*fbs); // pole radius of feedback smoother inputSelect(gi) = _,0 : select2(gi); echo_mono(dmax,curdel,tapdel,fb,fbspr,gi) = inputSelect(gi) : (+:si.smooth(fbspr) <: de.fdelay(dmax,curdel), de.fdelay(dmax,tapdel)) ~(*(fb),!) : !,_; tau2pole(tau) = ba.if(tau>0, exp(-1.0/(tau*ma.SR)), 0.0); t60smoother(dEchoT60) = si.smooth(tau2pole(dEchoT60/6.91)); dEchoT60 = knobs_group(vslider("[1] DelayT60 [midi:ctrl 60] [style:knob]", 0.5, 0, 100, 0.001)); dEchoSamplesRaw = knobs_group(vslider("[0] Delay [midi:ctrl 4] [style:knob]", 0.5, 0.001, (dmaxs-0.001), 0.001)) * ma.SR; dEchoSamples = dEchoSamplesRaw : t60smoother(dEchoT60); warpRaw = knobs_group(vslider("[0] Warp [midi:ctrl 62] [style:knob]", 0, -1.0, 1.0, 0.001)); scrubAmpRaw = 0; scrubPhaseRaw = 0; fb = knobs_group(vslider("[2] Feedback [midi:ctrl 3] [style:knob]", .3, 0.0, 1.0, 0.0001)); amp = knobs_group(vslider("[3] Amp [midi:ctrl 2] [style:knob]", .5, 0, 1, 0.001)) : si.smooth(ba.tau2pole(ampT60/6.91)); ampT60 = 0.15661; fbs = knobs_group(vslider("[5] [midi:ctrl 76] FeedbackSm [style:knob]", 0, 0, 1, 0.00001)); gi = switches_group(1-vslider("[7] [midi:ctrl 102] EnableEcho[style:knob]",0,0,1,1)); // "ground input" switches input to zeros // Warp and Scrubber stuff: enableEcho = (scrubAmpRaw > 0.00001); triggerScrubOn = (enableEcho - enableEcho') > 0; // enableEcho went 0 to 1 triggerScrubOff = (enableEcho - enableEcho') < 0; // enableEcho went 1 to 0 // Ramps up only during scrub "hold" time and is otherwise zero: counter = (enableEcho * (triggerScrubOn : + ~ +(1) * enableEcho : -(2))) & (dmax-1); // implementation that continues scrubbing where it left off: scrubPhase = scrubPhaseRaw : t60smoother(dEchoT60*(1-triggerScrubOff)); scrubAmp = scrubAmpRaw : t60smoother(dEchoT60*(1-triggerScrubOff)); warp = warpRaw : t60smoother(dEchoT60); dTapSamplesRaw = dEchoSamplesRaw * (1.0 + warp + scrubPhase * scrubAmp) + float(counter); dTapSamples = dTapSamplesRaw : t60smoother(dEchoT60*(1-triggerScrubOff)); process = _ <: _, amp * echo_mono(dmax,dEchoSamples,dTapSamples,fb,fbspr(fbs),gi) : +;
https://raw.githubusercontent.com/moforte/sam-faust/85be03f262e384c1befa9eaac237e052040b2cc1/faust-examples/echo/echo.dsp
faust
imported by echo.dsp and echomt.dsp Let layout2.dsp lay us out one and done Increase until you get the desired maximum amount of smoothing when fbs==1 pole radius of feedback smoother "ground input" switches input to zeros Warp and Scrubber stuff: enableEcho went 0 to 1 enableEcho went 1 to 0 Ramps up only during scrub "hold" time and is otherwise zero: implementation that continues scrubbing where it left off:
import("stdfaust.lib"); import("layout2.dsp"); knobs_group(x) = ekg(x); switches_group(x) = esg(x); dmaxs = float(dmax)/44100.0; fastpow2 = ffunction(float fastpow2(float), "fast_pow2.h", ""); inputSelect(gi) = _,0 : select2(gi); echo_mono(dmax,curdel,tapdel,fb,fbspr,gi) = inputSelect(gi) : (+:si.smooth(fbspr) <: de.fdelay(dmax,curdel), de.fdelay(dmax,tapdel)) ~(*(fb),!) : !,_; tau2pole(tau) = ba.if(tau>0, exp(-1.0/(tau*ma.SR)), 0.0); t60smoother(dEchoT60) = si.smooth(tau2pole(dEchoT60/6.91)); dEchoT60 = knobs_group(vslider("[1] DelayT60 [midi:ctrl 60] [style:knob]", 0.5, 0, 100, 0.001)); dEchoSamplesRaw = knobs_group(vslider("[0] Delay [midi:ctrl 4] [style:knob]", 0.5, 0.001, (dmaxs-0.001), 0.001)) * ma.SR; dEchoSamples = dEchoSamplesRaw : t60smoother(dEchoT60); warpRaw = knobs_group(vslider("[0] Warp [midi:ctrl 62] [style:knob]", 0, -1.0, 1.0, 0.001)); scrubAmpRaw = 0; scrubPhaseRaw = 0; fb = knobs_group(vslider("[2] Feedback [midi:ctrl 3] [style:knob]", .3, 0.0, 1.0, 0.0001)); amp = knobs_group(vslider("[3] Amp [midi:ctrl 2] [style:knob]", .5, 0, 1, 0.001)) : si.smooth(ba.tau2pole(ampT60/6.91)); ampT60 = 0.15661; fbs = knobs_group(vslider("[5] [midi:ctrl 76] FeedbackSm [style:knob]", 0, 0, 1, 0.00001)); enableEcho = (scrubAmpRaw > 0.00001); counter = (enableEcho * (triggerScrubOn : + ~ +(1) * enableEcho : -(2))) & (dmax-1); scrubPhase = scrubPhaseRaw : t60smoother(dEchoT60*(1-triggerScrubOff)); scrubAmp = scrubAmpRaw : t60smoother(dEchoT60*(1-triggerScrubOff)); warp = warpRaw : t60smoother(dEchoT60); dTapSamplesRaw = dEchoSamplesRaw * (1.0 + warp + scrubPhase * scrubAmp) + float(counter); dTapSamples = dTapSamplesRaw : t60smoother(dEchoT60*(1-triggerScrubOff)); process = _ <: _, amp * echo_mono(dmax,dEchoSamples,dTapSamples,fb,fbspr(fbs),gi) : +;
8cadf4af93675fc5fea4b0501744deb9e43462ece695b612cb59abd46049a900
moforte/sam-faust
effectsForBrowser.dsp
// All effects used by minimoog.dsp import("stdfaust.lib"); process = _,_ : + : component_echo : component_flanger : component_chorus : component_freeverb; component_echo = environment { echo_group(x) = x; // Let layout2.dsp lay us out knobs_group(x) = ekg(x); switches_group(x) = esg(x); dmax = 32768; // one and done dmaxs = float(dmax)/44100.0; Nnines = 1.8; // Increase until you get the desired maximum amount of smoothing when fbs==1 //fastpow2 = ffunction(float fastpow2(float), "fast_pow2.h", ""); fbspr(fbs) = 1.0 - pow(2.0, -3.33219*Nnines*fbs); // pole radius of feedback smoother inputSelect(gi) = _,0 : select2(gi); echo_mono(dmax,curdel,tapdel,fb,fbspr,gi) = inputSelect(gi) : (+:si.smooth(fbspr) <: de.fdelay(dmax,curdel), de.fdelay(dmax,tapdel)) ~(*(fb),!) : !,_; tau2pole(tau) = ba.if(tau>0, exp(-1.0/(tau*ma.SR)), 0.0); t60smoother(dEchoT60) = si.smooth(tau2pole(dEchoT60/6.91)); dEchoT60 = knobs_group(vslider("[1] DelayT60 [midi:ctrl 60] [style:knob]", 0.5, 0, 100, 0.001)); dEchoSamplesRaw = knobs_group(vslider("[0] Delay [midi:ctrl 61] [style:knob]", 0.5, 0.001, (dmaxs-0.001), 0.001)) * ma.SR; dEchoSamples = dEchoSamplesRaw : t60smoother(dEchoT60); warpRaw = knobs_group(vslider("[0] Warp [midi:ctrl 62] [style:knob]", 0, -1.0, 1.0, 0.001)); scrubAmpRaw = 0; scrubPhaseRaw = 0; fb = knobs_group(vslider("[2] Feedback [midi:ctrl 2] [style:knob]", .3, 0.0, 1.0, 0.0001)); amp = knobs_group(vslider("[3] Amp [midi:ctrl 75] [style:knob]", .5, 0, 1, 0.001)) : si.smooth(ba.tau2pole(ampT60/6.91)); ampT60 = 0.15661; fbs = knobs_group(vslider("[5] [midi:ctrl 76] FeedbackSm [style:knob]", 0, 0, 1, 0.00001)); gi = switches_group(1-vslider("[7] [midi:ctrl 105] EnableEcho[style:knob]",0,0,1,1)); // "ground input" switches input to zeros // Warp and Scrubber stuff: enableEcho = (scrubAmpRaw > 0.00001); triggerScrubOn = (enableEcho - enableEcho') > 0; // enableEcho went 0 to 1 triggerScrubOff = (enableEcho - enableEcho') < 0; // enableEcho went 1 to 0 // Ramps up only during scrub "hold" time and is otherwise zero: counter = (enableEcho * (triggerScrubOn : + ~ +(1) * enableEcho : -(2))) & (dmax-1); // implementation that continues scrubbing where it left off: scrubPhase = scrubPhaseRaw : t60smoother(dEchoT60*(1-triggerScrubOff)); scrubAmp = scrubAmpRaw : t60smoother(dEchoT60*(1-triggerScrubOff)); warp = warpRaw : t60smoother(dEchoT60); dTapSamplesRaw = dEchoSamplesRaw * (1.0 + warp + scrubPhase * scrubAmp) + float(counter); dTapSamples = dTapSamplesRaw : t60smoother(dEchoT60*(1-triggerScrubOff)); echo_process = _ <: _, amp * echo_mono(dmax,dEchoSamples,dTapSamples,fb,fbspr(fbs),gi) : +; }.echo_process; component_flanger = environment { // Created from flange.dsp 2015/06/21 flanger_mono(dmax,curdel,depth,fb,invert,lfoshape) = _ <: _, (-:de.fdelay(dmax,curdel)) ~ *(fb) : _, *(select2(invert,depth,0-depth)) : + : *(1/(1+depth)); // ideal for dc and reinforced sinusoids (in-phase summed signals) flanger_process = ba.bypass1(fbp,flanger_mono_gui); // Kill the groups to save vertical space: meter_group(x) = flsg(x); ctl_group(x) = flkg(x); del_group(x) = flkg(x); lvl_group(x) = flkf(x); flangeview = lfo(freq); flanger_mono_gui = attach(flangeview) : flanger_mono(dmax,curdel,depth,fb,invert,lfoshape); sinlfo(freq) = (1 + os.oscrs(freq))/2; trilfo(freq) = 1.0-abs(os.saw1(freq)); lfo(f) = (lfoshape * trilfo(f)) + ((1-lfoshape) * sinlfo(f)); dmax = 2048; odflange = 44; // ~1 ms at 44.1 kHz = min delay dflange = ((dmax-1)-odflange)*del_group(vslider("[1] Delay [midi:ctrl 50][style:knob]", 0.22, 0, 1, 1)); freq = ctl_group(vslider("[1] Rate [midi:ctrl 51] [unit:Hz] [style:knob]", 0.5, 0, 10, 0.01)) : si.smooth(ba.tau2pole(freqT60/6.91)); freqT60 = 0.15661; depth = ctl_group(vslider("[3] Depth [midi:ctrl 52] [style:knob]", .75, 0, 1, 0.001)) : si.smooth(ba.tau2pole(depthT60/6.91)); depthT60 = 0.15661; fb = ctl_group(vslider("[5] Feedback [midi:ctrl 53] [style:knob]", 0, -0.995, 0.99, 0.001)) : si.smooth(ba.tau2pole(fbT60/6.91)); fbT60 = 0.15661; lfoshape = ctl_group(vslider("[7] Waveshape [midi:ctrl 54] [style:knob]", 0, 0, 1, 0.001)); curdel = odflange+dflange*lfo(freq); fbp = 1-int(flsg(vslider("[0] Enable [midi:ctrl 102][style:knob]",0,0,1,1))); invert = flsg(vslider("[1] Invert [midi:ctrl 49][style:knob]",0,0,1,1):int); }.flanger_process; component_chorus = environment { voices = 8; // MUST BE EVEN chorus_process = bypass1to2(cbp,chorus_mono(dmax,curdel,rate,sigma,do2,voices)); // to become ba.bypass1to2 in Faust's basics.lib: bypass1to2(bpc,e) = _ <: ((inswitch:e),_,_) : ba.select2stereo(bpc) with {inswitch = select2(bpc,_,0);}; ml = library("music.lib"); // /l/fdlo/music.lib fl = library("filter.lib"); el = library("effect.lib"); // /l/fdlo/effect.lib ol = library("oscillator.lib"); // /l/fdlo/oscillator.lib //wo = library("waveoscs.dsp"); //pi = 4.0*atan(1.0); oscs(freq) = rdtable(tablesize, sinwaveform, int(ml.phase(freq)) ); oscc(freq) = rdtable(tablesize, coswaveform, int(ml.phase(freq)) ); oscp(freq,p) = oscs(freq) * cos(p) + oscc(freq) * sin(p); // osc = oscs; // music.lib sinwaveform = float(ml.time)*(2.0*pi)/float(tablesize) : sin; coswaveform = float(ml.time)*(2.0*pi)/float(tablesize) : cos; tablesize = 1 << 16; pi = 4.0*atan(1.0); dmax = 8192; curdel = dmax * ckg(vslider("[0] Delay [midi:ctrl 55] [style:knob]", 0.5, 0, 1, 1)) : fl.smooth(0.999); rateMax = 7.0; // Hz rateMin = 0.01; rateT60 = 0.15661; rate = ckg(vslider("[1] Rate [midi:ctrl 56] [unit:Hz] [style:knob]", 0.5, rateMin, rateMax, 0.0001)) : fl.smooth(fl.tau2pole(rateT60/6.91)); depth = ckg(vslider("[4] Depth [midi:ctrl 57] [style:knob]", 0.5, 0, 1, 0.001)) : fl.smooth(fl.tau2pole(depthT60/6.91)); depthT60 = 0.15661; delayPerVoice = 0.5*curdel/voices; sigma = delayPerVoice * ckg(vslider("[6] Deviation [midi:ctrl 58] [style:knob]",0.5,0,1,0.001)) : fl.smooth(0.999); periodic = 1; do2 = depth; // use when depth=1 means "multivibrato" effect (no original => all are modulated) cbp = 1-int(csg(vslider("[0] Enable [midi:ctrl 103][style:knob]",0,0,1,1))); chorus_mono(dmax,curdel,rate,sigma,do2,voices) = _ <: (*(1-do2)<:_,_),(*(do2) <: par(i,voices,voice(i)) :> _,_) : ml.interleave(2,2) : +,+ with { angle(i) = 2*pi*(i/2)/voices + (i%2)*pi/2; voice(i) = ml.fdelay(dmax,min(dmax,del(i))) * cos(angle(i)); del(i) = curdel*(i+1)/voices + dev(i); rates(i) = rate/float(i+1); dev(i) = sigma * oscp(rates(i),i*2*pi/voices); }; chorus_stereo(dmax,curdel,rate,sigma,do2,voices) = _,_ <: *(1-do2),*(1-do2),(*(do2),*(do2) <: par(i,voices,voice(i)):>_,_) : ml.interleave(2,2) : +,+; voice(i) = ml.fdelay(dmax,min(dmax,del(i)))/(i+1) with { angle(i) = 2*pi*(i/2)/voices + (i%2)*pi/2; voice(i) = ml.fdelay(dmax,min(dmax,del(i))) * cos(angle(i)); del(i) = curdel*(i+1)/voices + dev(i); rates(i) = rate/float(i+1); dev(i) = sigma * oscp(rates(i),i*2*pi/voices); }; }.chorus_process; component_freeverb = environment { import("stdfaust.lib"); declare name "freeverb"; declare version "1.0"; declare author "Grame"; declare license "BSD"; declare copyright "(c) GRAME 2006 and MoForte Inc. 2017"; declare reference "https://ccrma.stanford.edu/~jos/pasp/Freeverb.html"; //====================================================== // // Freeverb // Faster version using fixed delays (20% gain) // //====================================================== // Constant Parameters //-------------------- fixedgain = 0.015; //value of the gain of fxctrl scalewet = 3.0; scaledry = 2.0; scaledamp = 0.4; scaleroom = 0.28; offsetroom = 0.7; initialroom = 0.5; initialdamp = 0.5; initialwet = 1.0/scalewet; initialdry = 0; initialwidth= 1.0; initialmode = 0.0; freezemode = 0.5; stereospread= 23; allpassfeed = 0.5; //feedback of the delays used in allpass filters // Filter Parameters //------------------ combtuningL1 = 1116; combtuningL2 = 1188; combtuningL3 = 1277; combtuningL4 = 1356; combtuningL5 = 1422; combtuningL6 = 1491; combtuningL7 = 1557; combtuningL8 = 1617; allpasstuningL1 = 556; allpasstuningL2 = 441; allpasstuningL3 = 341; allpasstuningL4 = 225; // Control Sliders //-------------------- // Damp : filters the high frequencies of the echoes (especially active for great values of RoomSize) // RoomSize : size of the reverberation room // Dry : original signal // Wet : reverberated signal dampSlider = rkg(vslider("Damp [midi:ctrl 3] [style:knob]",0.5, 0, 1, 0.025))*scaledamp; roomsizeSlider = rkg(vslider("RoomSize [midi:ctrl 4] [style:knob]", 0.5, 0, 1, 0.025))*scaleroom + offsetroom; wetSlider = rkg(vslider("Wet [midi:ctrl 79] [style:knob]", 0.3333, 0, 1, 0.025)); combfeed = roomsizeSlider; // Comb and Allpass filters //------------------------- allpass(dt,fb) = (_,_ <: (*(fb),_:+:@(dt)), -) ~ _ : (!,_); comb(dt, fb, damp) = (+:@(dt)) ~ (*(1-damp) : (+ ~ *(damp)) : *(fb)); // Reverb components //------------------ monoReverb(fb1, fb2, damp, spread) = _ <: comb(combtuningL1+spread, fb1, damp), comb(combtuningL2+spread, fb1, damp), comb(combtuningL3+spread, fb1, damp), comb(combtuningL4+spread, fb1, damp), comb(combtuningL5+spread, fb1, damp), comb(combtuningL6+spread, fb1, damp), comb(combtuningL7+spread, fb1, damp), comb(combtuningL8+spread, fb1, damp) +> allpass (allpasstuningL1+spread, fb2) : allpass (allpasstuningL2+spread, fb2) : allpass (allpasstuningL3+spread, fb2) : allpass (allpasstuningL4+spread, fb2) ; monoReverbToStereo(fb1, fb2, damp, spread) = + <: monoReverb(fb1, fb2, damp, 0) <: _,_; stereoReverb(fb1, fb2, damp, spread) = + <: monoReverb(fb1, fb2, damp, 0), monoReverb(fb1, fb2, damp, spread); monoToStereoReverb(fb1, fb2, damp, spread) = _ <: monoReverb(fb1, fb2, damp, 0), monoReverb(fb1, fb2, damp, spread); // fxctrl : add an input gain and a wet-dry control to a stereo FX //---------------------------------------------------------------- fxctrl(g,w,Fx) = _,_ <: (*(g),*(g) : Fx : *(w),*(w)), *(1-w), *(1-w) +> _,_; rbp = 1-int(rsg(vslider("[0] Enable [midi:ctrl 104][style:knob]",0,0,1,1))); // Freeverb //--------- //JOS:freeverb = fxctrl(fixedgain, wetSlider, stereoReverb(combfeed, allpassfeed, dampSlider, stereospread)); freeverb = fxctrl(fixedgain, wetSlider, monoReverbToStereo(combfeed, allpassfeed, dampSlider, stereospread)); freeverb_process = ba.bypass2(rbp,freeverb); }.freeverb_process; // This layout loosely follows the MiniMoog-V // Arturia-only features are labeled // Original versions also added where different // Need vrocker and hrocker toggle switches in Faust! // Need orange and blue color choices // Orange => Connect modulation sources to their destinations // Blue => Turn audio sources On and Off // - and later - // White => Turn performance features On and Off // Black => Select between modulation sources // Julius Smith for Analog Devices 3/1/2017 vrocker(x) = checkbox("%%x [style:vrocker]"); hrocker(x) = checkbox("%%x [style:hrocker]"); vrockerblue(x) = checkbox("%x [style:vrocker] [color:blue]"); vrockerblue(x) = checkbox("%x [style:vrocker] [color:blue]"); // USAGE: vrockerorange("[0] ModulationEnable"); hrockerblue(x) = checkbox("%%x [style:hrocker] [color:blue]"); vrockerred(x) = checkbox("%%x [style:vrocker] [color:red]"); hrockerred(x) = checkbox("%%x [style:hrocker] [color:red]"); declare designer "Robert A. Moog"; mmg(x) = hgroup("",x); // Minimoog + Effects synthg(x) = mmg(vgroup("[0] Minimoog",x)); fxg(x) = mmg(hgroup("[1] Effects",x)); mg(x) = synthg(hgroup("[0]",x)); cg(x) = mg(vgroup("[0] Controllers",x)); // Formerly named "Modules" but "Minimoog" group-title is enough vg(x) = cg(hgroup("[0] Master Volume", x)); dg(x) = cg(hgroup("[1] Oscillator Tuning & Switching", x)); // Tune knob = master tune dsg(x) = dg(vgroup("[1] Switches", x)); // Oscillator Modulation HrockerRed => apply Modulation Mix output to osc1&2 pitches // [MOVED here from osc3 group] Osc 3 Control VrockerRed => use osc3 as LFO instead of osc3 gmmg(x) = cg(hgroup("[2] Glide and ModMix", x)); // Glide knob [0:10] = portamento speed // Modulation Mix knob [0:10] (between Osc3 and Noise) = mix of noise and osc3 modulating osc1&2 pitch and/or VCF freq og(x) = mg(vgroup("[1] Oscillator Bank", x)); osc1(x) = og(hgroup("[1] Oscillator 1", x)); // UNUSED Control switch (for alignment) - Could put Oscillator Modulation switch there // Range rotary switch: LO (slow pulses or rhythm), 32', 16', 8', 4', 2' // Frequency <something> switch: LED to right // Waveform rotary switch: tri, impulse/bent-triangle, saw, pulseWide, pulseMed, pulseNarrow osc2(x) = og(hgroup("[2] Oscillator 2", x)); // UNUSED (originall) or Osc 2 Control VrockerRed // Range rotary switch: LO, 32', 16', 8', 4', 2' // Detuning knob: -7 to 7 [NO SWITCH] // Waveform rotary switch: tri, impulse(?), saw, pulseWide, pulseMed, pulseNarrow osc3(x) = og(hgroup("[3] Oscillator 3", x)); // Osc 3 Control VrockerRed => use osc3 as LFO instead of osc3 // Range rotary switch: LO, 32', 16', 8', 4', 2' // Detuning knob: -7 to 7 [NO SWITCH] // Waveform rotary switch: tri, impulse(?), saw, pulseWide, pulseMed, pulseNarrow mixg(x) = mg(vgroup("[2] Mixer", x)); // Each row 5 slots to maintain alignment and include red rockers joining VCF area: mr1(x) = mixg(hgroup("[0] Osc1", x)); // mixer row 1 = // Osc1 Volume and Osc1 HrockerBlue & _ & _ & Filter Modulation HrockerRed // Filter Modulation => Modulation Mix output to VCF freq mr2(x) = mixg(hgroup("[1] Ext In, KeyCtl", x)); // row 2 = Ext In HrockerBlue and Vol and Overload LED and Keyboard Ctl HrockerRed 1 mr3(x) = mixg(hgroup("[2] Osc2", x)); // = Osc2 Volume and Osc2 HrockerBlue and Keyboard Ctl HrockerRed 2 // Keyboard Control Modulation 1&2 => 0, 1/3, 2/3, all of Keyboard Control Signal ("gate?") applied to VCF freq mr4(x) = mixg(hgroup("[3] Noise", x)); // = Noise HrockerBlue and Volume and Noise Type VrockerBlue mr4cbg(x) = mr4(vgroup("[1]", x)); // = Noise Off and White/Pink selection // two rockers mr5(x) = mixg(hgroup("[4] Osc3", x)); // Osc3 Volume and Osc3 HrockerBlue modg(x) = mg(vgroup("[3] Modifiers", x)); vcfg(x) = modg(vgroup("[0] Filter", x)); vcf1(x) = vcfg(hgroup("[0] [tooltip:freq, Q, ContourScale]", x)); vcf1cbg(x) = vcf1(vgroup("[0] [tooltip:two checkboxes]", x)); // Filter Modulation switch // VCF Off switch // Corner Frequency knob // Filter Emphasis knob // Amount of Contour knob vcf2(x) = vcfg(hgroup("[1] Filter Contour [tooltip:AttFilt, DecFilt, Sustain Level for Filter Contour]", x)); // Attack Time knob // Decay Time knob // Sustain Level knob ng(x) = modg(hgroup("[1] Loudness Contour", x)); // Attack Time knob // Decay Time knob // Sustain Level knob echog(x) = fxg(hgroup("[4] Echo",x)); ekg(x) = echog(vgroup("[0] Knobs",x)); esg(x) = echog(vgroup("[1] Switches",x)); flg(x) = fxg(hgroup("[5] Flanger",x)); flkg(x) = flg(vgroup("[0] Knobs",x)); flsg(x) = flg(vgroup("[1] Switches",x)); chg(x) = fxg(hgroup("[6] Chorus",x)); ckg(x) = chg(vgroup("[0] Knobs",x)); csg(x) = chg(vgroup("[1] Switches",x)); rg(x) = fxg(hgroup("[7] Reverb",x)); rkg(x) = rg(vgroup("[0] Knobs",x)); rsg(x) = rg(vgroup("[1] Switches",x)); outg(x) = fxg(vgroup("[8] Output", x)); volg(x) = outg(hgroup("[0] Volume Main Output", x)); // Volume knob [0-10] // Unison switch (Arturia) or Output connect/disconnect switch (original) // When set, all voices are stacked and instrument is in mono mode tunerg(x) = outg(hgroup("[1] A-440 Switch", x)); vdtpolyg(x) = outg(hgroup("[2] Voice Detune / Poly", x)); // Voice Detune knob [0-10] (Arturia) or // Polyphonic switch [red LED below] (Arturia) // When set, instrument is in polyphonic mode with one oscillator per key clipg(x) = fxg(vgroup("[9] Soft Clip", x)); // Soft Clipping switch [red LED above] kg(x) = synthg(hgroup("[1] Keyboard Group", x)); // Keyboard was 3 1/2 octaves ws(x) = kg(vgroup("[0] Wheels and Switches", x)); s1g(x) = ws(hgroup("[0] Jacks and Rockers", x)); jg(x) = s1g(vgroup("[0] MiniJacks",x)); gdlg(x) = s1g(vgroup("[1] Glide/Decay/Legato Enables",x)); // Arturia // Glide Hrocker (see original Button version below) // Decay Hrocker (see original Button version below) => Sets Release (R) of ADSR to either 0 or Decay (R) // Legato Hrocker (not in original) s2g(x) = ws(hgroup("[1] [tooltip:Wheels+]", x)); bg(x) = s2g(vgroup("[0] [tooltip:Bend Enable and Range]", x)); wg(x) = s2g(hgroup("[1] [tooltip:Bend and Mod Wheels]", x)); // Using Glide/Decay/Legato enables above following Arturia: // dg(x) = s2g(hgroup("[2] Glide and Decay momentary pushbuttons", x)); // Glide Button injects portamento as set by Glide knob // Decay Button uses decay of Loudness Contour (else 0) keys(x) = kg(hgroup("[1] [tooltip:Keys]", x)); gg(x) = keys(hgroup("[0] [tooltip: Gates]",x)); // leave slot 1 open for sustain (below)
https://raw.githubusercontent.com/moforte/sam-faust/85be03f262e384c1befa9eaac237e052040b2cc1/faust-examples/effects/effectsForBrowser.dsp
faust
All effects used by minimoog.dsp Let layout2.dsp lay us out one and done Increase until you get the desired maximum amount of smoothing when fbs==1 fastpow2 = ffunction(float fastpow2(float), "fast_pow2.h", ""); pole radius of feedback smoother "ground input" switches input to zeros Warp and Scrubber stuff: enableEcho went 0 to 1 enableEcho went 1 to 0 Ramps up only during scrub "hold" time and is otherwise zero: implementation that continues scrubbing where it left off: Created from flange.dsp 2015/06/21 ideal for dc and reinforced sinusoids (in-phase summed signals) Kill the groups to save vertical space: ~1 ms at 44.1 kHz = min delay MUST BE EVEN to become ba.bypass1to2 in Faust's basics.lib: /l/fdlo/music.lib /l/fdlo/effect.lib /l/fdlo/oscillator.lib wo = library("waveoscs.dsp"); pi = 4.0*atan(1.0); osc = oscs; // music.lib Hz use when depth=1 means "multivibrato" effect (no original => all are modulated) ====================================================== Freeverb Faster version using fixed delays (20% gain) ====================================================== Constant Parameters -------------------- value of the gain of fxctrl feedback of the delays used in allpass filters Filter Parameters ------------------ Control Sliders -------------------- Damp : filters the high frequencies of the echoes (especially active for great values of RoomSize) RoomSize : size of the reverberation room Dry : original signal Wet : reverberated signal Comb and Allpass filters ------------------------- Reverb components ------------------ fxctrl : add an input gain and a wet-dry control to a stereo FX ---------------------------------------------------------------- Freeverb --------- JOS:freeverb = fxctrl(fixedgain, wetSlider, stereoReverb(combfeed, allpassfeed, dampSlider, stereospread)); This layout loosely follows the MiniMoog-V Arturia-only features are labeled Original versions also added where different Need vrocker and hrocker toggle switches in Faust! Need orange and blue color choices Orange => Connect modulation sources to their destinations Blue => Turn audio sources On and Off - and later - White => Turn performance features On and Off Black => Select between modulation sources Julius Smith for Analog Devices 3/1/2017 USAGE: vrockerorange("[0] ModulationEnable"); Minimoog + Effects Formerly named "Modules" but "Minimoog" group-title is enough Tune knob = master tune Oscillator Modulation HrockerRed => apply Modulation Mix output to osc1&2 pitches [MOVED here from osc3 group] Osc 3 Control VrockerRed => use osc3 as LFO instead of osc3 Glide knob [0:10] = portamento speed Modulation Mix knob [0:10] (between Osc3 and Noise) = mix of noise and osc3 modulating osc1&2 pitch and/or VCF freq UNUSED Control switch (for alignment) - Could put Oscillator Modulation switch there Range rotary switch: LO (slow pulses or rhythm), 32', 16', 8', 4', 2' Frequency <something> switch: LED to right Waveform rotary switch: tri, impulse/bent-triangle, saw, pulseWide, pulseMed, pulseNarrow UNUSED (originall) or Osc 2 Control VrockerRed Range rotary switch: LO, 32', 16', 8', 4', 2' Detuning knob: -7 to 7 [NO SWITCH] Waveform rotary switch: tri, impulse(?), saw, pulseWide, pulseMed, pulseNarrow Osc 3 Control VrockerRed => use osc3 as LFO instead of osc3 Range rotary switch: LO, 32', 16', 8', 4', 2' Detuning knob: -7 to 7 [NO SWITCH] Waveform rotary switch: tri, impulse(?), saw, pulseWide, pulseMed, pulseNarrow Each row 5 slots to maintain alignment and include red rockers joining VCF area: mixer row 1 = Osc1 Volume and Osc1 HrockerBlue & _ & _ & Filter Modulation HrockerRed Filter Modulation => Modulation Mix output to VCF freq row 2 = Ext In HrockerBlue and Vol and Overload LED and Keyboard Ctl HrockerRed 1 = Osc2 Volume and Osc2 HrockerBlue and Keyboard Ctl HrockerRed 2 Keyboard Control Modulation 1&2 => 0, 1/3, 2/3, all of Keyboard Control Signal ("gate?") applied to VCF freq = Noise HrockerBlue and Volume and Noise Type VrockerBlue = Noise Off and White/Pink selection two rockers Osc3 Volume and Osc3 HrockerBlue Filter Modulation switch VCF Off switch Corner Frequency knob Filter Emphasis knob Amount of Contour knob Attack Time knob Decay Time knob Sustain Level knob Attack Time knob Decay Time knob Sustain Level knob Volume knob [0-10] Unison switch (Arturia) or Output connect/disconnect switch (original) When set, all voices are stacked and instrument is in mono mode Voice Detune knob [0-10] (Arturia) or Polyphonic switch [red LED below] (Arturia) When set, instrument is in polyphonic mode with one oscillator per key Soft Clipping switch [red LED above] Keyboard was 3 1/2 octaves Arturia Glide Hrocker (see original Button version below) Decay Hrocker (see original Button version below) => Sets Release (R) of ADSR to either 0 or Decay (R) Legato Hrocker (not in original) Using Glide/Decay/Legato enables above following Arturia: dg(x) = s2g(hgroup("[2] Glide and Decay momentary pushbuttons", x)); Glide Button injects portamento as set by Glide knob Decay Button uses decay of Loudness Contour (else 0) leave slot 1 open for sustain (below)
import("stdfaust.lib"); process = _,_ : + : component_echo : component_flanger : component_chorus : component_freeverb; component_echo = environment { knobs_group(x) = ekg(x); switches_group(x) = esg(x); dmaxs = float(dmax)/44100.0; inputSelect(gi) = _,0 : select2(gi); echo_mono(dmax,curdel,tapdel,fb,fbspr,gi) = inputSelect(gi) : (+:si.smooth(fbspr) <: de.fdelay(dmax,curdel), de.fdelay(dmax,tapdel)) ~(*(fb),!) : !,_; tau2pole(tau) = ba.if(tau>0, exp(-1.0/(tau*ma.SR)), 0.0); t60smoother(dEchoT60) = si.smooth(tau2pole(dEchoT60/6.91)); dEchoT60 = knobs_group(vslider("[1] DelayT60 [midi:ctrl 60] [style:knob]", 0.5, 0, 100, 0.001)); dEchoSamplesRaw = knobs_group(vslider("[0] Delay [midi:ctrl 61] [style:knob]", 0.5, 0.001, (dmaxs-0.001), 0.001)) * ma.SR; dEchoSamples = dEchoSamplesRaw : t60smoother(dEchoT60); warpRaw = knobs_group(vslider("[0] Warp [midi:ctrl 62] [style:knob]", 0, -1.0, 1.0, 0.001)); scrubAmpRaw = 0; scrubPhaseRaw = 0; fb = knobs_group(vslider("[2] Feedback [midi:ctrl 2] [style:knob]", .3, 0.0, 1.0, 0.0001)); amp = knobs_group(vslider("[3] Amp [midi:ctrl 75] [style:knob]", .5, 0, 1, 0.001)) : si.smooth(ba.tau2pole(ampT60/6.91)); ampT60 = 0.15661; fbs = knobs_group(vslider("[5] [midi:ctrl 76] FeedbackSm [style:knob]", 0, 0, 1, 0.00001)); enableEcho = (scrubAmpRaw > 0.00001); counter = (enableEcho * (triggerScrubOn : + ~ +(1) * enableEcho : -(2))) & (dmax-1); scrubPhase = scrubPhaseRaw : t60smoother(dEchoT60*(1-triggerScrubOff)); scrubAmp = scrubAmpRaw : t60smoother(dEchoT60*(1-triggerScrubOff)); warp = warpRaw : t60smoother(dEchoT60); dTapSamplesRaw = dEchoSamplesRaw * (1.0 + warp + scrubPhase * scrubAmp) + float(counter); dTapSamples = dTapSamplesRaw : t60smoother(dEchoT60*(1-triggerScrubOff)); echo_process = _ <: _, amp * echo_mono(dmax,dEchoSamples,dTapSamples,fb,fbspr(fbs),gi) : +; }.echo_process; component_flanger = environment { flanger_mono(dmax,curdel,depth,fb,invert,lfoshape) = _ <: _, (-:de.fdelay(dmax,curdel)) ~ *(fb) : _, *(select2(invert,depth,0-depth)) flanger_process = ba.bypass1(fbp,flanger_mono_gui); meter_group(x) = flsg(x); ctl_group(x) = flkg(x); del_group(x) = flkg(x); lvl_group(x) = flkf(x); flangeview = lfo(freq); flanger_mono_gui = attach(flangeview) : flanger_mono(dmax,curdel,depth,fb,invert,lfoshape); sinlfo(freq) = (1 + os.oscrs(freq))/2; trilfo(freq) = 1.0-abs(os.saw1(freq)); lfo(f) = (lfoshape * trilfo(f)) + ((1-lfoshape) * sinlfo(f)); dmax = 2048; dflange = ((dmax-1)-odflange)*del_group(vslider("[1] Delay [midi:ctrl 50][style:knob]", 0.22, 0, 1, 1)); freq = ctl_group(vslider("[1] Rate [midi:ctrl 51] [unit:Hz] [style:knob]", 0.5, 0, 10, 0.01)) : si.smooth(ba.tau2pole(freqT60/6.91)); freqT60 = 0.15661; depth = ctl_group(vslider("[3] Depth [midi:ctrl 52] [style:knob]", .75, 0, 1, 0.001)) : si.smooth(ba.tau2pole(depthT60/6.91)); depthT60 = 0.15661; fb = ctl_group(vslider("[5] Feedback [midi:ctrl 53] [style:knob]", 0, -0.995, 0.99, 0.001)) : si.smooth(ba.tau2pole(fbT60/6.91)); fbT60 = 0.15661; lfoshape = ctl_group(vslider("[7] Waveshape [midi:ctrl 54] [style:knob]", 0, 0, 1, 0.001)); curdel = odflange+dflange*lfo(freq); fbp = 1-int(flsg(vslider("[0] Enable [midi:ctrl 102][style:knob]",0,0,1,1))); invert = flsg(vslider("[1] Invert [midi:ctrl 49][style:knob]",0,0,1,1):int); }.flanger_process; component_chorus = environment { chorus_process = bypass1to2(cbp,chorus_mono(dmax,curdel,rate,sigma,do2,voices)); bypass1to2(bpc,e) = _ <: ((inswitch:e),_,_) : ba.select2stereo(bpc) with {inswitch = select2(bpc,_,0);}; fl = library("filter.lib"); oscs(freq) = rdtable(tablesize, sinwaveform, int(ml.phase(freq)) ); oscc(freq) = rdtable(tablesize, coswaveform, int(ml.phase(freq)) ); oscp(freq,p) = oscs(freq) * cos(p) + oscc(freq) * sin(p); sinwaveform = float(ml.time)*(2.0*pi)/float(tablesize) : sin; coswaveform = float(ml.time)*(2.0*pi)/float(tablesize) : cos; tablesize = 1 << 16; pi = 4.0*atan(1.0); dmax = 8192; curdel = dmax * ckg(vslider("[0] Delay [midi:ctrl 55] [style:knob]", 0.5, 0, 1, 1)) : fl.smooth(0.999); rateMin = 0.01; rateT60 = 0.15661; rate = ckg(vslider("[1] Rate [midi:ctrl 56] [unit:Hz] [style:knob]", 0.5, rateMin, rateMax, 0.0001)) : fl.smooth(fl.tau2pole(rateT60/6.91)); depth = ckg(vslider("[4] Depth [midi:ctrl 57] [style:knob]", 0.5, 0, 1, 0.001)) : fl.smooth(fl.tau2pole(depthT60/6.91)); depthT60 = 0.15661; delayPerVoice = 0.5*curdel/voices; sigma = delayPerVoice * ckg(vslider("[6] Deviation [midi:ctrl 58] [style:knob]",0.5,0,1,0.001)) : fl.smooth(0.999); periodic = 1; cbp = 1-int(csg(vslider("[0] Enable [midi:ctrl 103][style:knob]",0,0,1,1))); chorus_mono(dmax,curdel,rate,sigma,do2,voices) = _ <: (*(1-do2)<:_,_),(*(do2) <: par(i,voices,voice(i)) :> _,_) : ml.interleave(2,2) : +,+ with { angle(i) = 2*pi*(i/2)/voices + (i%2)*pi/2; voice(i) = ml.fdelay(dmax,min(dmax,del(i))) * cos(angle(i)); del(i) = curdel*(i+1)/voices + dev(i); rates(i) = rate/float(i+1); dev(i) = sigma * oscp(rates(i),i*2*pi/voices); }; chorus_stereo(dmax,curdel,rate,sigma,do2,voices) = _,_ <: *(1-do2),*(1-do2),(*(do2),*(do2) <: par(i,voices,voice(i)):>_,_) : ml.interleave(2,2) : +,+; voice(i) = ml.fdelay(dmax,min(dmax,del(i)))/(i+1) with { angle(i) = 2*pi*(i/2)/voices + (i%2)*pi/2; voice(i) = ml.fdelay(dmax,min(dmax,del(i))) * cos(angle(i)); del(i) = curdel*(i+1)/voices + dev(i); rates(i) = rate/float(i+1); dev(i) = sigma * oscp(rates(i),i*2*pi/voices); }; }.chorus_process; component_freeverb = environment { import("stdfaust.lib"); declare name "freeverb"; declare version "1.0"; declare author "Grame"; declare license "BSD"; declare copyright "(c) GRAME 2006 and MoForte Inc. 2017"; declare reference "https://ccrma.stanford.edu/~jos/pasp/Freeverb.html"; scalewet = 3.0; scaledry = 2.0; scaledamp = 0.4; scaleroom = 0.28; offsetroom = 0.7; initialroom = 0.5; initialdamp = 0.5; initialwet = 1.0/scalewet; initialdry = 0; initialwidth= 1.0; initialmode = 0.0; freezemode = 0.5; stereospread= 23; combtuningL1 = 1116; combtuningL2 = 1188; combtuningL3 = 1277; combtuningL4 = 1356; combtuningL5 = 1422; combtuningL6 = 1491; combtuningL7 = 1557; combtuningL8 = 1617; allpasstuningL1 = 556; allpasstuningL2 = 441; allpasstuningL3 = 341; allpasstuningL4 = 225; dampSlider = rkg(vslider("Damp [midi:ctrl 3] [style:knob]",0.5, 0, 1, 0.025))*scaledamp; roomsizeSlider = rkg(vslider("RoomSize [midi:ctrl 4] [style:knob]", 0.5, 0, 1, 0.025))*scaleroom + offsetroom; wetSlider = rkg(vslider("Wet [midi:ctrl 79] [style:knob]", 0.3333, 0, 1, 0.025)); combfeed = roomsizeSlider; allpass(dt,fb) = (_,_ <: (*(fb),_:+:@(dt)), -) ~ _ : (!,_); comb(dt, fb, damp) = (+:@(dt)) ~ (*(1-damp) : (+ ~ *(damp)) : *(fb)); monoReverb(fb1, fb2, damp, spread) = _ <: comb(combtuningL1+spread, fb1, damp), comb(combtuningL2+spread, fb1, damp), comb(combtuningL3+spread, fb1, damp), comb(combtuningL4+spread, fb1, damp), comb(combtuningL5+spread, fb1, damp), comb(combtuningL6+spread, fb1, damp), comb(combtuningL7+spread, fb1, damp), comb(combtuningL8+spread, fb1, damp) +> allpass (allpasstuningL1+spread, fb2) : allpass (allpasstuningL2+spread, fb2) : allpass (allpasstuningL3+spread, fb2) : allpass (allpasstuningL4+spread, fb2) ; monoReverbToStereo(fb1, fb2, damp, spread) = + <: monoReverb(fb1, fb2, damp, 0) <: _,_; stereoReverb(fb1, fb2, damp, spread) = + <: monoReverb(fb1, fb2, damp, 0), monoReverb(fb1, fb2, damp, spread); monoToStereoReverb(fb1, fb2, damp, spread) = _ <: monoReverb(fb1, fb2, damp, 0), monoReverb(fb1, fb2, damp, spread); fxctrl(g,w,Fx) = _,_ <: (*(g),*(g) : Fx : *(w),*(w)), *(1-w), *(1-w) +> _,_; rbp = 1-int(rsg(vslider("[0] Enable [midi:ctrl 104][style:knob]",0,0,1,1))); freeverb = fxctrl(fixedgain, wetSlider, monoReverbToStereo(combfeed, allpassfeed, dampSlider, stereospread)); freeverb_process = ba.bypass2(rbp,freeverb); }.freeverb_process; vrocker(x) = checkbox("%%x [style:vrocker]"); hrocker(x) = checkbox("%%x [style:hrocker]"); vrockerblue(x) = checkbox("%x [style:vrocker] [color:blue]"); vrockerblue(x) = checkbox("%x [style:vrocker] [color:blue]"); hrockerblue(x) = checkbox("%%x [style:hrocker] [color:blue]"); vrockerred(x) = checkbox("%%x [style:vrocker] [color:red]"); hrockerred(x) = checkbox("%%x [style:hrocker] [color:red]"); declare designer "Robert A. Moog"; synthg(x) = mmg(vgroup("[0] Minimoog",x)); fxg(x) = mmg(hgroup("[1] Effects",x)); mg(x) = synthg(hgroup("[0]",x)); vg(x) = cg(hgroup("[0] Master Volume", x)); dg(x) = cg(hgroup("[1] Oscillator Tuning & Switching", x)); dsg(x) = dg(vgroup("[1] Switches", x)); gmmg(x) = cg(hgroup("[2] Glide and ModMix", x)); og(x) = mg(vgroup("[1] Oscillator Bank", x)); osc1(x) = og(hgroup("[1] Oscillator 1", x)); osc2(x) = og(hgroup("[2] Oscillator 2", x)); osc3(x) = og(hgroup("[3] Oscillator 3", x)); mixg(x) = mg(vgroup("[2] Mixer", x)); modg(x) = mg(vgroup("[3] Modifiers", x)); vcfg(x) = modg(vgroup("[0] Filter", x)); vcf1(x) = vcfg(hgroup("[0] [tooltip:freq, Q, ContourScale]", x)); vcf1cbg(x) = vcf1(vgroup("[0] [tooltip:two checkboxes]", x)); vcf2(x) = vcfg(hgroup("[1] Filter Contour [tooltip:AttFilt, DecFilt, Sustain Level for Filter Contour]", x)); ng(x) = modg(hgroup("[1] Loudness Contour", x)); echog(x) = fxg(hgroup("[4] Echo",x)); ekg(x) = echog(vgroup("[0] Knobs",x)); esg(x) = echog(vgroup("[1] Switches",x)); flg(x) = fxg(hgroup("[5] Flanger",x)); flkg(x) = flg(vgroup("[0] Knobs",x)); flsg(x) = flg(vgroup("[1] Switches",x)); chg(x) = fxg(hgroup("[6] Chorus",x)); ckg(x) = chg(vgroup("[0] Knobs",x)); csg(x) = chg(vgroup("[1] Switches",x)); rg(x) = fxg(hgroup("[7] Reverb",x)); rkg(x) = rg(vgroup("[0] Knobs",x)); rsg(x) = rg(vgroup("[1] Switches",x)); outg(x) = fxg(vgroup("[8] Output", x)); volg(x) = outg(hgroup("[0] Volume Main Output", x)); tunerg(x) = outg(hgroup("[1] A-440 Switch", x)); vdtpolyg(x) = outg(hgroup("[2] Voice Detune / Poly", x)); clipg(x) = fxg(vgroup("[9] Soft Clip", x)); ws(x) = kg(vgroup("[0] Wheels and Switches", x)); s1g(x) = ws(hgroup("[0] Jacks and Rockers", x)); jg(x) = s1g(vgroup("[0] MiniJacks",x)); s2g(x) = ws(hgroup("[1] [tooltip:Wheels+]", x)); bg(x) = s2g(vgroup("[0] [tooltip:Bend Enable and Range]", x)); wg(x) = s2g(hgroup("[1] [tooltip:Bend and Mod Wheels]", x)); keys(x) = kg(hgroup("[1] [tooltip:Keys]", x)); gg(x) = keys(hgroup("[0] [tooltip: Gates]",x));
6b91ab968efd21107022a58471bede9117c796a4779a9669e6b1ddd80131481b
moforte/sam-faust
flangerForBrowser.dsp
// Created from flange.dsp 2015/06/21 import("stdfaust.lib"); flanger_mono(dmax,curdel,depth,fb,invert,lfoshape) = _ <: _, (-:de.fdelay(dmax,curdel)) ~ *(fb) : _, *(select2(invert,depth,0-depth)) : + : *(1/(1+depth)); // ideal for dc and reinforced sinusoids (in-phase summed signals) process = ba.bypass1(fbp,flanger_mono_gui); // Kill the groups to save vertical space: meter_group(x) = flsg(x); ctl_group(x) = flkg(x); del_group(x) = flkg(x); lvl_group(x) = flkf(x); flangeview = lfo(freq); flanger_mono_gui = attach(flangeview) : flanger_mono(dmax,curdel,depth,fb,invert,lfoshape); sinlfo(freq) = (1 + os.oscrs(freq))/2; trilfo(freq) = 1.0-abs(os.saw1(freq)); lfo(f) = (lfoshape * trilfo(f)) + ((1-lfoshape) * sinlfo(f)); dmax = 2048; odflange = 44; // ~1 ms at 44.1 kHz = min delay dflange = ((dmax-1)-odflange)*del_group(vslider("[1] Delay [midi:ctrl 50][style:knob]", 0.22, 0, 1, 1)); freq = ctl_group(vslider("[1] Rate [midi:ctrl 2] [unit:Hz] [style:knob]", 0.5, 0, 10, 0.01)) : si.smooth(ba.tau2pole(freqT60/6.91)); freqT60 = 0.15661; depth = ctl_group(vslider("[3] Depth [midi:ctrl 3] [style:knob]", .75, 0, 1, 0.001)) : si.smooth(ba.tau2pole(depthT60/6.91)); depthT60 = 0.15661; fb = ctl_group(vslider("[5] Feedback [midi:ctrl 4] [style:knob]", 0, -0.995, 0.99, 0.001)) : si.smooth(ba.tau2pole(fbT60/6.91)); fbT60 = 0.15661; lfoshape = ctl_group(vslider("[7] Waveshape [midi:ctrl 54] [style:knob]", 0, 0, 1, 0.001)); curdel = odflange+dflange*lfo(freq); fbp = 1-int(flsg(vslider("[0] Enable [midi:ctrl 102][style:knob]",0,0,1,1))); invert = flsg(vslider("[1] Invert [midi:ctrl 49][style:knob]",0,0,1,1):int); // This layout loosely follows the MiniMoog-V // Arturia-only features are labeled // Original versions also added where different // Need vrocker and hrocker toggle switches in Faust! // Need orange and blue color choices // Orange => Connect modulation sources to their destinations // Blue => Turn audio sources On and Off // - and later - // White => Turn performance features On and Off // Black => Select between modulation sources // Julius Smith for Analog Devices 3/1/2017 vrocker(x) = checkbox("%%x [style:vrocker]"); hrocker(x) = checkbox("%%x [style:hrocker]"); vrockerblue(x) = checkbox("%x [style:vrocker] [color:blue]"); vrockerblue(x) = checkbox("%x [style:vrocker] [color:blue]"); // USAGE: vrockerorange("[0] ModulationEnable"); hrockerblue(x) = checkbox("%%x [style:hrocker] [color:blue]"); vrockerred(x) = checkbox("%%x [style:vrocker] [color:red]"); hrockerred(x) = checkbox("%%x [style:hrocker] [color:red]"); declare designer "Robert A. Moog"; mmg(x) = hgroup("",x); // Minimoog + Effects synthg(x) = mmg(vgroup("[0] Minimoog",x)); fxg(x) = mmg(hgroup("[1] Effects",x)); mg(x) = synthg(hgroup("[0]",x)); cg(x) = mg(vgroup("[0] Controllers",x)); // Formerly named "Modules" but "Minimoog" group-title is enough vg(x) = cg(hgroup("[0] Master Volume", x)); dg(x) = cg(hgroup("[1] Oscillator Tuning & Switching", x)); // Tune knob = master tune dsg(x) = dg(vgroup("[1] Switches", x)); // Oscillator Modulation HrockerRed => apply Modulation Mix output to osc1&2 pitches // [MOVED here from osc3 group] Osc 3 Control VrockerRed => use osc3 as LFO instead of osc3 gmmg(x) = cg(hgroup("[2] Glide and ModMix", x)); // Glide knob [0:10] = portamento speed // Modulation Mix knob [0:10] (between Osc3 and Noise) = mix of noise and osc3 modulating osc1&2 pitch and/or VCF freq og(x) = mg(vgroup("[1] Oscillator Bank", x)); osc1(x) = og(hgroup("[1] Oscillator 1", x)); // UNUSED Control switch (for alignment) - Could put Oscillator Modulation switch there // Range rotary switch: LO (slow pulses or rhythm), 32', 16', 8', 4', 2' // Frequency <something> switch: LED to right // Waveform rotary switch: tri, impulse/bent-triangle, saw, pulseWide, pulseMed, pulseNarrow osc2(x) = og(hgroup("[2] Oscillator 2", x)); // UNUSED (originall) or Osc 2 Control VrockerRed // Range rotary switch: LO, 32', 16', 8', 4', 2' // Detuning knob: -7 to 7 [NO SWITCH] // Waveform rotary switch: tri, impulse(?), saw, pulseWide, pulseMed, pulseNarrow osc3(x) = og(hgroup("[3] Oscillator 3", x)); // Osc 3 Control VrockerRed => use osc3 as LFO instead of osc3 // Range rotary switch: LO, 32', 16', 8', 4', 2' // Detuning knob: -7 to 7 [NO SWITCH] // Waveform rotary switch: tri, impulse(?), saw, pulseWide, pulseMed, pulseNarrow mixg(x) = mg(vgroup("[2] Mixer", x)); // Each row 5 slots to maintain alignment and include red rockers joining VCF area: mr1(x) = mixg(hgroup("[0] Osc1", x)); // mixer row 1 = // Osc1 Volume and Osc1 HrockerBlue & _ & _ & Filter Modulation HrockerRed // Filter Modulation => Modulation Mix output to VCF freq mr2(x) = mixg(hgroup("[1] Ext In, KeyCtl", x)); // row 2 = Ext In HrockerBlue and Vol and Overload LED and Keyboard Ctl HrockerRed 1 mr3(x) = mixg(hgroup("[2] Osc2", x)); // = Osc2 Volume and Osc2 HrockerBlue and Keyboard Ctl HrockerRed 2 // Keyboard Control Modulation 1&2 => 0, 1/3, 2/3, all of Keyboard Control Signal ("gate?") applied to VCF freq mr4(x) = mixg(hgroup("[3] Noise", x)); // = Noise HrockerBlue and Volume and Noise Type VrockerBlue mr4cbg(x) = mr4(vgroup("[1]", x)); // = Noise Off and White/Pink selection // two rockers mr5(x) = mixg(hgroup("[4] Osc3", x)); // Osc3 Volume and Osc3 HrockerBlue modg(x) = mg(vgroup("[3] Modifiers", x)); vcfg(x) = modg(vgroup("[0] Filter", x)); vcf1(x) = vcfg(hgroup("[0] [tooltip:freq, Q, ContourScale]", x)); vcf1cbg(x) = vcf1(vgroup("[0] [tooltip:two checkboxes]", x)); // Filter Modulation switch // VCF Off switch // Corner Frequency knob // Filter Emphasis knob // Amount of Contour knob vcf2(x) = vcfg(hgroup("[1] Filter Contour [tooltip:AttFilt, DecFilt, Sustain Level for Filter Contour]", x)); // Attack Time knob // Decay Time knob // Sustain Level knob ng(x) = modg(hgroup("[1] Loudness Contour", x)); // Attack Time knob // Decay Time knob // Sustain Level knob echog(x) = fxg(hgroup("[4] Echo",x)); ekg(x) = echog(vgroup("[0] Knobs",x)); esg(x) = echog(vgroup("[1] Switches",x)); flg(x) = fxg(hgroup("[5] Flanger",x)); flkg(x) = flg(vgroup("[0] Knobs",x)); flsg(x) = flg(vgroup("[1] Switches",x)); chg(x) = fxg(hgroup("[6] Chorus",x)); ckg(x) = chg(vgroup("[0] Knobs",x)); csg(x) = chg(vgroup("[1] Switches",x)); rg(x) = fxg(hgroup("[7] Reverb",x)); rkg(x) = rg(vgroup("[0] Knobs",x)); rsg(x) = rg(vgroup("[1] Switches",x)); outg(x) = fxg(vgroup("[8] Output", x)); volg(x) = outg(hgroup("[0] Volume Main Output", x)); // Volume knob [0-10] // Unison switch (Arturia) or Output connect/disconnect switch (original) // When set, all voices are stacked and instrument is in mono mode tunerg(x) = outg(hgroup("[1] A-440 Switch", x)); vdtpolyg(x) = outg(hgroup("[2] Voice Detune / Poly", x)); // Voice Detune knob [0-10] (Arturia) or // Polyphonic switch [red LED below] (Arturia) // When set, instrument is in polyphonic mode with one oscillator per key clipg(x) = fxg(vgroup("[9] Soft Clip", x)); // Soft Clipping switch [red LED above] kg(x) = synthg(hgroup("[1] Keyboard Group", x)); // Keyboard was 3 1/2 octaves ws(x) = kg(vgroup("[0] Wheels and Switches", x)); s1g(x) = ws(hgroup("[0] Jacks and Rockers", x)); jg(x) = s1g(vgroup("[0] MiniJacks",x)); gdlg(x) = s1g(vgroup("[1] Glide/Decay/Legato Enables",x)); // Arturia // Glide Hrocker (see original Button version below) // Decay Hrocker (see original Button version below) => Sets Release (R) of ADSR to either 0 or Decay (R) // Legato Hrocker (not in original) s2g(x) = ws(hgroup("[1] [tooltip:Wheels+]", x)); bg(x) = s2g(vgroup("[0] [tooltip:Bend Enable and Range]", x)); wg(x) = s2g(hgroup("[1] [tooltip:Bend and Mod Wheels]", x)); // Using Glide/Decay/Legato enables above following Arturia: // dg(x) = s2g(hgroup("[2] Glide and Decay momentary pushbuttons", x)); // Glide Button injects portamento as set by Glide knob // Decay Button uses decay of Loudness Contour (else 0) keys(x) = kg(hgroup("[1] [tooltip:Keys]", x)); gg(x) = keys(hgroup("[0] [tooltip: Gates]",x)); // leave slot 1 open for sustain (below)
https://raw.githubusercontent.com/moforte/sam-faust/85be03f262e384c1befa9eaac237e052040b2cc1/faust-examples/flanger/flangerForBrowser.dsp
faust
Created from flange.dsp 2015/06/21 ideal for dc and reinforced sinusoids (in-phase summed signals) Kill the groups to save vertical space: ~1 ms at 44.1 kHz = min delay This layout loosely follows the MiniMoog-V Arturia-only features are labeled Original versions also added where different Need vrocker and hrocker toggle switches in Faust! Need orange and blue color choices Orange => Connect modulation sources to their destinations Blue => Turn audio sources On and Off - and later - White => Turn performance features On and Off Black => Select between modulation sources Julius Smith for Analog Devices 3/1/2017 USAGE: vrockerorange("[0] ModulationEnable"); Minimoog + Effects Formerly named "Modules" but "Minimoog" group-title is enough Tune knob = master tune Oscillator Modulation HrockerRed => apply Modulation Mix output to osc1&2 pitches [MOVED here from osc3 group] Osc 3 Control VrockerRed => use osc3 as LFO instead of osc3 Glide knob [0:10] = portamento speed Modulation Mix knob [0:10] (between Osc3 and Noise) = mix of noise and osc3 modulating osc1&2 pitch and/or VCF freq UNUSED Control switch (for alignment) - Could put Oscillator Modulation switch there Range rotary switch: LO (slow pulses or rhythm), 32', 16', 8', 4', 2' Frequency <something> switch: LED to right Waveform rotary switch: tri, impulse/bent-triangle, saw, pulseWide, pulseMed, pulseNarrow UNUSED (originall) or Osc 2 Control VrockerRed Range rotary switch: LO, 32', 16', 8', 4', 2' Detuning knob: -7 to 7 [NO SWITCH] Waveform rotary switch: tri, impulse(?), saw, pulseWide, pulseMed, pulseNarrow Osc 3 Control VrockerRed => use osc3 as LFO instead of osc3 Range rotary switch: LO, 32', 16', 8', 4', 2' Detuning knob: -7 to 7 [NO SWITCH] Waveform rotary switch: tri, impulse(?), saw, pulseWide, pulseMed, pulseNarrow Each row 5 slots to maintain alignment and include red rockers joining VCF area: mixer row 1 = Osc1 Volume and Osc1 HrockerBlue & _ & _ & Filter Modulation HrockerRed Filter Modulation => Modulation Mix output to VCF freq row 2 = Ext In HrockerBlue and Vol and Overload LED and Keyboard Ctl HrockerRed 1 = Osc2 Volume and Osc2 HrockerBlue and Keyboard Ctl HrockerRed 2 Keyboard Control Modulation 1&2 => 0, 1/3, 2/3, all of Keyboard Control Signal ("gate?") applied to VCF freq = Noise HrockerBlue and Volume and Noise Type VrockerBlue = Noise Off and White/Pink selection two rockers Osc3 Volume and Osc3 HrockerBlue Filter Modulation switch VCF Off switch Corner Frequency knob Filter Emphasis knob Amount of Contour knob Attack Time knob Decay Time knob Sustain Level knob Attack Time knob Decay Time knob Sustain Level knob Volume knob [0-10] Unison switch (Arturia) or Output connect/disconnect switch (original) When set, all voices are stacked and instrument is in mono mode Voice Detune knob [0-10] (Arturia) or Polyphonic switch [red LED below] (Arturia) When set, instrument is in polyphonic mode with one oscillator per key Soft Clipping switch [red LED above] Keyboard was 3 1/2 octaves Arturia Glide Hrocker (see original Button version below) Decay Hrocker (see original Button version below) => Sets Release (R) of ADSR to either 0 or Decay (R) Legato Hrocker (not in original) Using Glide/Decay/Legato enables above following Arturia: dg(x) = s2g(hgroup("[2] Glide and Decay momentary pushbuttons", x)); Glide Button injects portamento as set by Glide knob Decay Button uses decay of Loudness Contour (else 0) leave slot 1 open for sustain (below)
import("stdfaust.lib"); flanger_mono(dmax,curdel,depth,fb,invert,lfoshape) = _ <: _, (-:de.fdelay(dmax,curdel)) ~ *(fb) : _, *(select2(invert,depth,0-depth)) process = ba.bypass1(fbp,flanger_mono_gui); meter_group(x) = flsg(x); ctl_group(x) = flkg(x); del_group(x) = flkg(x); lvl_group(x) = flkf(x); flangeview = lfo(freq); flanger_mono_gui = attach(flangeview) : flanger_mono(dmax,curdel,depth,fb,invert,lfoshape); sinlfo(freq) = (1 + os.oscrs(freq))/2; trilfo(freq) = 1.0-abs(os.saw1(freq)); lfo(f) = (lfoshape * trilfo(f)) + ((1-lfoshape) * sinlfo(f)); dmax = 2048; dflange = ((dmax-1)-odflange)*del_group(vslider("[1] Delay [midi:ctrl 50][style:knob]", 0.22, 0, 1, 1)); freq = ctl_group(vslider("[1] Rate [midi:ctrl 2] [unit:Hz] [style:knob]", 0.5, 0, 10, 0.01)) : si.smooth(ba.tau2pole(freqT60/6.91)); freqT60 = 0.15661; depth = ctl_group(vslider("[3] Depth [midi:ctrl 3] [style:knob]", .75, 0, 1, 0.001)) : si.smooth(ba.tau2pole(depthT60/6.91)); depthT60 = 0.15661; fb = ctl_group(vslider("[5] Feedback [midi:ctrl 4] [style:knob]", 0, -0.995, 0.99, 0.001)) : si.smooth(ba.tau2pole(fbT60/6.91)); fbT60 = 0.15661; lfoshape = ctl_group(vslider("[7] Waveshape [midi:ctrl 54] [style:knob]", 0, 0, 1, 0.001)); curdel = odflange+dflange*lfo(freq); fbp = 1-int(flsg(vslider("[0] Enable [midi:ctrl 102][style:knob]",0,0,1,1))); invert = flsg(vslider("[1] Invert [midi:ctrl 49][style:knob]",0,0,1,1):int); vrocker(x) = checkbox("%%x [style:vrocker]"); hrocker(x) = checkbox("%%x [style:hrocker]"); vrockerblue(x) = checkbox("%x [style:vrocker] [color:blue]"); vrockerblue(x) = checkbox("%x [style:vrocker] [color:blue]"); hrockerblue(x) = checkbox("%%x [style:hrocker] [color:blue]"); vrockerred(x) = checkbox("%%x [style:vrocker] [color:red]"); hrockerred(x) = checkbox("%%x [style:hrocker] [color:red]"); declare designer "Robert A. Moog"; synthg(x) = mmg(vgroup("[0] Minimoog",x)); fxg(x) = mmg(hgroup("[1] Effects",x)); mg(x) = synthg(hgroup("[0]",x)); vg(x) = cg(hgroup("[0] Master Volume", x)); dg(x) = cg(hgroup("[1] Oscillator Tuning & Switching", x)); dsg(x) = dg(vgroup("[1] Switches", x)); gmmg(x) = cg(hgroup("[2] Glide and ModMix", x)); og(x) = mg(vgroup("[1] Oscillator Bank", x)); osc1(x) = og(hgroup("[1] Oscillator 1", x)); osc2(x) = og(hgroup("[2] Oscillator 2", x)); osc3(x) = og(hgroup("[3] Oscillator 3", x)); mixg(x) = mg(vgroup("[2] Mixer", x)); modg(x) = mg(vgroup("[3] Modifiers", x)); vcfg(x) = modg(vgroup("[0] Filter", x)); vcf1(x) = vcfg(hgroup("[0] [tooltip:freq, Q, ContourScale]", x)); vcf1cbg(x) = vcf1(vgroup("[0] [tooltip:two checkboxes]", x)); vcf2(x) = vcfg(hgroup("[1] Filter Contour [tooltip:AttFilt, DecFilt, Sustain Level for Filter Contour]", x)); ng(x) = modg(hgroup("[1] Loudness Contour", x)); echog(x) = fxg(hgroup("[4] Echo",x)); ekg(x) = echog(vgroup("[0] Knobs",x)); esg(x) = echog(vgroup("[1] Switches",x)); flg(x) = fxg(hgroup("[5] Flanger",x)); flkg(x) = flg(vgroup("[0] Knobs",x)); flsg(x) = flg(vgroup("[1] Switches",x)); chg(x) = fxg(hgroup("[6] Chorus",x)); ckg(x) = chg(vgroup("[0] Knobs",x)); csg(x) = chg(vgroup("[1] Switches",x)); rg(x) = fxg(hgroup("[7] Reverb",x)); rkg(x) = rg(vgroup("[0] Knobs",x)); rsg(x) = rg(vgroup("[1] Switches",x)); outg(x) = fxg(vgroup("[8] Output", x)); volg(x) = outg(hgroup("[0] Volume Main Output", x)); tunerg(x) = outg(hgroup("[1] A-440 Switch", x)); vdtpolyg(x) = outg(hgroup("[2] Voice Detune / Poly", x)); clipg(x) = fxg(vgroup("[9] Soft Clip", x)); ws(x) = kg(vgroup("[0] Wheels and Switches", x)); s1g(x) = ws(hgroup("[0] Jacks and Rockers", x)); jg(x) = s1g(vgroup("[0] MiniJacks",x)); s2g(x) = ws(hgroup("[1] [tooltip:Wheels+]", x)); bg(x) = s2g(vgroup("[0] [tooltip:Bend Enable and Range]", x)); wg(x) = s2g(hgroup("[1] [tooltip:Bend and Mod Wheels]", x)); keys(x) = kg(hgroup("[1] [tooltip:Keys]", x)); gg(x) = keys(hgroup("[0] [tooltip: Gates]",x));
74a45f99a95804be1a979fabe5123c419982cad093c6185ffd2254d7e3e5e8e7
moforte/sam-faust
chorusForBrowser.dsp
import("stdfaust.lib"); voices = 8; // MUST BE EVEN process = bypass1to2(cbp,chorus_mono(dmax,curdel,rate,sigma,do2,voices)); // to become ba.bypass1to2 in Faust's basics.lib: bypass1to2(bpc,e) = _ <: ((inswitch:e),_,_) : ba.select2stereo(bpc) with {inswitch = select2(bpc,_,0);}; ml = library("music.lib"); // /l/fdlo/music.lib fl = library("filter.lib"); el = library("effect.lib"); // /l/fdlo/effect.lib ol = library("oscillator.lib"); // /l/fdlo/oscillator.lib pi = 4.0*atan(1.0); dmax = 8192; curdel = dmax * ckg(vslider("[0] Delay [midi:ctrl 4] [style:knob]", 0.5, 0, 1, 1)) : fl.smooth(0.999); rateMax = 7.0; // Hz rateMin = 0.01; rateT60 = 0.15661; rate = ckg(vslider("[1] Rate [midi:ctrl 2] [unit:Hz] [style:knob]", 0.5, rateMin, rateMax, 0.0001)) : fl.smooth(fl.tau2pole(rateT60/6.91)); depth = ckg(vslider("[4] Depth [midi:ctrl 3] [style:knob]", 0.5, 0, 1, 0.001)) : fl.smooth(fl.tau2pole(depthT60/6.91)); depthT60 = 0.15661; delayPerVoice = 0.5*curdel/voices; sigma = delayPerVoice * ckg(vslider("[6] Deviation [midi:ctrl 58] [style:knob]",0.5,0,1,0.001)) : fl.smooth(0.999); periodic = 1; do2 = depth; // use when depth=1 means "multivibrato" effect (no original => all are modulated) cbp = 1-int(csg(vslider("[0] Enable [midi:ctrl 102][style:knob]",0,0,1,1))); chorus_mono(dmax,curdel,rate,sigma,do2,voices) = _ <: (*(1-do2)<:_,_),(*(do2) <: par(i,voices,voice(i)) :> _,_) : ml.interleave(2,2) : +,+ with { angle(i) = 2*pi*(i/2)/voices + (i%2)*pi/2; voice(i) = ml.fdelay(dmax,min(dmax,del(i))) * cos(angle(i)); del(i) = curdel*(i+1)/voices + dev(i); rates(i) = rate/float(i+1); dev(i) = sigma * oscp(rates(i),i*2*pi/voices); }; chorus_stereo(dmax,curdel,rate,sigma,do2,voices) = _,_ <: *(1-do2),*(1-do2),(*(do2),*(do2) <: par(i,voices,voice(i)):>_,_) : ml.interleave(2,2) : +,+; voice(i) = ml.fdelay(dmax,min(dmax,del(i)))/(i+1) with { angle(i) = 2*pi*(i/2)/voices + (i%2)*pi/2; voice(i) = ml.fdelay(dmax,min(dmax,del(i))) * cos(angle(i)); del(i) = curdel*(i+1)/voices + dev(i); rates(i) = rate/float(i+1); dev(i) = sigma * oscp(rates(i),i*2*pi/voices); }; oscs(freq) = rdtable(tablesize, sinwaveform, int(ml.phase(freq)) ); oscc(freq) = rdtable(tablesize, coswaveform, int(ml.phase(freq)) ); oscp(freq,p) = oscs(freq) * cos(p) + oscc(freq) * sin(p); // osc = oscs; // music.lib sinwaveform = float(ml.time)*(2.0*pi)/float(tablesize) : sin; coswaveform = float(ml.time)*(2.0*pi)/float(tablesize) : cos; tablesize = 1 << 16; // This layout loosely follows the MiniMoog-V // Arturia-only features are labeled // Original versions also added where different // Need vrocker and hrocker toggle switches in Faust! // Need orange and blue color choices // Orange => Connect modulation sources to their destinations // Blue => Turn audio sources On and Off // - and later - // White => Turn performance features On and Off // Black => Select between modulation sources // Julius Smith for Analog Devices 3/1/2017 vrocker(x) = checkbox("%%x [style:vrocker]"); hrocker(x) = checkbox("%%x [style:hrocker]"); vrockerblue(x) = checkbox("%x [style:vrocker] [color:blue]"); vrockerblue(x) = checkbox("%x [style:vrocker] [color:blue]"); // USAGE: vrockerorange("[0] ModulationEnable"); hrockerblue(x) = checkbox("%%x [style:hrocker] [color:blue]"); vrockerred(x) = checkbox("%%x [style:vrocker] [color:red]"); hrockerred(x) = checkbox("%%x [style:hrocker] [color:red]"); declare designer "Robert A. Moog"; mmg(x) = hgroup("",x); // Minimoog + Effects synthg(x) = mmg(vgroup("[0] Minimoog",x)); fxg(x) = mmg(hgroup("[1] Effects",x)); mg(x) = synthg(hgroup("[0]",x)); cg(x) = mg(vgroup("[0] Controllers",x)); // Formerly named "Modules" but "Minimoog" group-title is enough vg(x) = cg(hgroup("[0] Master Volume", x)); dg(x) = cg(hgroup("[1] Oscillator Tuning & Switching", x)); // Tune knob = master tune dsg(x) = dg(vgroup("[1] Switches", x)); // Oscillator Modulation HrockerRed => apply Modulation Mix output to osc1&2 pitches // [MOVED here from osc3 group] Osc 3 Control VrockerRed => use osc3 as LFO instead of osc3 gmmg(x) = cg(hgroup("[2] Glide and ModMix", x)); // Glide knob [0:10] = portamento speed // Modulation Mix knob [0:10] (between Osc3 and Noise) = mix of noise and osc3 modulating osc1&2 pitch and/or VCF freq og(x) = mg(vgroup("[1] Oscillator Bank", x)); osc1(x) = og(hgroup("[1] Oscillator 1", x)); // UNUSED Control switch (for alignment) - Could put Oscillator Modulation switch there // Range rotary switch: LO (slow pulses or rhythm), 32', 16', 8', 4', 2' // Frequency <something> switch: LED to right // Waveform rotary switch: tri, impulse/bent-triangle, saw, pulseWide, pulseMed, pulseNarrow osc2(x) = og(hgroup("[2] Oscillator 2", x)); // UNUSED (originall) or Osc 2 Control VrockerRed // Range rotary switch: LO, 32', 16', 8', 4', 2' // Detuning knob: -7 to 7 [NO SWITCH] // Waveform rotary switch: tri, impulse(?), saw, pulseWide, pulseMed, pulseNarrow osc3(x) = og(hgroup("[3] Oscillator 3", x)); // Osc 3 Control VrockerRed => use osc3 as LFO instead of osc3 // Range rotary switch: LO, 32', 16', 8', 4', 2' // Detuning knob: -7 to 7 [NO SWITCH] // Waveform rotary switch: tri, impulse(?), saw, pulseWide, pulseMed, pulseNarrow mixg(x) = mg(vgroup("[2] Mixer", x)); // Each row 5 slots to maintain alignment and include red rockers joining VCF area: mr1(x) = mixg(hgroup("[0] Osc1", x)); // mixer row 1 = // Osc1 Volume and Osc1 HrockerBlue & _ & _ & Filter Modulation HrockerRed // Filter Modulation => Modulation Mix output to VCF freq mr2(x) = mixg(hgroup("[1] Ext In, KeyCtl", x)); // row 2 = Ext In HrockerBlue and Vol and Overload LED and Keyboard Ctl HrockerRed 1 mr3(x) = mixg(hgroup("[2] Osc2", x)); // = Osc2 Volume and Osc2 HrockerBlue and Keyboard Ctl HrockerRed 2 // Keyboard Control Modulation 1&2 => 0, 1/3, 2/3, all of Keyboard Control Signal ("gate?") applied to VCF freq mr4(x) = mixg(hgroup("[3] Noise", x)); // = Noise HrockerBlue and Volume and Noise Type VrockerBlue mr4cbg(x) = mr4(vgroup("[1]", x)); // = Noise Off and White/Pink selection // two rockers mr5(x) = mixg(hgroup("[4] Osc3", x)); // Osc3 Volume and Osc3 HrockerBlue modg(x) = mg(vgroup("[3] Modifiers", x)); vcfg(x) = modg(vgroup("[0] Filter", x)); vcf1(x) = vcfg(hgroup("[0] [tooltip:freq, Q, ContourScale]", x)); vcf1cbg(x) = vcf1(vgroup("[0] [tooltip:two checkboxes]", x)); // Filter Modulation switch // VCF Off switch // Corner Frequency knob // Filter Emphasis knob // Amount of Contour knob vcf2(x) = vcfg(hgroup("[1] Filter Contour [tooltip:AttFilt, DecFilt, Sustain Level for Filter Contour]", x)); // Attack Time knob // Decay Time knob // Sustain Level knob ng(x) = modg(hgroup("[1] Loudness Contour", x)); // Attack Time knob // Decay Time knob // Sustain Level knob echog(x) = fxg(hgroup("[4] Echo",x)); ekg(x) = echog(vgroup("[0] Knobs",x)); esg(x) = echog(vgroup("[1] Switches",x)); flg(x) = fxg(hgroup("[5] Flanger",x)); flkg(x) = flg(vgroup("[0] Knobs",x)); flsg(x) = flg(vgroup("[1] Switches",x)); chg(x) = fxg(hgroup("[6] Chorus",x)); ckg(x) = chg(vgroup("[0] Knobs",x)); csg(x) = chg(vgroup("[1] Switches",x)); rg(x) = fxg(hgroup("[7] Reverb",x)); rkg(x) = rg(vgroup("[0] Knobs",x)); rsg(x) = rg(vgroup("[1] Switches",x)); outg(x) = fxg(vgroup("[8] Output", x)); volg(x) = outg(hgroup("[0] Volume Main Output", x)); // Volume knob [0-10] // Unison switch (Arturia) or Output connect/disconnect switch (original) // When set, all voices are stacked and instrument is in mono mode tunerg(x) = outg(hgroup("[1] A-440 Switch", x)); vdtpolyg(x) = outg(hgroup("[2] Voice Detune / Poly", x)); // Voice Detune knob [0-10] (Arturia) or // Polyphonic switch [red LED below] (Arturia) // When set, instrument is in polyphonic mode with one oscillator per key clipg(x) = fxg(vgroup("[9] Soft Clip", x)); // Soft Clipping switch [red LED above] kg(x) = synthg(hgroup("[1] Keyboard Group", x)); // Keyboard was 3 1/2 octaves ws(x) = kg(vgroup("[0] Wheels and Switches", x)); s1g(x) = ws(hgroup("[0] Jacks and Rockers", x)); jg(x) = s1g(vgroup("[0] MiniJacks",x)); gdlg(x) = s1g(vgroup("[1] Glide/Decay/Legato Enables",x)); // Arturia // Glide Hrocker (see original Button version below) // Decay Hrocker (see original Button version below) => Sets Release (R) of ADSR to either 0 or Decay (R) // Legato Hrocker (not in original) s2g(x) = ws(hgroup("[1] [tooltip:Wheels+]", x)); bg(x) = s2g(vgroup("[0] [tooltip:Bend Enable and Range]", x)); wg(x) = s2g(hgroup("[1] [tooltip:Bend and Mod Wheels]", x)); // Using Glide/Decay/Legato enables above following Arturia: // dg(x) = s2g(hgroup("[2] Glide and Decay momentary pushbuttons", x)); // Glide Button injects portamento as set by Glide knob // Decay Button uses decay of Loudness Contour (else 0) keys(x) = kg(hgroup("[1] [tooltip:Keys]", x)); gg(x) = keys(hgroup("[0] [tooltip: Gates]",x)); // leave slot 1 open for sustain (below)
https://raw.githubusercontent.com/moforte/sam-faust/85be03f262e384c1befa9eaac237e052040b2cc1/faust-examples/chorus/chorusForBrowser.dsp
faust
MUST BE EVEN to become ba.bypass1to2 in Faust's basics.lib: /l/fdlo/music.lib /l/fdlo/effect.lib /l/fdlo/oscillator.lib Hz use when depth=1 means "multivibrato" effect (no original => all are modulated) osc = oscs; // music.lib This layout loosely follows the MiniMoog-V Arturia-only features are labeled Original versions also added where different Need vrocker and hrocker toggle switches in Faust! Need orange and blue color choices Orange => Connect modulation sources to their destinations Blue => Turn audio sources On and Off - and later - White => Turn performance features On and Off Black => Select between modulation sources Julius Smith for Analog Devices 3/1/2017 USAGE: vrockerorange("[0] ModulationEnable"); Minimoog + Effects Formerly named "Modules" but "Minimoog" group-title is enough Tune knob = master tune Oscillator Modulation HrockerRed => apply Modulation Mix output to osc1&2 pitches [MOVED here from osc3 group] Osc 3 Control VrockerRed => use osc3 as LFO instead of osc3 Glide knob [0:10] = portamento speed Modulation Mix knob [0:10] (between Osc3 and Noise) = mix of noise and osc3 modulating osc1&2 pitch and/or VCF freq UNUSED Control switch (for alignment) - Could put Oscillator Modulation switch there Range rotary switch: LO (slow pulses or rhythm), 32', 16', 8', 4', 2' Frequency <something> switch: LED to right Waveform rotary switch: tri, impulse/bent-triangle, saw, pulseWide, pulseMed, pulseNarrow UNUSED (originall) or Osc 2 Control VrockerRed Range rotary switch: LO, 32', 16', 8', 4', 2' Detuning knob: -7 to 7 [NO SWITCH] Waveform rotary switch: tri, impulse(?), saw, pulseWide, pulseMed, pulseNarrow Osc 3 Control VrockerRed => use osc3 as LFO instead of osc3 Range rotary switch: LO, 32', 16', 8', 4', 2' Detuning knob: -7 to 7 [NO SWITCH] Waveform rotary switch: tri, impulse(?), saw, pulseWide, pulseMed, pulseNarrow Each row 5 slots to maintain alignment and include red rockers joining VCF area: mixer row 1 = Osc1 Volume and Osc1 HrockerBlue & _ & _ & Filter Modulation HrockerRed Filter Modulation => Modulation Mix output to VCF freq row 2 = Ext In HrockerBlue and Vol and Overload LED and Keyboard Ctl HrockerRed 1 = Osc2 Volume and Osc2 HrockerBlue and Keyboard Ctl HrockerRed 2 Keyboard Control Modulation 1&2 => 0, 1/3, 2/3, all of Keyboard Control Signal ("gate?") applied to VCF freq = Noise HrockerBlue and Volume and Noise Type VrockerBlue = Noise Off and White/Pink selection two rockers Osc3 Volume and Osc3 HrockerBlue Filter Modulation switch VCF Off switch Corner Frequency knob Filter Emphasis knob Amount of Contour knob Attack Time knob Decay Time knob Sustain Level knob Attack Time knob Decay Time knob Sustain Level knob Volume knob [0-10] Unison switch (Arturia) or Output connect/disconnect switch (original) When set, all voices are stacked and instrument is in mono mode Voice Detune knob [0-10] (Arturia) or Polyphonic switch [red LED below] (Arturia) When set, instrument is in polyphonic mode with one oscillator per key Soft Clipping switch [red LED above] Keyboard was 3 1/2 octaves Arturia Glide Hrocker (see original Button version below) Decay Hrocker (see original Button version below) => Sets Release (R) of ADSR to either 0 or Decay (R) Legato Hrocker (not in original) Using Glide/Decay/Legato enables above following Arturia: dg(x) = s2g(hgroup("[2] Glide and Decay momentary pushbuttons", x)); Glide Button injects portamento as set by Glide knob Decay Button uses decay of Loudness Contour (else 0) leave slot 1 open for sustain (below)
import("stdfaust.lib"); process = bypass1to2(cbp,chorus_mono(dmax,curdel,rate,sigma,do2,voices)); bypass1to2(bpc,e) = _ <: ((inswitch:e),_,_) : ba.select2stereo(bpc) with {inswitch = select2(bpc,_,0);}; fl = library("filter.lib"); pi = 4.0*atan(1.0); dmax = 8192; curdel = dmax * ckg(vslider("[0] Delay [midi:ctrl 4] [style:knob]", 0.5, 0, 1, 1)) : fl.smooth(0.999); rateMin = 0.01; rateT60 = 0.15661; rate = ckg(vslider("[1] Rate [midi:ctrl 2] [unit:Hz] [style:knob]", 0.5, rateMin, rateMax, 0.0001)) : fl.smooth(fl.tau2pole(rateT60/6.91)); depth = ckg(vslider("[4] Depth [midi:ctrl 3] [style:knob]", 0.5, 0, 1, 0.001)) : fl.smooth(fl.tau2pole(depthT60/6.91)); depthT60 = 0.15661; delayPerVoice = 0.5*curdel/voices; sigma = delayPerVoice * ckg(vslider("[6] Deviation [midi:ctrl 58] [style:knob]",0.5,0,1,0.001)) : fl.smooth(0.999); periodic = 1; cbp = 1-int(csg(vslider("[0] Enable [midi:ctrl 102][style:knob]",0,0,1,1))); chorus_mono(dmax,curdel,rate,sigma,do2,voices) = _ <: (*(1-do2)<:_,_),(*(do2) <: par(i,voices,voice(i)) :> _,_) : ml.interleave(2,2) : +,+ with { angle(i) = 2*pi*(i/2)/voices + (i%2)*pi/2; voice(i) = ml.fdelay(dmax,min(dmax,del(i))) * cos(angle(i)); del(i) = curdel*(i+1)/voices + dev(i); rates(i) = rate/float(i+1); dev(i) = sigma * oscp(rates(i),i*2*pi/voices); }; chorus_stereo(dmax,curdel,rate,sigma,do2,voices) = _,_ <: *(1-do2),*(1-do2),(*(do2),*(do2) <: par(i,voices,voice(i)):>_,_) : ml.interleave(2,2) : +,+; voice(i) = ml.fdelay(dmax,min(dmax,del(i)))/(i+1) with { angle(i) = 2*pi*(i/2)/voices + (i%2)*pi/2; voice(i) = ml.fdelay(dmax,min(dmax,del(i))) * cos(angle(i)); del(i) = curdel*(i+1)/voices + dev(i); rates(i) = rate/float(i+1); dev(i) = sigma * oscp(rates(i),i*2*pi/voices); }; oscs(freq) = rdtable(tablesize, sinwaveform, int(ml.phase(freq)) ); oscc(freq) = rdtable(tablesize, coswaveform, int(ml.phase(freq)) ); oscp(freq,p) = oscs(freq) * cos(p) + oscc(freq) * sin(p); sinwaveform = float(ml.time)*(2.0*pi)/float(tablesize) : sin; coswaveform = float(ml.time)*(2.0*pi)/float(tablesize) : cos; tablesize = 1 << 16; vrocker(x) = checkbox("%%x [style:vrocker]"); hrocker(x) = checkbox("%%x [style:hrocker]"); vrockerblue(x) = checkbox("%x [style:vrocker] [color:blue]"); vrockerblue(x) = checkbox("%x [style:vrocker] [color:blue]"); hrockerblue(x) = checkbox("%%x [style:hrocker] [color:blue]"); vrockerred(x) = checkbox("%%x [style:vrocker] [color:red]"); hrockerred(x) = checkbox("%%x [style:hrocker] [color:red]"); declare designer "Robert A. Moog"; synthg(x) = mmg(vgroup("[0] Minimoog",x)); fxg(x) = mmg(hgroup("[1] Effects",x)); mg(x) = synthg(hgroup("[0]",x)); vg(x) = cg(hgroup("[0] Master Volume", x)); dg(x) = cg(hgroup("[1] Oscillator Tuning & Switching", x)); dsg(x) = dg(vgroup("[1] Switches", x)); gmmg(x) = cg(hgroup("[2] Glide and ModMix", x)); og(x) = mg(vgroup("[1] Oscillator Bank", x)); osc1(x) = og(hgroup("[1] Oscillator 1", x)); osc2(x) = og(hgroup("[2] Oscillator 2", x)); osc3(x) = og(hgroup("[3] Oscillator 3", x)); mixg(x) = mg(vgroup("[2] Mixer", x)); modg(x) = mg(vgroup("[3] Modifiers", x)); vcfg(x) = modg(vgroup("[0] Filter", x)); vcf1(x) = vcfg(hgroup("[0] [tooltip:freq, Q, ContourScale]", x)); vcf1cbg(x) = vcf1(vgroup("[0] [tooltip:two checkboxes]", x)); vcf2(x) = vcfg(hgroup("[1] Filter Contour [tooltip:AttFilt, DecFilt, Sustain Level for Filter Contour]", x)); ng(x) = modg(hgroup("[1] Loudness Contour", x)); echog(x) = fxg(hgroup("[4] Echo",x)); ekg(x) = echog(vgroup("[0] Knobs",x)); esg(x) = echog(vgroup("[1] Switches",x)); flg(x) = fxg(hgroup("[5] Flanger",x)); flkg(x) = flg(vgroup("[0] Knobs",x)); flsg(x) = flg(vgroup("[1] Switches",x)); chg(x) = fxg(hgroup("[6] Chorus",x)); ckg(x) = chg(vgroup("[0] Knobs",x)); csg(x) = chg(vgroup("[1] Switches",x)); rg(x) = fxg(hgroup("[7] Reverb",x)); rkg(x) = rg(vgroup("[0] Knobs",x)); rsg(x) = rg(vgroup("[1] Switches",x)); outg(x) = fxg(vgroup("[8] Output", x)); volg(x) = outg(hgroup("[0] Volume Main Output", x)); tunerg(x) = outg(hgroup("[1] A-440 Switch", x)); vdtpolyg(x) = outg(hgroup("[2] Voice Detune / Poly", x)); clipg(x) = fxg(vgroup("[9] Soft Clip", x)); ws(x) = kg(vgroup("[0] Wheels and Switches", x)); s1g(x) = ws(hgroup("[0] Jacks and Rockers", x)); jg(x) = s1g(vgroup("[0] MiniJacks",x)); s2g(x) = ws(hgroup("[1] [tooltip:Wheels+]", x)); bg(x) = s2g(vgroup("[0] [tooltip:Bend Enable and Range]", x)); wg(x) = s2g(hgroup("[1] [tooltip:Bend and Mod Wheels]", x)); keys(x) = kg(hgroup("[1] [tooltip:Keys]", x)); gg(x) = keys(hgroup("[0] [tooltip: Gates]",x));
e87621e61f1134da16250112f9619daa1c53fec1c13631b90f247b78a15a3c90
moforte/sam-faust
echoForBrowser.dsp
// imported by echo.dsp and echomt.dsp import("stdfaust.lib"); echo_group(x) = x; // Let layout2.dsp lay us out knobs_group(x) = ekg(x); switches_group(x) = esg(x); dmax = 32768; // one and done dmaxs = float(dmax)/44100.0; Nnines = 1.8; // Increase until you get the desired maximum amount of smoothing when fbs==1 //fastpow2 = ffunction(float fastpow2(float), "fast_pow2.h", ""); fbspr(fbs) = 1.0 - pow(2.0, (-3.33219*Nnines*fbs)); // pole radius of feedback smoother inputSelect(gi) = _,0 : select2(gi); echo_mono(dmax,curdel,tapdel,fb,fbspr,gi) = inputSelect(gi) : (+:si.smooth(fbspr) <: de.fdelay(dmax,curdel), de.fdelay(dmax,tapdel)) ~(*(fb),!) : !,_; tau2pole(tau) = ba.if(tau>0, exp(-1.0/(tau*ma.SR)), 0.0); t60smoother(dEchoT60) = si.smooth(tau2pole(dEchoT60/6.91)); dEchoT60 = knobs_group(vslider("[1] DelayT60 [midi:ctrl 60] [style:knob]", 0.5, 0, 100, 0.001)); dEchoSamplesRaw = knobs_group(vslider("[0] Delay [midi:ctrl 4] [style:knob]", 0.5, 0.001, (dmaxs-0.001), 0.001)) * ma.SR; dEchoSamples = dEchoSamplesRaw : t60smoother(dEchoT60); warpRaw = knobs_group(vslider("[0] Warp [midi:ctrl 62] [style:knob]", 0, -1.0, 1.0, 0.001)); scrubAmpRaw = 0; scrubPhaseRaw = 0; fb = knobs_group(vslider("[2] Feedback [midi:ctrl 3] [style:knob]", .3, 0.0, 1.0, 0.0001)); amp = knobs_group(vslider("[3] Amp [midi:ctrl 2] [style:knob]", .5, 0, 1, 0.001)) : si.smooth(ba.tau2pole(ampT60/6.91)); ampT60 = 0.15661; fbs = knobs_group(vslider("[5] [midi:ctrl 76] FeedbackSm [style:knob]", 0, 0, 1, 0.00001)); gi = switches_group(1-vslider("[7] [midi:ctrl 102] EnableEcho[style:knob]",0,0,1,1)); // "ground input" switches input to zeros // Warp and Scrubber stuff: enableEcho = (scrubAmpRaw > 0.00001); triggerScrubOn = (enableEcho - enableEcho') > 0; // enableEcho went 0 to 1 triggerScrubOff = (enableEcho - enableEcho') < 0; // enableEcho went 1 to 0 // Ramps up only during scrub "hold" time and is otherwise zero: counter = (enableEcho * (triggerScrubOn : + ~ +(1) * enableEcho : -(2))) & (dmax-1); // implementation that continues scrubbing where it left off: scrubPhase = scrubPhaseRaw : t60smoother(dEchoT60*(1-triggerScrubOff)); scrubAmp = scrubAmpRaw : t60smoother(dEchoT60*(1-triggerScrubOff)); warp = warpRaw : t60smoother(dEchoT60); dTapSamplesRaw = dEchoSamplesRaw * (1.0 + warp + scrubPhase * scrubAmp) + float(counter); dTapSamples = dTapSamplesRaw : t60smoother(dEchoT60*(1-triggerScrubOff)); process = _ <: _, amp * echo_mono(dmax,dEchoSamples,dTapSamples,fb,fbspr(fbs),gi) : +; // This layout loosely follows the MiniMoog-V // Arturia-only features are labeled // Original versions also added where different // Need vrocker and hrocker toggle switches in Faust! // Need orange and blue color choices // Orange => Connect modulation sources to their destinations // Blue => Turn audio sources On and Off // - and later - // White => Turn performance features On and Off // Black => Select between modulation sources // Julius Smith for Analog Devices 3/1/2017 vrocker(x) = checkbox("%%x [style:vrocker]"); hrocker(x) = checkbox("%%x [style:hrocker]"); vrockerblue(x) = checkbox("%x [style:vrocker] [color:blue]"); vrockerblue(x) = checkbox("%x [style:vrocker] [color:blue]"); // USAGE: vrockerorange("[0] ModulationEnable"); hrockerblue(x) = checkbox("%%x [style:hrocker] [color:blue]"); vrockerred(x) = checkbox("%%x [style:vrocker] [color:red]"); hrockerred(x) = checkbox("%%x [style:hrocker] [color:red]"); declare designer "Robert A. Moog"; mmg(x) = hgroup("",x); // Minimoog + Effects synthg(x) = mmg(vgroup("[0] Minimoog",x)); fxg(x) = mmg(hgroup("[1] Effects",x)); mg(x) = synthg(hgroup("[0]",x)); cg(x) = mg(vgroup("[0] Controllers",x)); // Formerly named "Modules" but "Minimoog" group-title is enough vg(x) = cg(hgroup("[0] Master Volume", x)); dg(x) = cg(hgroup("[1] Oscillator Tuning & Switching", x)); // Tune knob = master tune dsg(x) = dg(vgroup("[1] Switches", x)); // Oscillator Modulation HrockerRed => apply Modulation Mix output to osc1&2 pitches // [MOVED here from osc3 group] Osc 3 Control VrockerRed => use osc3 as LFO instead of osc3 gmmg(x) = cg(hgroup("[2] Glide and ModMix", x)); // Glide knob [0:10] = portamento speed // Modulation Mix knob [0:10] (between Osc3 and Noise) = mix of noise and osc3 modulating osc1&2 pitch and/or VCF freq og(x) = mg(vgroup("[1] Oscillator Bank", x)); osc1(x) = og(hgroup("[1] Oscillator 1", x)); // UNUSED Control switch (for alignment) - Could put Oscillator Modulation switch there // Range rotary switch: LO (slow pulses or rhythm), 32', 16', 8', 4', 2' // Frequency <something> switch: LED to right // Waveform rotary switch: tri, impulse/bent-triangle, saw, pulseWide, pulseMed, pulseNarrow osc2(x) = og(hgroup("[2] Oscillator 2", x)); // UNUSED (originall) or Osc 2 Control VrockerRed // Range rotary switch: LO, 32', 16', 8', 4', 2' // Detuning knob: -7 to 7 [NO SWITCH] // Waveform rotary switch: tri, impulse(?), saw, pulseWide, pulseMed, pulseNarrow osc3(x) = og(hgroup("[3] Oscillator 3", x)); // Osc 3 Control VrockerRed => use osc3 as LFO instead of osc3 // Range rotary switch: LO, 32', 16', 8', 4', 2' // Detuning knob: -7 to 7 [NO SWITCH] // Waveform rotary switch: tri, impulse(?), saw, pulseWide, pulseMed, pulseNarrow mixg(x) = mg(vgroup("[2] Mixer", x)); // Each row 5 slots to maintain alignment and include red rockers joining VCF area: mr1(x) = mixg(hgroup("[0] Osc1", x)); // mixer row 1 = // Osc1 Volume and Osc1 HrockerBlue & _ & _ & Filter Modulation HrockerRed // Filter Modulation => Modulation Mix output to VCF freq mr2(x) = mixg(hgroup("[1] Ext In, KeyCtl", x)); // row 2 = Ext In HrockerBlue and Vol and Overload LED and Keyboard Ctl HrockerRed 1 mr3(x) = mixg(hgroup("[2] Osc2", x)); // = Osc2 Volume and Osc2 HrockerBlue and Keyboard Ctl HrockerRed 2 // Keyboard Control Modulation 1&2 => 0, 1/3, 2/3, all of Keyboard Control Signal ("gate?") applied to VCF freq mr4(x) = mixg(hgroup("[3] Noise", x)); // = Noise HrockerBlue and Volume and Noise Type VrockerBlue mr4cbg(x) = mr4(vgroup("[1]", x)); // = Noise Off and White/Pink selection // two rockers mr5(x) = mixg(hgroup("[4] Osc3", x)); // Osc3 Volume and Osc3 HrockerBlue modg(x) = mg(vgroup("[3] Modifiers", x)); vcfg(x) = modg(vgroup("[0] Filter", x)); vcf1(x) = vcfg(hgroup("[0] [tooltip:freq, Q, ContourScale]", x)); vcf1cbg(x) = vcf1(vgroup("[0] [tooltip:two checkboxes]", x)); // Filter Modulation switch // VCF Off switch // Corner Frequency knob // Filter Emphasis knob // Amount of Contour knob vcf2(x) = vcfg(hgroup("[1] Filter Contour [tooltip:AttFilt, DecFilt, Sustain Level for Filter Contour]", x)); // Attack Time knob // Decay Time knob // Sustain Level knob ng(x) = modg(hgroup("[1] Loudness Contour", x)); // Attack Time knob // Decay Time knob // Sustain Level knob echog(x) = fxg(hgroup("[4] Echo",x)); ekg(x) = echog(vgroup("[0] Knobs",x)); esg(x) = echog(vgroup("[1] Switches",x)); flg(x) = fxg(hgroup("[5] Flanger",x)); flkg(x) = flg(vgroup("[0] Knobs",x)); flsg(x) = flg(vgroup("[1] Switches",x)); chg(x) = fxg(hgroup("[6] Chorus",x)); ckg(x) = chg(vgroup("[0] Knobs",x)); csg(x) = chg(vgroup("[1] Switches",x)); rg(x) = fxg(hgroup("[7] Reverb",x)); rkg(x) = rg(vgroup("[0] Knobs",x)); rsg(x) = rg(vgroup("[1] Switches",x)); outg(x) = fxg(vgroup("[8] Output", x)); volg(x) = outg(hgroup("[0] Volume Main Output", x)); // Volume knob [0-10] // Unison switch (Arturia) or Output connect/disconnect switch (original) // When set, all voices are stacked and instrument is in mono mode tunerg(x) = outg(hgroup("[1] A-440 Switch", x)); vdtpolyg(x) = outg(hgroup("[2] Voice Detune / Poly", x)); // Voice Detune knob [0-10] (Arturia) or // Polyphonic switch [red LED below] (Arturia) // When set, instrument is in polyphonic mode with one oscillator per key clipg(x) = fxg(vgroup("[9] Soft Clip", x)); // Soft Clipping switch [red LED above] kg(x) = synthg(hgroup("[1] Keyboard Group", x)); // Keyboard was 3 1/2 octaves ws(x) = kg(vgroup("[0] Wheels and Switches", x)); s1g(x) = ws(hgroup("[0] Jacks and Rockers", x)); jg(x) = s1g(vgroup("[0] MiniJacks",x)); gdlg(x) = s1g(vgroup("[1] Glide/Decay/Legato Enables",x)); // Arturia // Glide Hrocker (see original Button version below) // Decay Hrocker (see original Button version below) => Sets Release (R) of ADSR to either 0 or Decay (R) // Legato Hrocker (not in original) s2g(x) = ws(hgroup("[1] [tooltip:Wheels+]", x)); bg(x) = s2g(vgroup("[0] [tooltip:Bend Enable and Range]", x)); wg(x) = s2g(hgroup("[1] [tooltip:Bend and Mod Wheels]", x)); // Using Glide/Decay/Legato enables above following Arturia: // dg(x) = s2g(hgroup("[2] Glide and Decay momentary pushbuttons", x)); // Glide Button injects portamento as set by Glide knob // Decay Button uses decay of Loudness Contour (else 0) keys(x) = kg(hgroup("[1] [tooltip:Keys]", x)); gg(x) = keys(hgroup("[0] [tooltip: Gates]",x)); // leave slot 1 open for sustain (below)
https://raw.githubusercontent.com/moforte/sam-faust/85be03f262e384c1befa9eaac237e052040b2cc1/faust-examples/echo/echoForBrowser.dsp
faust
imported by echo.dsp and echomt.dsp Let layout2.dsp lay us out one and done Increase until you get the desired maximum amount of smoothing when fbs==1 fastpow2 = ffunction(float fastpow2(float), "fast_pow2.h", ""); pole radius of feedback smoother "ground input" switches input to zeros Warp and Scrubber stuff: enableEcho went 0 to 1 enableEcho went 1 to 0 Ramps up only during scrub "hold" time and is otherwise zero: implementation that continues scrubbing where it left off: This layout loosely follows the MiniMoog-V Arturia-only features are labeled Original versions also added where different Need vrocker and hrocker toggle switches in Faust! Need orange and blue color choices Orange => Connect modulation sources to their destinations Blue => Turn audio sources On and Off - and later - White => Turn performance features On and Off Black => Select between modulation sources Julius Smith for Analog Devices 3/1/2017 USAGE: vrockerorange("[0] ModulationEnable"); Minimoog + Effects Formerly named "Modules" but "Minimoog" group-title is enough Tune knob = master tune Oscillator Modulation HrockerRed => apply Modulation Mix output to osc1&2 pitches [MOVED here from osc3 group] Osc 3 Control VrockerRed => use osc3 as LFO instead of osc3 Glide knob [0:10] = portamento speed Modulation Mix knob [0:10] (between Osc3 and Noise) = mix of noise and osc3 modulating osc1&2 pitch and/or VCF freq UNUSED Control switch (for alignment) - Could put Oscillator Modulation switch there Range rotary switch: LO (slow pulses or rhythm), 32', 16', 8', 4', 2' Frequency <something> switch: LED to right Waveform rotary switch: tri, impulse/bent-triangle, saw, pulseWide, pulseMed, pulseNarrow UNUSED (originall) or Osc 2 Control VrockerRed Range rotary switch: LO, 32', 16', 8', 4', 2' Detuning knob: -7 to 7 [NO SWITCH] Waveform rotary switch: tri, impulse(?), saw, pulseWide, pulseMed, pulseNarrow Osc 3 Control VrockerRed => use osc3 as LFO instead of osc3 Range rotary switch: LO, 32', 16', 8', 4', 2' Detuning knob: -7 to 7 [NO SWITCH] Waveform rotary switch: tri, impulse(?), saw, pulseWide, pulseMed, pulseNarrow Each row 5 slots to maintain alignment and include red rockers joining VCF area: mixer row 1 = Osc1 Volume and Osc1 HrockerBlue & _ & _ & Filter Modulation HrockerRed Filter Modulation => Modulation Mix output to VCF freq row 2 = Ext In HrockerBlue and Vol and Overload LED and Keyboard Ctl HrockerRed 1 = Osc2 Volume and Osc2 HrockerBlue and Keyboard Ctl HrockerRed 2 Keyboard Control Modulation 1&2 => 0, 1/3, 2/3, all of Keyboard Control Signal ("gate?") applied to VCF freq = Noise HrockerBlue and Volume and Noise Type VrockerBlue = Noise Off and White/Pink selection two rockers Osc3 Volume and Osc3 HrockerBlue Filter Modulation switch VCF Off switch Corner Frequency knob Filter Emphasis knob Amount of Contour knob Attack Time knob Decay Time knob Sustain Level knob Attack Time knob Decay Time knob Sustain Level knob Volume knob [0-10] Unison switch (Arturia) or Output connect/disconnect switch (original) When set, all voices are stacked and instrument is in mono mode Voice Detune knob [0-10] (Arturia) or Polyphonic switch [red LED below] (Arturia) When set, instrument is in polyphonic mode with one oscillator per key Soft Clipping switch [red LED above] Keyboard was 3 1/2 octaves Arturia Glide Hrocker (see original Button version below) Decay Hrocker (see original Button version below) => Sets Release (R) of ADSR to either 0 or Decay (R) Legato Hrocker (not in original) Using Glide/Decay/Legato enables above following Arturia: dg(x) = s2g(hgroup("[2] Glide and Decay momentary pushbuttons", x)); Glide Button injects portamento as set by Glide knob Decay Button uses decay of Loudness Contour (else 0) leave slot 1 open for sustain (below)
import("stdfaust.lib"); knobs_group(x) = ekg(x); switches_group(x) = esg(x); dmaxs = float(dmax)/44100.0; inputSelect(gi) = _,0 : select2(gi); echo_mono(dmax,curdel,tapdel,fb,fbspr,gi) = inputSelect(gi) : (+:si.smooth(fbspr) <: de.fdelay(dmax,curdel), de.fdelay(dmax,tapdel)) ~(*(fb),!) : !,_; tau2pole(tau) = ba.if(tau>0, exp(-1.0/(tau*ma.SR)), 0.0); t60smoother(dEchoT60) = si.smooth(tau2pole(dEchoT60/6.91)); dEchoT60 = knobs_group(vslider("[1] DelayT60 [midi:ctrl 60] [style:knob]", 0.5, 0, 100, 0.001)); dEchoSamplesRaw = knobs_group(vslider("[0] Delay [midi:ctrl 4] [style:knob]", 0.5, 0.001, (dmaxs-0.001), 0.001)) * ma.SR; dEchoSamples = dEchoSamplesRaw : t60smoother(dEchoT60); warpRaw = knobs_group(vslider("[0] Warp [midi:ctrl 62] [style:knob]", 0, -1.0, 1.0, 0.001)); scrubAmpRaw = 0; scrubPhaseRaw = 0; fb = knobs_group(vslider("[2] Feedback [midi:ctrl 3] [style:knob]", .3, 0.0, 1.0, 0.0001)); amp = knobs_group(vslider("[3] Amp [midi:ctrl 2] [style:knob]", .5, 0, 1, 0.001)) : si.smooth(ba.tau2pole(ampT60/6.91)); ampT60 = 0.15661; fbs = knobs_group(vslider("[5] [midi:ctrl 76] FeedbackSm [style:knob]", 0, 0, 1, 0.00001)); enableEcho = (scrubAmpRaw > 0.00001); counter = (enableEcho * (triggerScrubOn : + ~ +(1) * enableEcho : -(2))) & (dmax-1); scrubPhase = scrubPhaseRaw : t60smoother(dEchoT60*(1-triggerScrubOff)); scrubAmp = scrubAmpRaw : t60smoother(dEchoT60*(1-triggerScrubOff)); warp = warpRaw : t60smoother(dEchoT60); dTapSamplesRaw = dEchoSamplesRaw * (1.0 + warp + scrubPhase * scrubAmp) + float(counter); dTapSamples = dTapSamplesRaw : t60smoother(dEchoT60*(1-triggerScrubOff)); process = _ <: _, amp * echo_mono(dmax,dEchoSamples,dTapSamples,fb,fbspr(fbs),gi) : +; vrocker(x) = checkbox("%%x [style:vrocker]"); hrocker(x) = checkbox("%%x [style:hrocker]"); vrockerblue(x) = checkbox("%x [style:vrocker] [color:blue]"); vrockerblue(x) = checkbox("%x [style:vrocker] [color:blue]"); hrockerblue(x) = checkbox("%%x [style:hrocker] [color:blue]"); vrockerred(x) = checkbox("%%x [style:vrocker] [color:red]"); hrockerred(x) = checkbox("%%x [style:hrocker] [color:red]"); declare designer "Robert A. Moog"; synthg(x) = mmg(vgroup("[0] Minimoog",x)); fxg(x) = mmg(hgroup("[1] Effects",x)); mg(x) = synthg(hgroup("[0]",x)); vg(x) = cg(hgroup("[0] Master Volume", x)); dg(x) = cg(hgroup("[1] Oscillator Tuning & Switching", x)); dsg(x) = dg(vgroup("[1] Switches", x)); gmmg(x) = cg(hgroup("[2] Glide and ModMix", x)); og(x) = mg(vgroup("[1] Oscillator Bank", x)); osc1(x) = og(hgroup("[1] Oscillator 1", x)); osc2(x) = og(hgroup("[2] Oscillator 2", x)); osc3(x) = og(hgroup("[3] Oscillator 3", x)); mixg(x) = mg(vgroup("[2] Mixer", x)); modg(x) = mg(vgroup("[3] Modifiers", x)); vcfg(x) = modg(vgroup("[0] Filter", x)); vcf1(x) = vcfg(hgroup("[0] [tooltip:freq, Q, ContourScale]", x)); vcf1cbg(x) = vcf1(vgroup("[0] [tooltip:two checkboxes]", x)); vcf2(x) = vcfg(hgroup("[1] Filter Contour [tooltip:AttFilt, DecFilt, Sustain Level for Filter Contour]", x)); ng(x) = modg(hgroup("[1] Loudness Contour", x)); echog(x) = fxg(hgroup("[4] Echo",x)); ekg(x) = echog(vgroup("[0] Knobs",x)); esg(x) = echog(vgroup("[1] Switches",x)); flg(x) = fxg(hgroup("[5] Flanger",x)); flkg(x) = flg(vgroup("[0] Knobs",x)); flsg(x) = flg(vgroup("[1] Switches",x)); chg(x) = fxg(hgroup("[6] Chorus",x)); ckg(x) = chg(vgroup("[0] Knobs",x)); csg(x) = chg(vgroup("[1] Switches",x)); rg(x) = fxg(hgroup("[7] Reverb",x)); rkg(x) = rg(vgroup("[0] Knobs",x)); rsg(x) = rg(vgroup("[1] Switches",x)); outg(x) = fxg(vgroup("[8] Output", x)); volg(x) = outg(hgroup("[0] Volume Main Output", x)); tunerg(x) = outg(hgroup("[1] A-440 Switch", x)); vdtpolyg(x) = outg(hgroup("[2] Voice Detune / Poly", x)); clipg(x) = fxg(vgroup("[9] Soft Clip", x)); ws(x) = kg(vgroup("[0] Wheels and Switches", x)); s1g(x) = ws(hgroup("[0] Jacks and Rockers", x)); jg(x) = s1g(vgroup("[0] MiniJacks",x)); s2g(x) = ws(hgroup("[1] [tooltip:Wheels+]", x)); bg(x) = s2g(vgroup("[0] [tooltip:Bend Enable and Range]", x)); wg(x) = s2g(hgroup("[1] [tooltip:Bend and Mod Wheels]", x)); keys(x) = kg(hgroup("[1] [tooltip:Keys]", x)); gg(x) = keys(hgroup("[0] [tooltip: Gates]",x));
a8f196cdb8a2828d69446dcaffdc944fc91768d9b4749b052cc79820e642bfb2
moforte/sam-faust
freeverbForBrowser.dsp
import("stdfaust.lib"); declare name "freeverb"; declare version "1.0"; declare author "Grame"; declare license "BSD"; declare copyright "(c) GRAME 2006 and MoForte Inc. 2017"; declare reference "https://ccrma.stanford.edu/~jos/pasp/Freeverb.html"; //====================================================== // // Freeverb // Faster version using fixed delays (20% gain) // //====================================================== // Constant Parameters //-------------------- fixedgain = 0.015; //value of the gain of fxctrl scalewet = 3.0; scaledry = 2.0; scaledamp = 0.4; scaleroom = 0.28; offsetroom = 0.7; initialroom = 0.5; initialdamp = 0.5; initialwet = 1.0/scalewet; initialdry = 0; initialwidth= 1.0; initialmode = 0.0; freezemode = 0.5; stereospread= 23; allpassfeed = 0.5; //feedback of the delays used in allpass filters // Filter Parameters //------------------ combtuningL1 = 1116; combtuningL2 = 1188; combtuningL3 = 1277; combtuningL4 = 1356; combtuningL5 = 1422; combtuningL6 = 1491; combtuningL7 = 1557; combtuningL8 = 1617; allpasstuningL1 = 556; allpasstuningL2 = 441; allpasstuningL3 = 341; allpasstuningL4 = 225; // Control Sliders //-------------------- // Damp : filters the high frequencies of the echoes (especially active for great values of RoomSize) // RoomSize : size of the reverberation room // Dry : original signal // Wet : reverberated signal dampSlider = rkg(vslider("Damp [midi:ctrl 4] [style:knob]",0.5, 0, 1, 0.025))*scaledamp; roomsizeSlider = rkg(vslider("RoomSize [midi:ctrl 3] [style:knob]", 0.5, 0, 1, 0.025))*scaleroom + offsetroom; wetSlider = rkg(vslider("Wet [midi:ctrl 2] [style:knob]", 0.3333, 0, 1, 0.025)); combfeed = roomsizeSlider; // Comb and Allpass filters //------------------------- allpass(dt,fb) = (_,_ <: (*(fb),_:+:@(dt)), -) ~ _ : (!,_); comb(dt, fb, damp) = (+:@(dt)) ~ (*(1-damp) : (+ ~ *(damp)) : *(fb)); // Reverb components //------------------ monoReverb(fb1, fb2, damp, spread) = _ <: comb(combtuningL1+spread, fb1, damp), comb(combtuningL2+spread, fb1, damp), comb(combtuningL3+spread, fb1, damp), comb(combtuningL4+spread, fb1, damp), comb(combtuningL5+spread, fb1, damp), comb(combtuningL6+spread, fb1, damp), comb(combtuningL7+spread, fb1, damp), comb(combtuningL8+spread, fb1, damp) +> allpass (allpasstuningL1+spread, fb2) : allpass (allpasstuningL2+spread, fb2) : allpass (allpasstuningL3+spread, fb2) : allpass (allpasstuningL4+spread, fb2) ; monoReverbToStereo(fb1, fb2, damp, spread) = + <: monoReverb(fb1, fb2, damp, 0) <: _,_; stereoReverb(fb1, fb2, damp, spread) = + <: monoReverb(fb1, fb2, damp, 0), monoReverb(fb1, fb2, damp, spread); monoToStereoReverb(fb1, fb2, damp, spread) = _ <: monoReverb(fb1, fb2, damp, 0), monoReverb(fb1, fb2, damp, spread); // fxctrl : add an input gain and a wet-dry control to a stereo FX //---------------------------------------------------------------- fxctrl(g,w,Fx) = _,_ <: (*(g),*(g) : Fx : *(w),*(w)), *(1-w), *(1-w) +> _,_; rbp = 1-int(rsg(vslider("[0] Enable [midi:ctrl 102][style:knob]",0,0,1,1))); // Freeverb //--------- //JOS:freeverb = fxctrl(fixedgain, wetSlider, stereoReverb(combfeed, allpassfeed, dampSlider, stereospread)); freeverb = fxctrl(fixedgain, wetSlider, monoReverbToStereo(combfeed, allpassfeed, dampSlider, stereospread)); process = ba.bypass2(rbp,freeverb); // This layout loosely follows the MiniMoog-V // Arturia-only features are labeled // Original versions also added where different // Need vrocker and hrocker toggle switches in Faust! // Need orange and blue color choices // Orange => Connect modulation sources to their destinations // Blue => Turn audio sources On and Off // - and later - // White => Turn performance features On and Off // Black => Select between modulation sources // Julius Smith for Analog Devices 3/1/2017 vrocker(x) = checkbox("%%x [style:vrocker]"); hrocker(x) = checkbox("%%x [style:hrocker]"); vrockerblue(x) = checkbox("%x [style:vrocker] [color:blue]"); vrockerblue(x) = checkbox("%x [style:vrocker] [color:blue]"); // USAGE: vrockerorange("[0] ModulationEnable"); hrockerblue(x) = checkbox("%%x [style:hrocker] [color:blue]"); vrockerred(x) = checkbox("%%x [style:vrocker] [color:red]"); hrockerred(x) = checkbox("%%x [style:hrocker] [color:red]"); declare designer "Robert A. Moog"; mmg(x) = hgroup("",x); // Minimoog + Effects synthg(x) = mmg(vgroup("[0] Minimoog",x)); fxg(x) = mmg(hgroup("[1] Effects",x)); mg(x) = synthg(hgroup("[0]",x)); cg(x) = mg(vgroup("[0] Controllers",x)); // Formerly named "Modules" but "Minimoog" group-title is enough vg(x) = cg(hgroup("[0] Master Volume", x)); dg(x) = cg(hgroup("[1] Oscillator Tuning & Switching", x)); // Tune knob = master tune dsg(x) = dg(vgroup("[1] Switches", x)); // Oscillator Modulation HrockerRed => apply Modulation Mix output to osc1&2 pitches // [MOVED here from osc3 group] Osc 3 Control VrockerRed => use osc3 as LFO instead of osc3 gmmg(x) = cg(hgroup("[2] Glide and ModMix", x)); // Glide knob [0:10] = portamento speed // Modulation Mix knob [0:10] (between Osc3 and Noise) = mix of noise and osc3 modulating osc1&2 pitch and/or VCF freq og(x) = mg(vgroup("[1] Oscillator Bank", x)); osc1(x) = og(hgroup("[1] Oscillator 1", x)); // UNUSED Control switch (for alignment) - Could put Oscillator Modulation switch there // Range rotary switch: LO (slow pulses or rhythm), 32', 16', 8', 4', 2' // Frequency <something> switch: LED to right // Waveform rotary switch: tri, impulse/bent-triangle, saw, pulseWide, pulseMed, pulseNarrow osc2(x) = og(hgroup("[2] Oscillator 2", x)); // UNUSED (originall) or Osc 2 Control VrockerRed // Range rotary switch: LO, 32', 16', 8', 4', 2' // Detuning knob: -7 to 7 [NO SWITCH] // Waveform rotary switch: tri, impulse(?), saw, pulseWide, pulseMed, pulseNarrow osc3(x) = og(hgroup("[3] Oscillator 3", x)); // Osc 3 Control VrockerRed => use osc3 as LFO instead of osc3 // Range rotary switch: LO, 32', 16', 8', 4', 2' // Detuning knob: -7 to 7 [NO SWITCH] // Waveform rotary switch: tri, impulse(?), saw, pulseWide, pulseMed, pulseNarrow mixg(x) = mg(vgroup("[2] Mixer", x)); // Each row 5 slots to maintain alignment and include red rockers joining VCF area: mr1(x) = mixg(hgroup("[0] Osc1", x)); // mixer row 1 = // Osc1 Volume and Osc1 HrockerBlue & _ & _ & Filter Modulation HrockerRed // Filter Modulation => Modulation Mix output to VCF freq mr2(x) = mixg(hgroup("[1] Ext In, KeyCtl", x)); // row 2 = Ext In HrockerBlue and Vol and Overload LED and Keyboard Ctl HrockerRed 1 mr3(x) = mixg(hgroup("[2] Osc2", x)); // = Osc2 Volume and Osc2 HrockerBlue and Keyboard Ctl HrockerRed 2 // Keyboard Control Modulation 1&2 => 0, 1/3, 2/3, all of Keyboard Control Signal ("gate?") applied to VCF freq mr4(x) = mixg(hgroup("[3] Noise", x)); // = Noise HrockerBlue and Volume and Noise Type VrockerBlue mr4cbg(x) = mr4(vgroup("[1]", x)); // = Noise Off and White/Pink selection // two rockers mr5(x) = mixg(hgroup("[4] Osc3", x)); // Osc3 Volume and Osc3 HrockerBlue modg(x) = mg(vgroup("[3] Modifiers", x)); vcfg(x) = modg(vgroup("[0] Filter", x)); vcf1(x) = vcfg(hgroup("[0] [tooltip:freq, Q, ContourScale]", x)); vcf1cbg(x) = vcf1(vgroup("[0] [tooltip:two checkboxes]", x)); // Filter Modulation switch // VCF Off switch // Corner Frequency knob // Filter Emphasis knob // Amount of Contour knob vcf2(x) = vcfg(hgroup("[1] Filter Contour [tooltip:AttFilt, DecFilt, Sustain Level for Filter Contour]", x)); // Attack Time knob // Decay Time knob // Sustain Level knob ng(x) = modg(hgroup("[1] Loudness Contour", x)); // Attack Time knob // Decay Time knob // Sustain Level knob echog(x) = fxg(hgroup("[4] Echo",x)); ekg(x) = echog(vgroup("[0] Knobs",x)); esg(x) = echog(vgroup("[1] Switches",x)); flg(x) = fxg(hgroup("[5] Flanger",x)); flkg(x) = flg(vgroup("[0] Knobs",x)); flsg(x) = flg(vgroup("[1] Switches",x)); chg(x) = fxg(hgroup("[6] Chorus",x)); ckg(x) = chg(vgroup("[0] Knobs",x)); csg(x) = chg(vgroup("[1] Switches",x)); rg(x) = fxg(hgroup("[7] Reverb",x)); rkg(x) = rg(vgroup("[0] Knobs",x)); rsg(x) = rg(vgroup("[1] Switches",x)); outg(x) = fxg(vgroup("[8] Output", x)); volg(x) = outg(hgroup("[0] Volume Main Output", x)); // Volume knob [0-10] // Unison switch (Arturia) or Output connect/disconnect switch (original) // When set, all voices are stacked and instrument is in mono mode tunerg(x) = outg(hgroup("[1] A-440 Switch", x)); vdtpolyg(x) = outg(hgroup("[2] Voice Detune / Poly", x)); // Voice Detune knob [0-10] (Arturia) or // Polyphonic switch [red LED below] (Arturia) // When set, instrument is in polyphonic mode with one oscillator per key clipg(x) = fxg(vgroup("[9] Soft Clip", x)); // Soft Clipping switch [red LED above] kg(x) = synthg(hgroup("[1] Keyboard Group", x)); // Keyboard was 3 1/2 octaves ws(x) = kg(vgroup("[0] Wheels and Switches", x)); s1g(x) = ws(hgroup("[0] Jacks and Rockers", x)); jg(x) = s1g(vgroup("[0] MiniJacks",x)); gdlg(x) = s1g(vgroup("[1] Glide/Decay/Legato Enables",x)); // Arturia // Glide Hrocker (see original Button version below) // Decay Hrocker (see original Button version below) => Sets Release (R) of ADSR to either 0 or Decay (R) // Legato Hrocker (not in original) s2g(x) = ws(hgroup("[1] [tooltip:Wheels+]", x)); bg(x) = s2g(vgroup("[0] [tooltip:Bend Enable and Range]", x)); wg(x) = s2g(hgroup("[1] [tooltip:Bend and Mod Wheels]", x)); // Using Glide/Decay/Legato enables above following Arturia: // dg(x) = s2g(hgroup("[2] Glide and Decay momentary pushbuttons", x)); // Glide Button injects portamento as set by Glide knob // Decay Button uses decay of Loudness Contour (else 0) keys(x) = kg(hgroup("[1] [tooltip:Keys]", x)); gg(x) = keys(hgroup("[0] [tooltip: Gates]",x)); // leave slot 1 open for sustain (below)
https://raw.githubusercontent.com/moforte/sam-faust/85be03f262e384c1befa9eaac237e052040b2cc1/faust-examples/freeverb/freeverbForBrowser.dsp
faust
====================================================== Freeverb Faster version using fixed delays (20% gain) ====================================================== Constant Parameters -------------------- value of the gain of fxctrl feedback of the delays used in allpass filters Filter Parameters ------------------ Control Sliders -------------------- Damp : filters the high frequencies of the echoes (especially active for great values of RoomSize) RoomSize : size of the reverberation room Dry : original signal Wet : reverberated signal Comb and Allpass filters ------------------------- Reverb components ------------------ fxctrl : add an input gain and a wet-dry control to a stereo FX ---------------------------------------------------------------- Freeverb --------- JOS:freeverb = fxctrl(fixedgain, wetSlider, stereoReverb(combfeed, allpassfeed, dampSlider, stereospread)); This layout loosely follows the MiniMoog-V Arturia-only features are labeled Original versions also added where different Need vrocker and hrocker toggle switches in Faust! Need orange and blue color choices Orange => Connect modulation sources to their destinations Blue => Turn audio sources On and Off - and later - White => Turn performance features On and Off Black => Select between modulation sources Julius Smith for Analog Devices 3/1/2017 USAGE: vrockerorange("[0] ModulationEnable"); Minimoog + Effects Formerly named "Modules" but "Minimoog" group-title is enough Tune knob = master tune Oscillator Modulation HrockerRed => apply Modulation Mix output to osc1&2 pitches [MOVED here from osc3 group] Osc 3 Control VrockerRed => use osc3 as LFO instead of osc3 Glide knob [0:10] = portamento speed Modulation Mix knob [0:10] (between Osc3 and Noise) = mix of noise and osc3 modulating osc1&2 pitch and/or VCF freq UNUSED Control switch (for alignment) - Could put Oscillator Modulation switch there Range rotary switch: LO (slow pulses or rhythm), 32', 16', 8', 4', 2' Frequency <something> switch: LED to right Waveform rotary switch: tri, impulse/bent-triangle, saw, pulseWide, pulseMed, pulseNarrow UNUSED (originall) or Osc 2 Control VrockerRed Range rotary switch: LO, 32', 16', 8', 4', 2' Detuning knob: -7 to 7 [NO SWITCH] Waveform rotary switch: tri, impulse(?), saw, pulseWide, pulseMed, pulseNarrow Osc 3 Control VrockerRed => use osc3 as LFO instead of osc3 Range rotary switch: LO, 32', 16', 8', 4', 2' Detuning knob: -7 to 7 [NO SWITCH] Waveform rotary switch: tri, impulse(?), saw, pulseWide, pulseMed, pulseNarrow Each row 5 slots to maintain alignment and include red rockers joining VCF area: mixer row 1 = Osc1 Volume and Osc1 HrockerBlue & _ & _ & Filter Modulation HrockerRed Filter Modulation => Modulation Mix output to VCF freq row 2 = Ext In HrockerBlue and Vol and Overload LED and Keyboard Ctl HrockerRed 1 = Osc2 Volume and Osc2 HrockerBlue and Keyboard Ctl HrockerRed 2 Keyboard Control Modulation 1&2 => 0, 1/3, 2/3, all of Keyboard Control Signal ("gate?") applied to VCF freq = Noise HrockerBlue and Volume and Noise Type VrockerBlue = Noise Off and White/Pink selection two rockers Osc3 Volume and Osc3 HrockerBlue Filter Modulation switch VCF Off switch Corner Frequency knob Filter Emphasis knob Amount of Contour knob Attack Time knob Decay Time knob Sustain Level knob Attack Time knob Decay Time knob Sustain Level knob Volume knob [0-10] Unison switch (Arturia) or Output connect/disconnect switch (original) When set, all voices are stacked and instrument is in mono mode Voice Detune knob [0-10] (Arturia) or Polyphonic switch [red LED below] (Arturia) When set, instrument is in polyphonic mode with one oscillator per key Soft Clipping switch [red LED above] Keyboard was 3 1/2 octaves Arturia Glide Hrocker (see original Button version below) Decay Hrocker (see original Button version below) => Sets Release (R) of ADSR to either 0 or Decay (R) Legato Hrocker (not in original) Using Glide/Decay/Legato enables above following Arturia: dg(x) = s2g(hgroup("[2] Glide and Decay momentary pushbuttons", x)); Glide Button injects portamento as set by Glide knob Decay Button uses decay of Loudness Contour (else 0) leave slot 1 open for sustain (below)
import("stdfaust.lib"); declare name "freeverb"; declare version "1.0"; declare author "Grame"; declare license "BSD"; declare copyright "(c) GRAME 2006 and MoForte Inc. 2017"; declare reference "https://ccrma.stanford.edu/~jos/pasp/Freeverb.html"; scalewet = 3.0; scaledry = 2.0; scaledamp = 0.4; scaleroom = 0.28; offsetroom = 0.7; initialroom = 0.5; initialdamp = 0.5; initialwet = 1.0/scalewet; initialdry = 0; initialwidth= 1.0; initialmode = 0.0; freezemode = 0.5; stereospread= 23; combtuningL1 = 1116; combtuningL2 = 1188; combtuningL3 = 1277; combtuningL4 = 1356; combtuningL5 = 1422; combtuningL6 = 1491; combtuningL7 = 1557; combtuningL8 = 1617; allpasstuningL1 = 556; allpasstuningL2 = 441; allpasstuningL3 = 341; allpasstuningL4 = 225; dampSlider = rkg(vslider("Damp [midi:ctrl 4] [style:knob]",0.5, 0, 1, 0.025))*scaledamp; roomsizeSlider = rkg(vslider("RoomSize [midi:ctrl 3] [style:knob]", 0.5, 0, 1, 0.025))*scaleroom + offsetroom; wetSlider = rkg(vslider("Wet [midi:ctrl 2] [style:knob]", 0.3333, 0, 1, 0.025)); combfeed = roomsizeSlider; allpass(dt,fb) = (_,_ <: (*(fb),_:+:@(dt)), -) ~ _ : (!,_); comb(dt, fb, damp) = (+:@(dt)) ~ (*(1-damp) : (+ ~ *(damp)) : *(fb)); monoReverb(fb1, fb2, damp, spread) = _ <: comb(combtuningL1+spread, fb1, damp), comb(combtuningL2+spread, fb1, damp), comb(combtuningL3+spread, fb1, damp), comb(combtuningL4+spread, fb1, damp), comb(combtuningL5+spread, fb1, damp), comb(combtuningL6+spread, fb1, damp), comb(combtuningL7+spread, fb1, damp), comb(combtuningL8+spread, fb1, damp) +> allpass (allpasstuningL1+spread, fb2) : allpass (allpasstuningL2+spread, fb2) : allpass (allpasstuningL3+spread, fb2) : allpass (allpasstuningL4+spread, fb2) ; monoReverbToStereo(fb1, fb2, damp, spread) = + <: monoReverb(fb1, fb2, damp, 0) <: _,_; stereoReverb(fb1, fb2, damp, spread) = + <: monoReverb(fb1, fb2, damp, 0), monoReverb(fb1, fb2, damp, spread); monoToStereoReverb(fb1, fb2, damp, spread) = _ <: monoReverb(fb1, fb2, damp, 0), monoReverb(fb1, fb2, damp, spread); fxctrl(g,w,Fx) = _,_ <: (*(g),*(g) : Fx : *(w),*(w)), *(1-w), *(1-w) +> _,_; rbp = 1-int(rsg(vslider("[0] Enable [midi:ctrl 102][style:knob]",0,0,1,1))); freeverb = fxctrl(fixedgain, wetSlider, monoReverbToStereo(combfeed, allpassfeed, dampSlider, stereospread)); process = ba.bypass2(rbp,freeverb); vrocker(x) = checkbox("%%x [style:vrocker]"); hrocker(x) = checkbox("%%x [style:hrocker]"); vrockerblue(x) = checkbox("%x [style:vrocker] [color:blue]"); vrockerblue(x) = checkbox("%x [style:vrocker] [color:blue]"); hrockerblue(x) = checkbox("%%x [style:hrocker] [color:blue]"); vrockerred(x) = checkbox("%%x [style:vrocker] [color:red]"); hrockerred(x) = checkbox("%%x [style:hrocker] [color:red]"); declare designer "Robert A. Moog"; synthg(x) = mmg(vgroup("[0] Minimoog",x)); fxg(x) = mmg(hgroup("[1] Effects",x)); mg(x) = synthg(hgroup("[0]",x)); vg(x) = cg(hgroup("[0] Master Volume", x)); dg(x) = cg(hgroup("[1] Oscillator Tuning & Switching", x)); dsg(x) = dg(vgroup("[1] Switches", x)); gmmg(x) = cg(hgroup("[2] Glide and ModMix", x)); og(x) = mg(vgroup("[1] Oscillator Bank", x)); osc1(x) = og(hgroup("[1] Oscillator 1", x)); osc2(x) = og(hgroup("[2] Oscillator 2", x)); osc3(x) = og(hgroup("[3] Oscillator 3", x)); mixg(x) = mg(vgroup("[2] Mixer", x)); modg(x) = mg(vgroup("[3] Modifiers", x)); vcfg(x) = modg(vgroup("[0] Filter", x)); vcf1(x) = vcfg(hgroup("[0] [tooltip:freq, Q, ContourScale]", x)); vcf1cbg(x) = vcf1(vgroup("[0] [tooltip:two checkboxes]", x)); vcf2(x) = vcfg(hgroup("[1] Filter Contour [tooltip:AttFilt, DecFilt, Sustain Level for Filter Contour]", x)); ng(x) = modg(hgroup("[1] Loudness Contour", x)); echog(x) = fxg(hgroup("[4] Echo",x)); ekg(x) = echog(vgroup("[0] Knobs",x)); esg(x) = echog(vgroup("[1] Switches",x)); flg(x) = fxg(hgroup("[5] Flanger",x)); flkg(x) = flg(vgroup("[0] Knobs",x)); flsg(x) = flg(vgroup("[1] Switches",x)); chg(x) = fxg(hgroup("[6] Chorus",x)); ckg(x) = chg(vgroup("[0] Knobs",x)); csg(x) = chg(vgroup("[1] Switches",x)); rg(x) = fxg(hgroup("[7] Reverb",x)); rkg(x) = rg(vgroup("[0] Knobs",x)); rsg(x) = rg(vgroup("[1] Switches",x)); outg(x) = fxg(vgroup("[8] Output", x)); volg(x) = outg(hgroup("[0] Volume Main Output", x)); tunerg(x) = outg(hgroup("[1] A-440 Switch", x)); vdtpolyg(x) = outg(hgroup("[2] Voice Detune / Poly", x)); clipg(x) = fxg(vgroup("[9] Soft Clip", x)); ws(x) = kg(vgroup("[0] Wheels and Switches", x)); s1g(x) = ws(hgroup("[0] Jacks and Rockers", x)); jg(x) = s1g(vgroup("[0] MiniJacks",x)); s2g(x) = ws(hgroup("[1] [tooltip:Wheels+]", x)); bg(x) = s2g(vgroup("[0] [tooltip:Bend Enable and Range]", x)); wg(x) = s2g(hgroup("[1] [tooltip:Bend and Mod Wheels]", x)); keys(x) = kg(hgroup("[1] [tooltip:Keys]", x)); gg(x) = keys(hgroup("[0] [tooltip: Gates]",x));
7b954d2e28d5a864c179070392e0cf7e7c8e9784405fdcdad3e7be26dc92e718
moforte/sam-faust
virtualAnalog.dsp
import("stdfaust.lib"); // These are now in a separate file ./effects.dsp // echo = echog(component("echo.dsp")); // ./echo.dsp // flanger = flg(component("flanger.dsp")); // ./flanger.dsp // chorus = chg(component("chorus.dsp")); // ./chorus.dsp // reverb = rg(component("freeverb.dsp")); process = main <: _,_; // Now separate: : echo : flanger : chorus : reverb; main = (signal + extInput : filters : *(ampScaling)) ~ _; signal = oscs + noise * noiseOff * namp; ampScaling = envelopeAmp * masterVolume; // masterVolume is redundant but easier to find oscs = par(i,3,(oscamp(i+1)*osc(i+1))) :> _; controlSelect(1) = osc1(vrockerred); // ("[0] use as LFO")); octaveSelect(1) = osc1(vslider("[1] Octave1 [midi:ctrl 23] [style:knob]",1,0,5,1):int); // LO, 32', 16', 8', 4', 2' // Osc1 detunes like Osc2 and Osc3 (unlike in the Minimoog where it would be an expensive extra knob): detuneOctaves(1) = osc1(vslider("[2] DeTuning1 [units:Octaves] [midi:ctrl 24] [style:knob]",0.0,-1.0,1.0,0.001)); waveSelect(1) = osc1(vslider("[3] Waveform1 [midi:ctrl 25] [style:knob]",5,0,5,1):int); amp1Enable = mr1(vslider("[1] On [midi:ctrl 12] [style:knob] [color:blue]",1,0,1,1)); oscamp(1) = mr1(vslider("[0] Osc1 Amp [midi:ctrl 26] [style:knob]",0.5,0.0,1.0,0.001)) * amp1Enable; eei = mr2(vslider("[1] On [midi:ctrl 13] [style:knob] [color:blue]",0,0,1,1)); // External input = MAIN OUTPUT when "off" sei = mr2(vslider("[0] Ext Input [midi:ctrl 27] [style: knob]",0,0,1.0,0.001)); extInput(fb,extSig) = fb,extSig : select2(eei) : *(sei) : extClipLED; extClipLED = _ <: _, (abs : >(0.95) : mr2(vbargraph("[2] Ext Input Clip [style:led]",0,1)):!); keycLED = attach(mr2(vbargraph("[3] Keyboard Ctl [style:led]",0,1))); controlSelect(2) = osc2(vrockerred); // ("[0] use as LFO")); octaveSelect(2) = osc2(vslider("[1] Octave2 [midi:ctrl 28] [style:knob]",1,0,5,1):int); // LO, 32', 16', 8', 4', 2' detuneOctaves(2) = osc2(vslider("[2] DeTuning2 [units:Octaves] [midi:ctrl 29] [style:knob]",0.41667,-1.0,1.0,0.001)); waveSelect(2) = osc2(vslider("[3] Waveform2 [midi:ctrl 30] [style:knob]",5,0,5,1):int); amp2Enable = mr3(vslider("[1] On [midi:ctrl 14] [style:knob] [color:blue]",1,0,1,1)); oscamp(2) = mr3(vslider("[0] Osc2 Amp [midi:ctrl 31] [style:knob]",0.5,0.0,1.0,0.001)) * amp2Enable; noise = select2(ntype,no.noise,10.0*no.pink_noise); // pink noise needs some "make-up gain" namp = mr4(vslider("[0] Noise Amp [midi:ctrl 32] [style: knob]",0.0,0.0,1.0,0.001)); noiseOff = mr4cbg(vslider("[0] On [midi:ctrl 15] [style:knob] [color:blue]",0,0,1,1)); ntype = mr4cbg(vslider("[1] White/Pink [midi:ctrl 16] [tooltip: Choose either White or Pink Noise] [style: knob] [color:blue]",1,0,1,1)); controlSelect(3) = osc3(vrockerred); // ("[0] use as LFO")); octaveSelect(3) = osc3(vslider("[1] Octave3 [midi:ctrl 33] [style:knob]",0,0,5,1):int); // LO, 32', 16', 8', 4', 2' detuneOctaves(3) = osc3(vslider("[2] DeTuning3 [units:Octaves] [midi:ctrl 34] [style:knob]",0.3,-1.0,1.0,0.001)); waveSelect(3) = osc3(vslider("[3] Waveform3 [midi:ctrl 35] [style:knob]",0,0,5,1):int); amp3Enable = mr5(vslider("[1] On [midi:ctrl 17] [style:knob] [color:blue]",0,0,1,1)); oscamp(3) = mr5(vslider("[0] Osc3 Amp [midi:ctrl 36] [style:knob]",0.5,0.0,1.0,0.001)) * amp3Enable; waveforms(i) = (tri(i), bent(i), saw(i), sq(i), ptm(i), ptn(i)); // compute oscillator frequency scale factor, staying in lg(Hz) as much as possible: modWheelShift = 1.5*modWheel; // Manual says 0 to 1.5 octaves modulationCenterShift = 0; // Leave this off until triangle-wave modulation is debugged modulationShift = select2(oscModEnable, 0.0, modWheelShift * ( modulationCenterShift + (1.0-modulationCenterShift) * oscNoiseModulation )); octaveShift(i) = -2+int(octaveSelect(i)); osc3FixedFreq = 369.994; // F# a tritone above middle C keyFreqGlidedMaybe = select2(osc3Control,osc3FixedFreq,keyFreqGlided); keyFreqModulatedShifted(3) = keyFreqGlidedMaybe; // osc3 not allowed to FM itself keyFreqModulatedShifted(i) = keyFreqGlided * pow(2.0, modulationShift); // i=1,2 // When disconnected from the keyboard, Osc3 can detune 3 octaves up or down (Pat video): detuneBoost(3) = select2(osc3Control,3.0,1.0); detuneBoost(i) = 1.0; // i=1,2 detuneOctavesFinal(i) = detuneOctaves(i)*detuneBoost(i); fBase(i) = keyFreqModulatedShifted(i) * pow(2.0, (masterTuneOctaves+octaveShift(i)+detuneOctavesFinal(i))) : si.smooth(ba.tau2pole(0.016)); fLFOBase(i) = 3.0 * pow(2.0, detuneOctavesFinal(i)); // used when osc3 (only) is in LFO mode lfoMode(i) = (octaveSelect(i) == 0); f(i) = select2(lfoMode(i), fBase(i), fLFOBase(i)); // lowest range setting is LFO mode for any osc // i is 1-based: osc(i) = ba.selectn(6, int(waveSelect(i)), tri(i), bent(i), saw(i), sq(i), ptm(i), ptn(i)); tri(i) = select2(lfoMode(i), os.triangle(f(i)), os.lf_triangle(f(i))); bent(i) = 0.5*tri(i) + 0.5*saw(i); // from Minimoog manual saw(i) = select2(lfoMode(i), os.sawtooth(f(i)), os.lf_saw(f(i))); sq(i) = select2(lfoMode(i), os.square(f(i)), os.lf_squarewave(f(i))); ptm(i) = select2(lfoMode(i), // Note: a Duty knob would be better than these two, or in addition os.pulsetrain(f(i),0.25), lf_pulsetrain(f(i),0.25)); ptn(i) = select2(lfoMode(i), os.pulsetrain(f(i),0.125), lf_pulsetrain(f(i),0.125)); // Soon to appear in oscillators.lib: lf_pulsetrain(freq,duty) = 2.0*os.lf_pulsetrainpos(freq,duty) - 1.0; import("layout2.dsp"); // follows the Mini Moog front panel: ./layout2.dsp filters = ba.bypass1(bp,vcf); // BYPASS WILL GO AWAY (I think you just open it up all the way to bypass): bp = 0; // VCF is always on fcLgHz = vcf1(vslider("[1] Corner Freq [unit:Log2(Hz)] [tooltip: Corner resonance frequency in Log2(Hertz)] [style: knob] [midi:ctrl 74]", // Frequency Cutoff (aka Brightness ) 10.6, log(40.0)/log(2), log(20000.0)/log(2), 0.000001)) // 9 octaves (from Minimoog manual) //p: 40, 30, 80, 0.01)) //p: : ba.pianokey2hz : si.smooth(ba.tau2pole(0.016)); res = vcf1(vslider("[2] Corner Resonance [midi:ctrl 37] [tooltip: Resonance Q at VCF corner frequency (0 to 1)] [style: knob]", 0.7, 0, 1, 0.01)); vcfKeyRange = vcf1cbg(vslider("[2] Kbd Ctl [midi:ctrl 38] [tooltip: Keyboard tracking of VCF corner-frequency (0=none, 1=full)] [style: knob]", 1, 0, 1, 0.001)); // was in mr2 vcfModEnable = vcf1cbg(vslider("[1] Filter Mod. [midi:ctrl 19] [color:red] [style:knob] [tooltip: Filter Modulation => Route Modulation Mix output to VCF frequency]",1,0,1,1)); // Note that VCF has three sources of corner-frequency setting that are added together: // - Corner Freq knob (40 Hz to 20 kHz) // - VCF Contour envelope (0 to 4 octaves) // - Injection 32 of Modulation Mix (0 to 1.5 octaves) // Manual says maximum vcf sweep spans 0 to 4 octaves: // Original Knob went to 10, but we're going to 4 so we can say the knob is in "octaves" units: vcfContourAmountOctaves = vcf1(vslider("[3] Amount of Contour (octaves) [midi:ctrl 39] [style: knob]", 1.2, 0, 4.0, 0.001)); vcfContourOctaves = vcfContourAmountOctaves * envelopeVCF; // in octaves // We are assuming that the modulation-mix range for the VCF freq is 1.5 octaves like it is for oscs 1 and 2: vcfModMixModulationOctaves = select2(vcfModEnable, 0, (1.5 * oscNoiseModulation * modWheel)); // octaves vcfModulationOctaves = vcfModMixModulationOctaves + vcfContourOctaves; keyFreqLogHzGlided = log(keyFreqGlided)/log(2.0); // FIXME: Start w freqLogHz not freq so we don't need exp(log()) here keyShiftOctaves = keyFreqLogHzGlided - log(261.625565)/log(2.0); // FIXME: ARBITRARILY centering on middle C - check device vcfKeyShiftOctaves = vcfKeyRange * keyShiftOctaves; modulatedFcLgHz = fcLgHz + vcfModulationOctaves + vcfKeyShiftOctaves; fc = min((0.5*ma.SR), pow(2.0,modulatedFcLgHz)); vcf = moog_vcf_2bn(res,fc) with { moog_vcf_2bn(res,fr) = fi.tf2snp(0,0,b0,a11,a01,w1) : fi.tf2snp(0,0,b0,a12,a02,w1) with { s = 1; // minus the open-loop location of all four poles w1 = 2*ma.PI*max(fr,20); // frequency-scaling parameter for bilinear xform k = sqrt(2)*0.99999*res; // fourth root of Moog VCF feedback gain b0 = s^2; s2k = sqrt(2) * k; a11 = s * (2 + s2k); a12 = s * (2 - s2k); a01 = b0 * (1 + s2k + k^2); a02 = b0 * (1 - s2k + k^2); }; }; // Attack, Decay, and Sustain ranges are set according to the Minimoog manual: attT60VCF = 0.001 * vcf2(vslider("[0] AttackF [midi:ctrl 40] [tooltip: Attack Time] [unit:ms] [style: knob]",1400,10,10000,1)); decT60VCF = 0.001 * vcf2(vslider("[0] DecayF [midi:ctrl 41] [tooltip: Decay-to-Sustain Time] [unit:ms] [style: knob]",10,10,10000,1)); susLvlVCF = vcf2(vslider("[0] SustainF [midi:ctrl 42] [tooltip: Sustain level as percent of max] [style: knob]",80,0,100,0.1)); decayButton = wg(vslider("Decay [midi:ctrl 20] [tooltip:Envelope Release either Decay value or 0][style:knob]",1,0,1,1):int); // was Staccato legatoButton = wg(vslider("Glide [midi:ctrl 65] [tooltip: Glide from note to note][style:knob]",1,0,1,1)); // was Legato relT60VCF = select2(decayButton,0.010,decT60VCF); envelopeVCF = en.adsre(attT60VCF,decT60VCF,susLvlVCF,relT60VCF,gate); // --- Smart Keyboard interface --- declare interface "SmartKeyboard{ 'Number of Keyboards':'2', 'Keyboard 0 - Number of Keys':'13', 'Keyboard 1 - Number of Keys':'13', 'Keyboard 0 - Lowest Key':'72', 'Keyboard 1 - Lowest Key':'60' }"; // --- functions --- // Signal controls: keyDownHold = gg(vslider("[0] gateHold [tooltip: lock sustain pedal on (hold gate set at 1)][style:knob]",0,0,1,1)); keyDown = gg(button("[1] gate [tooltip: The gate signal is 1 during a note and 0 otherwise. For MIDI, NoteOn occurs when the gate transitions from 0 to 1, and NoteOff is an event corresponding to the gate transition from 1 to 0. The name of this Faust button must be 'gate'.]")); sustain = gg(button("[1] sustain [midi:ctrl 64] [tooltip: extends the gate (keeps it set to 1)]")); // MIDI only (see smartkeyb doc) gate = keyDown + keyDownHold + sustain : min(1); attT60 = 0.001 * ng(vslider("[0] AttackA [midi:ctrl 43] [tooltip: Attack Time] [unit:ms] [style: knob]",2,0,5000,0.1)); decT60 = 0.001 * ng(vslider("[0] DecayA [midi:ctrl 44] [tooltip: Decay-to-Sustain Time] [unit:ms] [style: knob]",10,0,10000,0.1)); susLvl = ng(vslider("[0] SustainA [midi:ctrl 45] [tooltip: Sustain level as percent of max] [style: knob]",80,0,100,0.1)); relT60 = select2(decayButton,0.010,decT60); // right? envelopeAmpNoAM = en.adsre(attT60,decT60,susLvl,relT60,gate); AMDepth = 0.5; envelopeAmp = select2(oscModEnable, envelopeAmpNoAM, envelopeAmpNoAM * (1.0 + AMDepth*modWheel * 0.5 * (1.0+oscNoiseModulation))); // Signal Parameters ampL = volg(vslider("[1] gain [style:knob] [tooltip: Amplitude]",0.2,0,1.0,0.001)); amp = ampL : si.smoo; // envelopeAmp is multiplied once on entire signal sum //elecGuitar.dsp values used: bend = wg(hslider("[0] bend [style:knob] [midi:pitchwheel]",1,0.001,10,0.01)) : si.polySmooth(gate,0.999,1); //Previous guess: modWheel = wg(vslider("[1] mod [midi:ctrl 1] [style:knob] [tooltip: PitchModulation amplitude in octaves]", 0,0,1.0,0.01)) : si.polySmooth(gate,0.999,1); //p: MIDI requires frequency in Hz, not piano-keys as we had before // Frequency Range is 0.1 Hz to 20 kHz according to the Minimoog manual: // MIDI REQUIRES THE FOLLOWING PARAMETER TO BE NAMED 'freq': keyFreqBent = bend * kg(hslider("[2] freq [unit:Hz] [style:knob]",220,0.1,20000,0.1)); masterVolume = vg(vslider("MasterVolume [style:knob] [midi:ctrl 7] [tooltip: master volume, MIDI controlled]", 0.7,0,1,0.001)) : si.smooth(ba.tau2pole(0.16)); masterTuneOctaves = dg(vslider("[0] Tune [midi:ctrl 47] [unit:Octaves] [style:knob] [tooltip: Frequency-shift up or down for all oscillators in Octaves]", 0.0,-1.0,1.0,0.001)); // Oscillator Modulation HrockerRed => apply Modulation Mix output osc1&2 pitches glide = gmmg(vslider("[0] Glide [midi:ctrl 5] [unit:sec/octave] [style:knob] [scale:log] [tooltip: Portamento (frequency-glide) in seconds per octave]", 0.008,0.001,1.0,0.001)); legatoPole = select2(legatoButton,0.5,ba.tau2pole(glide*exp(1.0f)/2.0f)); // convert 1/e to 1/2 by slowing down exp keyFreqGlided = keyFreqBent : si.smooth(legatoPole); mmix = gmmg(vslider("[1] Mod. Mix [midi:ctrl 48] [style:knob] [tooltip: Modulation Mix: Osc3 (0) to Noise (1)]", 0.0,0.0,1.0,0.001)); oscNoiseModulation = (mmix * noise) + ((1.0-mmix) * osc(3)); // noise amplitude and off-switch ignored here oscModEnable = dsg(vslider("[0] Osc. Mod. [midi:ctrl 22] [color:red] [style:knob] [tooltip:Oscillator Modulation adds Modulation Mix output to osc1&2 frequencies",1,0,1,1)); // any offset? osc3Control = dsg(vslider("[1] Osc. 3 Ctl [midi:ctrl 9] [color:red] [style:knob] [tooltip:Oscillator 3 frequency tracks the keyboard if on, else not",0,0,1,1):int);
https://raw.githubusercontent.com/moforte/sam-faust/85be03f262e384c1befa9eaac237e052040b2cc1/faust-examples/virtualAnalog/virtualAnalog.dsp
faust
These are now in a separate file ./effects.dsp echo = echog(component("echo.dsp")); // ./echo.dsp flanger = flg(component("flanger.dsp")); // ./flanger.dsp chorus = chg(component("chorus.dsp")); // ./chorus.dsp reverb = rg(component("freeverb.dsp")); Now separate: : echo : flanger : chorus : reverb; masterVolume is redundant but easier to find ("[0] use as LFO")); LO, 32', 16', 8', 4', 2' Osc1 detunes like Osc2 and Osc3 (unlike in the Minimoog where it would be an expensive extra knob): External input = MAIN OUTPUT when "off" ("[0] use as LFO")); LO, 32', 16', 8', 4', 2' pink noise needs some "make-up gain" ("[0] use as LFO")); LO, 32', 16', 8', 4', 2' compute oscillator frequency scale factor, staying in lg(Hz) as much as possible: Manual says 0 to 1.5 octaves Leave this off until triangle-wave modulation is debugged F# a tritone above middle C osc3 not allowed to FM itself i=1,2 When disconnected from the keyboard, Osc3 can detune 3 octaves up or down (Pat video): i=1,2 used when osc3 (only) is in LFO mode lowest range setting is LFO mode for any osc i is 1-based: from Minimoog manual Note: a Duty knob would be better than these two, or in addition Soon to appear in oscillators.lib: follows the Mini Moog front panel: ./layout2.dsp BYPASS WILL GO AWAY (I think you just open it up all the way to bypass): VCF is always on Frequency Cutoff (aka Brightness ) 9 octaves (from Minimoog manual) p: 40, 30, 80, 0.01)) p: : ba.pianokey2hz was in mr2 Note that VCF has three sources of corner-frequency setting that are added together: - Corner Freq knob (40 Hz to 20 kHz) - VCF Contour envelope (0 to 4 octaves) - Injection 32 of Modulation Mix (0 to 1.5 octaves) Manual says maximum vcf sweep spans 0 to 4 octaves: Original Knob went to 10, but we're going to 4 so we can say the knob is in "octaves" units: in octaves We are assuming that the modulation-mix range for the VCF freq is 1.5 octaves like it is for oscs 1 and 2: octaves FIXME: Start w freqLogHz not freq so we don't need exp(log()) here FIXME: ARBITRARILY centering on middle C - check device minus the open-loop location of all four poles frequency-scaling parameter for bilinear xform fourth root of Moog VCF feedback gain Attack, Decay, and Sustain ranges are set according to the Minimoog manual: was Staccato was Legato --- Smart Keyboard interface --- --- functions --- Signal controls: MIDI only (see smartkeyb doc) right? Signal Parameters envelopeAmp is multiplied once on entire signal sum elecGuitar.dsp values used: Previous guess: p: MIDI requires frequency in Hz, not piano-keys as we had before Frequency Range is 0.1 Hz to 20 kHz according to the Minimoog manual: MIDI REQUIRES THE FOLLOWING PARAMETER TO BE NAMED 'freq': Oscillator Modulation HrockerRed => apply Modulation Mix output osc1&2 pitches convert 1/e to 1/2 by slowing down exp noise amplitude and off-switch ignored here any offset?
import("stdfaust.lib"); main = (signal + extInput : filters : *(ampScaling)) ~ _; signal = oscs + noise * noiseOff * namp; oscs = par(i,3,(oscamp(i+1)*osc(i+1))) :> _; detuneOctaves(1) = osc1(vslider("[2] DeTuning1 [units:Octaves] [midi:ctrl 24] [style:knob]",0.0,-1.0,1.0,0.001)); waveSelect(1) = osc1(vslider("[3] Waveform1 [midi:ctrl 25] [style:knob]",5,0,5,1):int); amp1Enable = mr1(vslider("[1] On [midi:ctrl 12] [style:knob] [color:blue]",1,0,1,1)); oscamp(1) = mr1(vslider("[0] Osc1 Amp [midi:ctrl 26] [style:knob]",0.5,0.0,1.0,0.001)) * amp1Enable; sei = mr2(vslider("[0] Ext Input [midi:ctrl 27] [style: knob]",0,0,1.0,0.001)); extInput(fb,extSig) = fb,extSig : select2(eei) : *(sei) : extClipLED; extClipLED = _ <: _, (abs : >(0.95) : mr2(vbargraph("[2] Ext Input Clip [style:led]",0,1)):!); keycLED = attach(mr2(vbargraph("[3] Keyboard Ctl [style:led]",0,1))); detuneOctaves(2) = osc2(vslider("[2] DeTuning2 [units:Octaves] [midi:ctrl 29] [style:knob]",0.41667,-1.0,1.0,0.001)); waveSelect(2) = osc2(vslider("[3] Waveform2 [midi:ctrl 30] [style:knob]",5,0,5,1):int); amp2Enable = mr3(vslider("[1] On [midi:ctrl 14] [style:knob] [color:blue]",1,0,1,1)); oscamp(2) = mr3(vslider("[0] Osc2 Amp [midi:ctrl 31] [style:knob]",0.5,0.0,1.0,0.001)) * amp2Enable; namp = mr4(vslider("[0] Noise Amp [midi:ctrl 32] [style: knob]",0.0,0.0,1.0,0.001)); noiseOff = mr4cbg(vslider("[0] On [midi:ctrl 15] [style:knob] [color:blue]",0,0,1,1)); ntype = mr4cbg(vslider("[1] White/Pink [midi:ctrl 16] [tooltip: Choose either White or Pink Noise] [style: knob] [color:blue]",1,0,1,1)); detuneOctaves(3) = osc3(vslider("[2] DeTuning3 [units:Octaves] [midi:ctrl 34] [style:knob]",0.3,-1.0,1.0,0.001)); waveSelect(3) = osc3(vslider("[3] Waveform3 [midi:ctrl 35] [style:knob]",0,0,5,1):int); amp3Enable = mr5(vslider("[1] On [midi:ctrl 17] [style:knob] [color:blue]",0,0,1,1)); oscamp(3) = mr5(vslider("[0] Osc3 Amp [midi:ctrl 36] [style:knob]",0.5,0.0,1.0,0.001)) * amp3Enable; waveforms(i) = (tri(i), bent(i), saw(i), sq(i), ptm(i), ptn(i)); modulationShift = select2(oscModEnable, 0.0, modWheelShift * ( modulationCenterShift + (1.0-modulationCenterShift) * oscNoiseModulation )); octaveShift(i) = -2+int(octaveSelect(i)); keyFreqGlidedMaybe = select2(osc3Control,osc3FixedFreq,keyFreqGlided); detuneBoost(3) = select2(osc3Control,3.0,1.0); detuneOctavesFinal(i) = detuneOctaves(i)*detuneBoost(i); fBase(i) = keyFreqModulatedShifted(i) * pow(2.0, (masterTuneOctaves+octaveShift(i)+detuneOctavesFinal(i))) : si.smooth(ba.tau2pole(0.016)); lfoMode(i) = (octaveSelect(i) == 0); osc(i) = ba.selectn(6, int(waveSelect(i)), tri(i), bent(i), saw(i), sq(i), ptm(i), ptn(i)); tri(i) = select2(lfoMode(i), os.triangle(f(i)), os.lf_triangle(f(i))); saw(i) = select2(lfoMode(i), os.sawtooth(f(i)), os.lf_saw(f(i))); sq(i) = select2(lfoMode(i), os.square(f(i)), os.lf_squarewave(f(i))); os.pulsetrain(f(i),0.25), lf_pulsetrain(f(i),0.25)); ptn(i) = select2(lfoMode(i), os.pulsetrain(f(i),0.125), lf_pulsetrain(f(i),0.125)); lf_pulsetrain(freq,duty) = 2.0*os.lf_pulsetrainpos(freq,duty) - 1.0; fcLgHz = vcf1(vslider("[1] Corner Freq [unit:Log2(Hz)] [tooltip: Corner resonance frequency in Log2(Hertz)] [style: knob] : si.smooth(ba.tau2pole(0.016)); res = vcf1(vslider("[2] Corner Resonance [midi:ctrl 37] [tooltip: Resonance Q at VCF corner frequency (0 to 1)] [style: knob]", 0.7, 0, 1, 0.01)); vcfKeyRange = vcf1cbg(vslider("[2] Kbd Ctl [midi:ctrl 38] [tooltip: Keyboard tracking of VCF corner-frequency (0=none, 1=full)] [style: knob]", vcfModEnable = vcf1cbg(vslider("[1] Filter Mod. [midi:ctrl 19] [color:red] [style:knob] [tooltip: Filter Modulation => Route Modulation Mix output to VCF frequency]",1,0,1,1)); vcfContourAmountOctaves = vcf1(vslider("[3] Amount of Contour (octaves) [midi:ctrl 39] [style: knob]", 1.2, 0, 4.0, 0.001)); vcfModulationOctaves = vcfModMixModulationOctaves + vcfContourOctaves; vcfKeyShiftOctaves = vcfKeyRange * keyShiftOctaves; modulatedFcLgHz = fcLgHz + vcfModulationOctaves + vcfKeyShiftOctaves; fc = min((0.5*ma.SR), pow(2.0,modulatedFcLgHz)); vcf = moog_vcf_2bn(res,fc) with { moog_vcf_2bn(res,fr) = fi.tf2snp(0,0,b0,a11,a01,w1) : fi.tf2snp(0,0,b0,a12,a02,w1) with { b0 = s^2; s2k = sqrt(2) * k; a11 = s * (2 + s2k); a12 = s * (2 - s2k); a01 = b0 * (1 + s2k + k^2); a02 = b0 * (1 - s2k + k^2); }; }; attT60VCF = 0.001 * vcf2(vslider("[0] AttackF [midi:ctrl 40] [tooltip: Attack Time] [unit:ms] [style: knob]",1400,10,10000,1)); decT60VCF = 0.001 * vcf2(vslider("[0] DecayF [midi:ctrl 41] [tooltip: Decay-to-Sustain Time] [unit:ms] [style: knob]",10,10,10000,1)); susLvlVCF = vcf2(vslider("[0] SustainF [midi:ctrl 42] [tooltip: Sustain level as percent of max] [style: knob]",80,0,100,0.1)); relT60VCF = select2(decayButton,0.010,decT60VCF); envelopeVCF = en.adsre(attT60VCF,decT60VCF,susLvlVCF,relT60VCF,gate); declare interface "SmartKeyboard{ 'Number of Keyboards':'2', 'Keyboard 0 - Number of Keys':'13', 'Keyboard 1 - Number of Keys':'13', 'Keyboard 0 - Lowest Key':'72', 'Keyboard 1 - Lowest Key':'60' }"; keyDownHold = gg(vslider("[0] gateHold [tooltip: lock sustain pedal on (hold gate set at 1)][style:knob]",0,0,1,1)); keyDown = gg(button("[1] gate [tooltip: The gate signal is 1 during a note and 0 otherwise. For MIDI, NoteOn occurs when the gate transitions from 0 to 1, and NoteOff is an event corresponding to the gate transition from 1 to 0. The name of this Faust button must be 'gate'.]")); sustain = gg(button("[1] sustain [midi:ctrl 64] gate = keyDown + keyDownHold + sustain : min(1); attT60 = 0.001 * ng(vslider("[0] AttackA [midi:ctrl 43] [tooltip: Attack Time] [unit:ms] [style: knob]",2,0,5000,0.1)); decT60 = 0.001 * ng(vslider("[0] DecayA [midi:ctrl 44] [tooltip: Decay-to-Sustain Time] [unit:ms] [style: knob]",10,0,10000,0.1)); susLvl = ng(vslider("[0] SustainA [midi:ctrl 45] [tooltip: Sustain level as percent of max] [style: knob]",80,0,100,0.1)); envelopeAmpNoAM = en.adsre(attT60,decT60,susLvl,relT60,gate); AMDepth = 0.5; envelopeAmp = select2(oscModEnable, envelopeAmpNoAM, envelopeAmpNoAM * (1.0 + AMDepth*modWheel * 0.5 * (1.0+oscNoiseModulation))); ampL = volg(vslider("[1] gain [style:knob] [tooltip: Amplitude]",0.2,0,1.0,0.001)); bend = wg(hslider("[0] bend [style:knob] [midi:pitchwheel]",1,0.001,10,0.01)) : si.polySmooth(gate,0.999,1); modWheel = wg(vslider("[1] mod [midi:ctrl 1] [style:knob] [tooltip: PitchModulation amplitude in octaves]", 0,0,1.0,0.01)) : si.polySmooth(gate,0.999,1); keyFreqBent = bend * kg(hslider("[2] freq [unit:Hz] [style:knob]",220,0.1,20000,0.1)); masterVolume = vg(vslider("MasterVolume [style:knob] [midi:ctrl 7] [tooltip: master volume, MIDI controlled]", 0.7,0,1,0.001)) : si.smooth(ba.tau2pole(0.16)); masterTuneOctaves = dg(vslider("[0] Tune [midi:ctrl 47] [unit:Octaves] [style:knob] [tooltip: Frequency-shift up or down for all oscillators in Octaves]", 0.0,-1.0,1.0,0.001)); glide = gmmg(vslider("[0] Glide [midi:ctrl 5] [unit:sec/octave] [style:knob] [scale:log] [tooltip: Portamento (frequency-glide) in seconds per octave]", 0.008,0.001,1.0,0.001)); keyFreqGlided = keyFreqBent : si.smooth(legatoPole); mmix = gmmg(vslider("[1] Mod. Mix [midi:ctrl 48] [style:knob] [tooltip: Modulation Mix: Osc3 (0) to Noise (1)]", 0.0,0.0,1.0,0.001)); osc3Control = dsg(vslider("[1] Osc. 3 Ctl [midi:ctrl 9] [color:red] [style:knob] [tooltip:Oscillator 3 frequency tracks the keyboard if on, else not",0,0,1,1):int);
a62bfe3072a638d558460efac992b41f05a8c2ef0dffdb35b414ecbb77c305d9
moforte/sam-faust
virtualAnalogWithEffectsForBrowser.dsp
import("stdfaust.lib"); // These are now in a separate file ./effects.dsp // echo = echog(component("echo.dsp")); // ./echo.dsp // flanger = flg(component("flanger.dsp")); // ./flanger.dsp // chorus = chg(component("chorus.dsp")); // ./chorus.dsp // reverb = rg(component("freeverb.dsp")); process = main <: _,_; // Now separate: : echo : flanger : chorus : reverb; main = (signal + attach(extInput,amp) : filters : *(ampScaling)) ~ _; signal = oscs + noise * noiseOff * namp; ampScaling = envelopeAmp * masterVolume; // masterVolume is redundant but easier to find oscs = par(i,3,(oscamp(i+1)*osc(i+1))) :> _; controlSelect(1) = osc1(vrockerred); // ("[0] use as LFO")); octaveSelect(1) = osc1(vslider("[1] Octave1 [midi:ctrl 23] [style:knob]",1,0,5,1):int); // LO, 32', 16', 8', 4', 2' // Osc1 detunes like Osc2 and Osc3 (unlike in the Minimoog where it would be an expensive extra knob): detuneOctaves(1) = osc1(vslider("[2] DeTuning1 [units:Octaves] [midi:ctrl 24] [style:knob]",0.0,-1.0,1.0,0.001)); waveSelect(1) = osc1(vslider("[3] Waveform1 [midi:ctrl 25] [style:knob]",5,0,5,1):int); amp1Enable = mr1(vslider("[1] On [midi:ctrl 12] [style:knob] [color:blue]",1,0,1,1)); oscamp(1) = mr1(vslider("[0] Osc1 Amp [midi:ctrl 26] [style:knob]",0.5,0.0,1.0,0.001)) * amp1Enable; eei = mr2(vslider("[1] On [midi:ctrl 13] [style:knob] [color:blue]",0,0,1,1)); // External input = MAIN OUTPUT when "off" sei = mr2(vslider("[0] Ext Input [midi:ctrl 27] [style: knob]",0,0,1.0,0.001)); extInput(fb,extSig) = fb,extSig : select2(eei) : *(sei) : extClipLED; extClipLED = _ <: _, (abs : >(0.95) : mr2(vbargraph("[2] Ext Input Clip [style:led]",0,1)):!); keycLED = attach(mr2(vbargraph("[3] Keyboard Ctl [style:led]",0,1))); controlSelect(2) = osc2(vrockerred); // ("[0] use as LFO")); octaveSelect(2) = osc2(vslider("[1] Octave2 [midi:ctrl 28] [style:knob]",1,0,5,1):int); // LO, 32', 16', 8', 4', 2' detuneOctaves(2) = osc2(vslider("[2] DeTuning2 [units:Octaves] [midi:ctrl 29] [style:knob]",0.41667,-1.0,1.0,0.001)); waveSelect(2) = osc2(vslider("[3] Waveform2 [midi:ctrl 30] [style:knob]",5,0,5,1):int); amp2Enable = mr3(vslider("[1] On [midi:ctrl 14] [style:knob] [color:blue]",1,0,1,1)); oscamp(2) = mr3(vslider("[0] Osc2 Amp [midi:ctrl 31] [style:knob]",0.5,0.0,1.0,0.001)) * amp2Enable; noise = select2(ntype,no.noise,10.0*no.pink_noise); // pink noise needs some "make-up gain" namp = mr4(vslider("[0] Noise Amp [midi:ctrl 32] [style: knob]",0.0,0.0,1.0,0.001)); noiseOff = mr4cbg(vslider("[0] On [midi:ctrl 15] [style:knob] [color:blue]",0,0,1,1)); ntype = mr4cbg(vslider("[1] White/Pink [midi:ctrl 16] [tooltip: Choose either White or Pink Noise] [style: knob] [color:blue]",1,0,1,1)); controlSelect(3) = osc3(vrockerred); // ("[0] use as LFO")); octaveSelect(3) = osc3(vslider("[1] Octave3 [midi:ctrl 33] [style:knob]",0,0,5,1):int); // LO, 32', 16', 8', 4', 2' detuneOctaves(3) = osc3(vslider("[2] DeTuning3 [units:Octaves] [midi:ctrl 34] [style:knob]",0.3,-1.0,1.0,0.001)); waveSelect(3) = osc3(vslider("[3] Waveform3 [midi:ctrl 35] [style:knob]",0,0,5,1):int); amp3Enable = mr5(vslider("[1] On [midi:ctrl 17] [style:knob] [color:blue]",0,0,1,1)); oscamp(3) = mr5(vslider("[0] Osc3 Amp [midi:ctrl 36] [style:knob]",0.5,0.0,1.0,0.001)) * amp3Enable; waveforms(i) = (tri(i), bent(i), saw(i), sq(i), ptm(i), ptn(i)); // compute oscillator frequency scale factor, staying in lg(Hz) as much as possible: modWheelShift = 1.5*modWheel; // Manual says 0 to 1.5 octaves modulationCenterShift = 0; // Leave this off until triangle-wave modulation is debugged modulationShift = select2(oscModEnable, 0.0, modWheelShift * ( modulationCenterShift + (1.0-modulationCenterShift) * oscNoiseModulation )); octaveShift(i) = -2+int(octaveSelect(i)); osc3FixedFreq = 369.994; // F# a tritone above middle C keyFreqGlidedMaybe = select2(osc3Control,osc3FixedFreq,keyFreqGlided); keyFreqModulatedShifted(3) = keyFreqGlidedMaybe; // osc3 not allowed to FM itself keyFreqModulatedShifted(i) = keyFreqGlided * pow(2.0, modulationShift); // i=1,2 // When disconnected from the keyboard, Osc3 can detune 3 octaves up or down (Pat video): detuneBoost(3) = select2(osc3Control,3.0,1.0); detuneBoost(i) = 1.0; // i=1,2 detuneOctavesFinal(i) = detuneOctaves(i)*detuneBoost(i); fBase(i) = keyFreqModulatedShifted(i) * pow(2.0, (masterTuneOctaves+octaveShift(i)+detuneOctavesFinal(i))) : si.smooth(ba.tau2pole(0.016)); fLFOBase(i) = 3.0 * pow(2.0, detuneOctavesFinal(i)); // used when osc3 (only) is in LFO mode lfoMode(i) = (octaveSelect(i) == 0); f(i) = select2(lfoMode(i), fBase(i), fLFOBase(i)); // lowest range setting is LFO mode for any osc // i is 1-based: osc(i) = ba.selectn(6, int(waveSelect(i)), tri(i), bent(i), saw(i), sq(i), ptm(i), ptn(i)); tri(i) = select2(lfoMode(i), os.triangle(f(i)), os.lf_triangle(f(i))); bent(i) = 0.5*tri(i) + 0.5*saw(i); // from Minimoog manual saw(i) = select2(lfoMode(i), os.sawtooth(f(i)), os.lf_saw(f(i))); sq(i) = select2(lfoMode(i), os.square(f(i)), os.lf_squarewave(f(i))); ptm(i) = select2(lfoMode(i), // Note: a Duty knob would be better than these two, or in addition os.pulsetrain(f(i),0.25), lf_pulsetrain(f(i),0.25)); ptn(i) = select2(lfoMode(i), os.pulsetrain(f(i),0.125), lf_pulsetrain(f(i),0.125)); // Soon to appear in oscillators.lib: lf_pulsetrain(freq,duty) = 2.0*os.lf_pulsetrainpos(freq,duty) - 1.0; filters = ba.bypass1(bp,vcf); // BYPASS WILL GO AWAY (I think you just open it up all the way to bypass): bp = 0; // VCF is always on fcLgHz = vcf1(vslider("[1] Corner Freq [unit:Log2(Hz)] [tooltip: Corner resonance frequency in Log2(Hertz)] [style: knob] [midi:ctrl 74]", // Frequency Cutoff (aka Brightness ) 10.6, log(40.0)/log(2), log(20000.0)/log(2), 0.000001)) // 9 octaves (from Minimoog manual) //p: 40, 30, 80, 0.01)) //p: : ba.pianokey2hz : si.smooth(ba.tau2pole(0.016)); res = vcf1(vslider("[2] Corner Resonance [midi:ctrl 37] [tooltip: Resonance Q at VCF corner frequency (0 to 1)] [style: knob]", 0.7, 0, 1, 0.01)); vcfKeyRange = vcf1cbg(vslider("[2] Kbd Ctl [midi:ctrl 38] [tooltip: Keyboard tracking of VCF corner-frequency (0=none, 1=full)] [style: knob]", 1, 0, 1, 0.001)); // was in mr2 vcfModEnable = vcf1cbg(vslider("[1] Filter Mod. [midi:ctrl 19] [color:red] [style:knob] [tooltip: Filter Modulation => Route Modulation Mix output to VCF frequency]",1,0,1,1)); // Note that VCF has three sources of corner-frequency setting that are added together: // - Corner Freq knob (40 Hz to 20 kHz) // - VCF Contour envelope (0 to 4 octaves) // - Injection 32 of Modulation Mix (0 to 1.5 octaves) // Manual says maximum vcf sweep spans 0 to 4 octaves: // Original Knob went to 10, but we're going to 4 so we can say the knob is in "octaves" units: vcfContourAmountOctaves = vcf1(vslider("[3] Amount of Contour (octaves) [midi:ctrl 39] [style: knob]", 1.2, 0, 4.0, 0.001)); vcfContourOctaves = vcfContourAmountOctaves * envelopeVCF; // in octaves // We are assuming that the modulation-mix range for the VCF freq is 1.5 octaves like it is for oscs 1 and 2: vcfModMixModulationOctaves = select2(vcfModEnable, 0, (1.5 * oscNoiseModulation * modWheel)); // octaves vcfModulationOctaves = vcfModMixModulationOctaves + vcfContourOctaves; keyFreqLogHzGlided = log(keyFreqGlided)/log(2.0); // FIXME: Start w freqLogHz not freq so we don't need exp(log()) here keyShiftOctaves = keyFreqLogHzGlided - log(261.625565)/log(2.0); // FIXME: ARBITRARILY centering on middle C - check device vcfKeyShiftOctaves = vcfKeyRange * keyShiftOctaves; modulatedFcLgHz = fcLgHz + vcfModulationOctaves + vcfKeyShiftOctaves; fc = min((0.5*ma.SR), pow(2.0,modulatedFcLgHz)); vcf = moog_vcf_2bn(res,fc) with { moog_vcf_2bn(res,fr) = fi.tf2snp(0,0,b0,a11,a01,w1) : fi.tf2snp(0,0,b0,a12,a02,w1) with { s = 1; // minus the open-loop location of all four poles w1 = 2*ma.PI*max(fr,20); // frequency-scaling parameter for bilinear xform k = sqrt(2)*0.99999*res; // fourth root of Moog VCF feedback gain b0 = s^2; s2k = sqrt(2) * k; a11 = s * (2 + s2k); a12 = s * (2 - s2k); a01 = b0 * (1 + s2k + k^2); a02 = b0 * (1 - s2k + k^2); }; }; // Attack, Decay, and Sustain ranges are set according to the Minimoog manual: attT60VCF = 0.001 * vcf2(vslider("[0] AttackF [midi:ctrl 40] [tooltip: Attack Time] [unit:ms] [style: knob]",1400,10,10000,1)); decT60VCF = 0.001 * vcf2(vslider("[0] DecayF [midi:ctrl 41] [tooltip: Decay-to-Sustain Time] [unit:ms] [style: knob]",10,10,10000,1)); susLvlVCF = vcf2(vslider("[0] SustainF [midi:ctrl 42] [tooltip: Sustain level as percent of max] [style: knob]",80,0,100,0.1)); decayButton = wg(vslider("Decay [midi:ctrl 20] [tooltip:Envelope Release either Decay value or 0][style:knob]",1,0,1,1):int); // was Staccato legatoButton = wg(vslider("Glide [midi:ctrl 65] [tooltip: Glide from note to note][style:knob]",1,0,1,1)); // was Legato relT60VCF = select2(decayButton,0.010,decT60VCF); envelopeVCF = en.adsre(attT60VCF,decT60VCF,susLvlVCF,relT60VCF,gate); // --- Smart Keyboard interface --- declare interface "SmartKeyboard{ 'Number of Keyboards':'2', 'Keyboard 0 - Number of Keys':'13', 'Keyboard 1 - Number of Keys':'13', 'Keyboard 0 - Lowest Key':'72', 'Keyboard 1 - Lowest Key':'60' }"; // --- functions --- // Signal controls: keyDownHold = gg(vslider("[0] gateHold [tooltip: lock sustain pedal on (hold gate set at 1)][style:knob]",0,0,1,1)); keyDown = gg(button("[1] gate [tooltip: The gate signal is 1 during a note and 0 otherwise. For MIDI, NoteOn occurs when the gate transitions from 0 to 1, and NoteOff is an event corresponding to the gate transition from 1 to 0. The name of this Faust button must be 'gate'.]")); sustain = gg(button("[1] sustain [midi:ctrl 64] [tooltip: extends the gate (keeps it set to 1)]")); // MIDI only (see smartkeyb doc) gate = keyDown + keyDownHold + sustain : min(1); attT60 = 0.001 * ng(vslider("[0] AttackA [midi:ctrl 43] [tooltip: Attack Time] [unit:ms] [style: knob]",2,0,5000,0.1)); decT60 = 0.001 * ng(vslider("[0] DecayA [midi:ctrl 44] [tooltip: Decay-to-Sustain Time] [unit:ms] [style: knob]",10,0,10000,0.1)); susLvl = ng(vslider("[0] SustainA [midi:ctrl 45] [tooltip: Sustain level as percent of max] [style: knob]",80,0,100,0.1)); relT60 = select2(decayButton,0.010,decT60); // right? envelopeAmpNoAM = en.adsre(attT60,decT60,susLvl,relT60,gate); AMDepth = 0.5; envelopeAmp = select2(oscModEnable, envelopeAmpNoAM, envelopeAmpNoAM * (1.0 + AMDepth*modWheel * 0.5 * (1.0+oscNoiseModulation))); // Signal Parameters ampL = volg(vslider("[1] gain [style:knob] [tooltip: Amplitude]",0.2,0,1.0,0.001)); amp = ampL : si.smoo; // envelopeAmp is multiplied once on entire signal sum //elecGuitar.dsp values used: bend = wg(hslider("[0] bend [style:knob] [midi:pitchwheel]",1,0.001,10,0.01)) : si.polySmooth(gate,0.999,1); //Previous guess: modWheel = wg(vslider("[1] mod [midi:ctrl 1] [style:knob] [tooltip: PitchModulation amplitude in octaves]", 0,0,1.0,0.01)) : si.polySmooth(gate,0.999,1); //p: MIDI requires frequency in Hz, not piano-keys as we had before // Frequency Range is 0.1 Hz to 20 kHz according to the Minimoog manual: // MIDI REQUIRES THE FOLLOWING PARAMETER TO BE NAMED 'freq': keyFreqBent = bend * kg(hslider("[2] freq [unit:Hz] [style:knob]",220,0.1,20000,0.1)); masterVolume = vg(vslider("MasterVolume [style:knob] [midi:ctrl 7] [tooltip: master volume, MIDI controlled]", 0.7,0,1,0.001)) : si.smooth(ba.tau2pole(0.16)); masterTuneOctaves = dg(vslider("[0] Tune [midi:ctrl 47] [unit:Octaves] [style:knob] [tooltip: Frequency-shift up or down for all oscillators in Octaves]", 0.0,-1.0,1.0,0.001)); // Oscillator Modulation HrockerRed => apply Modulation Mix output osc1&2 pitches glide = gmmg(vslider("[0] Glide [midi:ctrl 5] [unit:sec/octave] [style:knob] [scale:log] [tooltip: Portamento (frequency-glide) in seconds per octave]", 0.008,0.001,1.0,0.001)); legatoPole = select2(legatoButton,0.5,ba.tau2pole(glide*exp(1.0f)/2.0f)); // convert 1/e to 1/2 by slowing down exp keyFreqGlided = keyFreqBent : si.smooth(legatoPole); mmix = gmmg(vslider("[1] Mod. Mix [midi:ctrl 48] [style:knob] [tooltip: Modulation Mix: Osc3 (0) to Noise (1)]", 0.0,0.0,1.0,0.001)); oscNoiseModulation = (mmix * noise) + ((1.0-mmix) * osc(3)); // noise amplitude and off-switch ignored here oscModEnable = dsg(vslider("[0] Osc. Mod. [midi:ctrl 22] [color:red] [style:knob] [tooltip:Oscillator Modulation adds Modulation Mix output to osc1&2 frequencies",1,0,1,1)); // any offset? osc3Control = dsg(vslider("[1] Osc. 3 Ctl [midi:ctrl 9] [color:red] [style:knob] [tooltip:Oscillator 3 frequency tracks the keyboard if on, else not",0,0,1,1):int); effect = _,_ : + : component_echo : component_flanger : component_chorus : component_freeverb; component_echo = environment { echo_group(x) = x; // Let layout2.dsp lay us out knobs_group(x) = ekg(x); switches_group(x) = esg(x); dmax = 32768; // one and done dmaxs = float(dmax)/44100.0; Nnines = 1.8; // Increase until you get the desired maximum amount of smoothing when fbs==1 //fastpow2 = ffunction(float fastpow2(float), "fast_pow2.h", ""); fbspr(fbs) = 1.0 - pow(2.0, -3.33219*Nnines*fbs); // pole radius of feedback smoother inputSelect(gi) = _,0 : select2(gi); echo_mono(dmax,curdel,tapdel,fb,fbspr,gi) = inputSelect(gi) : (+:si.smooth(fbspr) <: de.fdelay(dmax,curdel), de.fdelay(dmax,tapdel)) ~(*(fb),!) : !,_; tau2pole(tau) = ba.if(tau>0, exp(-1.0/(tau*ma.SR)), 0.0); t60smoother(dEchoT60) = si.smooth(tau2pole(dEchoT60/6.91)); dEchoT60 = knobs_group(vslider("[1] DelayT60 [midi:ctrl 60] [style:knob]", 0.5, 0, 100, 0.001)); dEchoSamplesRaw = knobs_group(vslider("[0] Delay [midi:ctrl 61] [style:knob]", 0.5, 0.001, (dmaxs-0.001), 0.001)) * ma.SR; dEchoSamples = dEchoSamplesRaw : t60smoother(dEchoT60); warpRaw = knobs_group(vslider("[0] Warp [midi:ctrl 62] [style:knob]", 0, -1.0, 1.0, 0.001)); scrubAmpRaw = 0; scrubPhaseRaw = 0; fb = knobs_group(vslider("[2] Feedback [midi:ctrl 2] [style:knob]", .3, 0.0, 1.0, 0.0001)); amp = knobs_group(vslider("[3] Amp [midi:ctrl 75] [style:knob]", .5, 0, 1, 0.001)) : si.smooth(ba.tau2pole(ampT60/6.91)); ampT60 = 0.15661; fbs = knobs_group(vslider("[5] [midi:ctrl 76] FeedbackSm [style:knob]", 0, 0, 1, 0.00001)); gi = switches_group(1-vslider("[7] [midi:ctrl 105] EnableEcho[style:knob]",0,0,1,1)); // "ground input" switches input to zeros // Warp and Scrubber stuff: enableEcho = (scrubAmpRaw > 0.00001); triggerScrubOn = (enableEcho - enableEcho') > 0; // enableEcho went 0 to 1 triggerScrubOff = (enableEcho - enableEcho') < 0; // enableEcho went 1 to 0 // Ramps up only during scrub "hold" time and is otherwise zero: counter = (enableEcho * (triggerScrubOn : + ~ +(1) * enableEcho : -(2))) & (dmax-1); // implementation that continues scrubbing where it left off: scrubPhase = scrubPhaseRaw : t60smoother(dEchoT60*(1-triggerScrubOff)); scrubAmp = scrubAmpRaw : t60smoother(dEchoT60*(1-triggerScrubOff)); warp = warpRaw : t60smoother(dEchoT60); dTapSamplesRaw = dEchoSamplesRaw * (1.0 + warp + scrubPhase * scrubAmp) + float(counter); dTapSamples = dTapSamplesRaw : t60smoother(dEchoT60*(1-triggerScrubOff)); echo_process = _ <: _, amp * echo_mono(dmax,dEchoSamples,dTapSamples,fb,fbspr(fbs),gi) : +; }.echo_process; component_flanger = environment { // Created from flange.dsp 2015/06/21 flanger_mono(dmax,curdel,depth,fb,invert,lfoshape) = _ <: _, (-:de.fdelay(dmax,curdel)) ~ *(fb) : _, *(select2(invert,depth,0-depth)) : + : *(1/(1+depth)); // ideal for dc and reinforced sinusoids (in-phase summed signals) flanger_process = ba.bypass1(fbp,flanger_mono_gui); // Kill the groups to save vertical space: meter_group(x) = flsg(x); ctl_group(x) = flkg(x); del_group(x) = flkg(x); lvl_group(x) = flkf(x); flangeview = lfo(freq); flanger_mono_gui = attach(flangeview) : flanger_mono(dmax,curdel,depth,fb,invert,lfoshape); sinlfo(freq) = (1 + os.oscrs(freq))/2; trilfo(freq) = 1.0-abs(os.saw1(freq)); lfo(f) = (lfoshape * trilfo(f)) + ((1-lfoshape) * sinlfo(f)); dmax = 2048; odflange = 44; // ~1 ms at 44.1 kHz = min delay dflange = ((dmax-1)-odflange)*del_group(vslider("[1] Delay [midi:ctrl 50][style:knob]", 0.22, 0, 1, 1)); freq = ctl_group(vslider("[1] Rate [midi:ctrl 51] [unit:Hz] [style:knob]", 0.5, 0, 10, 0.01)) : si.smooth(ba.tau2pole(freqT60/6.91)); freqT60 = 0.15661; depth = ctl_group(vslider("[3] Depth [midi:ctrl 52] [style:knob]", .75, 0, 1, 0.001)) : si.smooth(ba.tau2pole(depthT60/6.91)); depthT60 = 0.15661; fb = ctl_group(vslider("[5] Feedback [midi:ctrl 53] [style:knob]", 0, -0.995, 0.99, 0.001)) : si.smooth(ba.tau2pole(fbT60/6.91)); fbT60 = 0.15661; lfoshape = ctl_group(vslider("[7] Waveshape [midi:ctrl 54] [style:knob]", 0, 0, 1, 0.001)); curdel = odflange+dflange*lfo(freq); fbp = 1-int(flsg(vslider("[0] Enable [midi:ctrl 102][style:knob]",0,0,1,1))); invert = flsg(vslider("[1] Invert [midi:ctrl 49][style:knob]",0,0,1,1):int); }.flanger_process; component_chorus = environment { voices = 8; // MUST BE EVEN chorus_process = bypass1to2(cbp,chorus_mono(dmax,curdel,rate,sigma,do2,voices)); // to become ba.bypass1to2 in Faust's basics.lib: bypass1to2(bpc,e) = _ <: ((inswitch:e),_,_) : ba.select2stereo(bpc) with {inswitch = select2(bpc,_,0);}; ml = library("music.lib"); // /l/fdlo/music.lib fl = library("filter.lib"); el = library("effect.lib"); // /l/fdlo/effect.lib ol = library("oscillator.lib"); // /l/fdlo/oscillator.lib //wo = library("waveoscs.dsp"); //pi = 4.0*atan(1.0); oscs(freq) = rdtable(tablesize, sinwaveform, int(ml.phase(freq)) ); oscc(freq) = rdtable(tablesize, coswaveform, int(ml.phase(freq)) ); oscp(freq,p) = oscs(freq) * cos(p) + oscc(freq) * sin(p); // osc = oscs; // music.lib sinwaveform = float(ml.time)*(2.0*pi)/float(tablesize) : sin; coswaveform = float(ml.time)*(2.0*pi)/float(tablesize) : cos; tablesize = 1 << 16; pi = 4.0*atan(1.0); dmax = 8192; curdel = dmax * ckg(vslider("[0] Delay [midi:ctrl 55] [style:knob]", 0.5, 0, 1, 1)) : fl.smooth(0.999); rateMax = 7.0; // Hz rateMin = 0.01; rateT60 = 0.15661; rate = ckg(vslider("[1] Rate [midi:ctrl 56] [unit:Hz] [style:knob]", 0.5, rateMin, rateMax, 0.0001)) : fl.smooth(fl.tau2pole(rateT60/6.91)); depth = ckg(vslider("[4] Depth [midi:ctrl 57] [style:knob]", 0.5, 0, 1, 0.001)) : fl.smooth(fl.tau2pole(depthT60/6.91)); depthT60 = 0.15661; delayPerVoice = 0.5*curdel/voices; sigma = delayPerVoice * ckg(vslider("[6] Deviation [midi:ctrl 58] [style:knob]",0.5,0,1,0.001)) : fl.smooth(0.999); periodic = 1; do2 = depth; // use when depth=1 means "multivibrato" effect (no original => all are modulated) cbp = 1-int(csg(vslider("[0] Enable [midi:ctrl 103][style:knob]",0,0,1,1))); chorus_mono(dmax,curdel,rate,sigma,do2,voices) = _ <: (*(1-do2)<:_,_),(*(do2) <: par(i,voices,voice(i)) :> _,_) : ml.interleave(2,2) : +,+ with { angle(i) = 2*pi*(i/2)/voices + (i%2)*pi/2; voice(i) = ml.fdelay(dmax,min(dmax,del(i))) * cos(angle(i)); del(i) = curdel*(i+1)/voices + dev(i); rates(i) = rate/float(i+1); dev(i) = sigma * oscp(rates(i),i*2*pi/voices); }; chorus_stereo(dmax,curdel,rate,sigma,do2,voices) = _,_ <: *(1-do2),*(1-do2),(*(do2),*(do2) <: par(i,voices,voice(i)):>_,_) : ml.interleave(2,2) : +,+; voice(i) = ml.fdelay(dmax,min(dmax,del(i)))/(i+1) with { angle(i) = 2*pi*(i/2)/voices + (i%2)*pi/2; voice(i) = ml.fdelay(dmax,min(dmax,del(i))) * cos(angle(i)); del(i) = curdel*(i+1)/voices + dev(i); rates(i) = rate/float(i+1); dev(i) = sigma * oscp(rates(i),i*2*pi/voices); }; }.chorus_process; component_freeverb = environment { import("stdfaust.lib"); declare name "freeverb"; declare version "1.0"; declare author "Grame"; declare license "BSD"; declare copyright "(c) GRAME 2006 and MoForte Inc. 2017"; declare reference "https://ccrma.stanford.edu/~jos/pasp/Freeverb.html"; //====================================================== // // Freeverb // Faster version using fixed delays (20% gain) // //====================================================== // Constant Parameters //-------------------- fixedgain = 0.015; //value of the gain of fxctrl scalewet = 3.0; scaledry = 2.0; scaledamp = 0.4; scaleroom = 0.28; offsetroom = 0.7; initialroom = 0.5; initialdamp = 0.5; initialwet = 1.0/scalewet; initialdry = 0; initialwidth= 1.0; initialmode = 0.0; freezemode = 0.5; stereospread= 23; allpassfeed = 0.5; //feedback of the delays used in allpass filters // Filter Parameters //------------------ combtuningL1 = 1116; combtuningL2 = 1188; combtuningL3 = 1277; combtuningL4 = 1356; combtuningL5 = 1422; combtuningL6 = 1491; combtuningL7 = 1557; combtuningL8 = 1617; allpasstuningL1 = 556; allpasstuningL2 = 441; allpasstuningL3 = 341; allpasstuningL4 = 225; // Control Sliders //-------------------- // Damp : filters the high frequencies of the echoes (especially active for great values of RoomSize) // RoomSize : size of the reverberation room // Dry : original signal // Wet : reverberated signal dampSlider = rkg(vslider("Damp [midi:ctrl 3] [style:knob]",0.5, 0, 1, 0.025))*scaledamp; roomsizeSlider = rkg(vslider("RoomSize [midi:ctrl 4] [style:knob]", 0.5, 0, 1, 0.025))*scaleroom + offsetroom; wetSlider = rkg(vslider("Wet [midi:ctrl 79] [style:knob]", 0.3333, 0, 1, 0.025)); combfeed = roomsizeSlider; // Comb and Allpass filters //------------------------- allpass(dt,fb) = (_,_ <: (*(fb),_:+:@(dt)), -) ~ _ : (!,_); comb(dt, fb, damp) = (+:@(dt)) ~ (*(1-damp) : (+ ~ *(damp)) : *(fb)); // Reverb components //------------------ monoReverb(fb1, fb2, damp, spread) = _ <: comb(combtuningL1+spread, fb1, damp), comb(combtuningL2+spread, fb1, damp), comb(combtuningL3+spread, fb1, damp), comb(combtuningL4+spread, fb1, damp), comb(combtuningL5+spread, fb1, damp), comb(combtuningL6+spread, fb1, damp), comb(combtuningL7+spread, fb1, damp), comb(combtuningL8+spread, fb1, damp) +> allpass (allpasstuningL1+spread, fb2) : allpass (allpasstuningL2+spread, fb2) : allpass (allpasstuningL3+spread, fb2) : allpass (allpasstuningL4+spread, fb2) ; monoReverbToStereo(fb1, fb2, damp, spread) = + <: monoReverb(fb1, fb2, damp, 0) <: _,_; stereoReverb(fb1, fb2, damp, spread) = + <: monoReverb(fb1, fb2, damp, 0), monoReverb(fb1, fb2, damp, spread); monoToStereoReverb(fb1, fb2, damp, spread) = _ <: monoReverb(fb1, fb2, damp, 0), monoReverb(fb1, fb2, damp, spread); // fxctrl : add an input gain and a wet-dry control to a stereo FX //---------------------------------------------------------------- fxctrl(g,w,Fx) = _,_ <: (*(g),*(g) : Fx : *(w),*(w)), *(1-w), *(1-w) +> _,_; rbp = 1-int(rsg(vslider("[0] Enable [midi:ctrl 104][style:knob]",0,0,1,1))); // Freeverb //--------- //JOS:freeverb = fxctrl(fixedgain, wetSlider, stereoReverb(combfeed, allpassfeed, dampSlider, stereospread)); freeverb = fxctrl(fixedgain, wetSlider, monoReverbToStereo(combfeed, allpassfeed, dampSlider, stereospread)); freeverb_process = ba.bypass2(rbp,freeverb); }.freeverb_process; // This layout loosely follows the MiniMoog-V // Arturia-only features are labeled // Original versions also added where different // Need vrocker and hrocker toggle switches in Faust! // Need orange and blue color choices // Orange => Connect modulation sources to their destinations // Blue => Turn audio sources On and Off // - and later - // White => Turn performance features On and Off // Black => Select between modulation sources // Julius Smith for Analog Devices 3/1/2017 vrocker(x) = checkbox("%%x [style:vrocker]"); hrocker(x) = checkbox("%%x [style:hrocker]"); vrockerblue(x) = checkbox("%x [style:vrocker] [color:blue]"); vrockerblue(x) = checkbox("%x [style:vrocker] [color:blue]"); // USAGE: vrockerorange("[0] ModulationEnable"); hrockerblue(x) = checkbox("%%x [style:hrocker] [color:blue]"); vrockerred(x) = checkbox("%%x [style:vrocker] [color:red]"); hrockerred(x) = checkbox("%%x [style:hrocker] [color:red]"); declare designer "Robert A. Moog"; mmg(x) = hgroup("",x); // Minimoog + Effects synthg(x) = mmg(vgroup("[0] Minimoog",x)); fxg(x) = mmg(hgroup("[1] Effects",x)); mg(x) = synthg(hgroup("[0]",x)); cg(x) = mg(vgroup("[0] Controllers",x)); // Formerly named "Modules" but "Minimoog" group-title is enough vg(x) = cg(hgroup("[0] Master Volume", x)); dg(x) = cg(hgroup("[1] Oscillator Tuning & Switching", x)); // Tune knob = master tune dsg(x) = dg(vgroup("[1] Switches", x)); // Oscillator Modulation HrockerRed => apply Modulation Mix output to osc1&2 pitches // [MOVED here from osc3 group] Osc 3 Control VrockerRed => use osc3 as LFO instead of osc3 gmmg(x) = cg(hgroup("[2] Glide and ModMix", x)); // Glide knob [0:10] = portamento speed // Modulation Mix knob [0:10] (between Osc3 and Noise) = mix of noise and osc3 modulating osc1&2 pitch and/or VCF freq og(x) = mg(vgroup("[1] Oscillator Bank", x)); osc1(x) = og(hgroup("[1] Oscillator 1", x)); // UNUSED Control switch (for alignment) - Could put Oscillator Modulation switch there // Range rotary switch: LO (slow pulses or rhythm), 32', 16', 8', 4', 2' // Frequency <something> switch: LED to right // Waveform rotary switch: tri, impulse/bent-triangle, saw, pulseWide, pulseMed, pulseNarrow osc2(x) = og(hgroup("[2] Oscillator 2", x)); // UNUSED (originall) or Osc 2 Control VrockerRed // Range rotary switch: LO, 32', 16', 8', 4', 2' // Detuning knob: -7 to 7 [NO SWITCH] // Waveform rotary switch: tri, impulse(?), saw, pulseWide, pulseMed, pulseNarrow osc3(x) = og(hgroup("[3] Oscillator 3", x)); // Osc 3 Control VrockerRed => use osc3 as LFO instead of osc3 // Range rotary switch: LO, 32', 16', 8', 4', 2' // Detuning knob: -7 to 7 [NO SWITCH] // Waveform rotary switch: tri, impulse(?), saw, pulseWide, pulseMed, pulseNarrow mixg(x) = mg(vgroup("[2] Mixer", x)); // Each row 5 slots to maintain alignment and include red rockers joining VCF area: mr1(x) = mixg(hgroup("[0] Osc1", x)); // mixer row 1 = // Osc1 Volume and Osc1 HrockerBlue & _ & _ & Filter Modulation HrockerRed // Filter Modulation => Modulation Mix output to VCF freq mr2(x) = mixg(hgroup("[1] Ext In, KeyCtl", x)); // row 2 = Ext In HrockerBlue and Vol and Overload LED and Keyboard Ctl HrockerRed 1 mr3(x) = mixg(hgroup("[2] Osc2", x)); // = Osc2 Volume and Osc2 HrockerBlue and Keyboard Ctl HrockerRed 2 // Keyboard Control Modulation 1&2 => 0, 1/3, 2/3, all of Keyboard Control Signal ("gate?") applied to VCF freq mr4(x) = mixg(hgroup("[3] Noise", x)); // = Noise HrockerBlue and Volume and Noise Type VrockerBlue mr4cbg(x) = mr4(vgroup("[1]", x)); // = Noise Off and White/Pink selection // two rockers mr5(x) = mixg(hgroup("[4] Osc3", x)); // Osc3 Volume and Osc3 HrockerBlue modg(x) = mg(vgroup("[3] Modifiers", x)); vcfg(x) = modg(vgroup("[0] Filter", x)); vcf1(x) = vcfg(hgroup("[0] [tooltip:freq, Q, ContourScale]", x)); vcf1cbg(x) = vcf1(vgroup("[0] [tooltip:two checkboxes]", x)); // Filter Modulation switch // VCF Off switch // Corner Frequency knob // Filter Emphasis knob // Amount of Contour knob vcf2(x) = vcfg(hgroup("[1] Filter Contour [tooltip:AttFilt, DecFilt, Sustain Level for Filter Contour]", x)); // Attack Time knob // Decay Time knob // Sustain Level knob ng(x) = modg(hgroup("[1] Loudness Contour", x)); // Attack Time knob // Decay Time knob // Sustain Level knob echog(x) = fxg(hgroup("[4] Echo",x)); ekg(x) = echog(vgroup("[0] Knobs",x)); esg(x) = echog(vgroup("[1] Switches",x)); flg(x) = fxg(hgroup("[5] Flanger",x)); flkg(x) = flg(vgroup("[0] Knobs",x)); flsg(x) = flg(vgroup("[1] Switches",x)); chg(x) = fxg(hgroup("[6] Chorus",x)); ckg(x) = chg(vgroup("[0] Knobs",x)); csg(x) = chg(vgroup("[1] Switches",x)); rg(x) = fxg(hgroup("[7] Reverb",x)); rkg(x) = rg(vgroup("[0] Knobs",x)); rsg(x) = rg(vgroup("[1] Switches",x)); outg(x) = fxg(vgroup("[8] Output", x)); volg(x) = outg(hgroup("[0] Volume Main Output", x)); // Volume knob [0-10] // Unison switch (Arturia) or Output connect/disconnect switch (original) // When set, all voices are stacked and instrument is in mono mode tunerg(x) = outg(hgroup("[1] A-440 Switch", x)); vdtpolyg(x) = outg(hgroup("[2] Voice Detune / Poly", x)); // Voice Detune knob [0-10] (Arturia) or // Polyphonic switch [red LED below] (Arturia) // When set, instrument is in polyphonic mode with one oscillator per key clipg(x) = fxg(vgroup("[9] Soft Clip", x)); // Soft Clipping switch [red LED above] kg(x) = synthg(hgroup("[1] Keyboard Group", x)); // Keyboard was 3 1/2 octaves ws(x) = kg(vgroup("[0] Wheels and Switches", x)); s1g(x) = ws(hgroup("[0] Jacks and Rockers", x)); jg(x) = s1g(vgroup("[0] MiniJacks",x)); gdlg(x) = s1g(vgroup("[1] Glide/Decay/Legato Enables",x)); // Arturia // Glide Hrocker (see original Button version below) // Decay Hrocker (see original Button version below) => Sets Release (R) of ADSR to either 0 or Decay (R) // Legato Hrocker (not in original) s2g(x) = ws(hgroup("[1] [tooltip:Wheels+]", x)); bg(x) = s2g(vgroup("[0] [tooltip:Bend Enable and Range]", x)); wg(x) = s2g(hgroup("[1] [tooltip:Bend and Mod Wheels]", x)); // Using Glide/Decay/Legato enables above following Arturia: // dg(x) = s2g(hgroup("[2] Glide and Decay momentary pushbuttons", x)); // Glide Button injects portamento as set by Glide knob // Decay Button uses decay of Loudness Contour (else 0) keys(x) = kg(hgroup("[1] [tooltip:Keys]", x)); gg(x) = keys(hgroup("[0] [tooltip: Gates]",x)); // leave slot 1 open for sustain (below)
https://raw.githubusercontent.com/moforte/sam-faust/85be03f262e384c1befa9eaac237e052040b2cc1/faust-examples/virtualAnalog/virtualAnalogWithEffectsForBrowser.dsp
faust
These are now in a separate file ./effects.dsp echo = echog(component("echo.dsp")); // ./echo.dsp flanger = flg(component("flanger.dsp")); // ./flanger.dsp chorus = chg(component("chorus.dsp")); // ./chorus.dsp reverb = rg(component("freeverb.dsp")); Now separate: : echo : flanger : chorus : reverb; masterVolume is redundant but easier to find ("[0] use as LFO")); LO, 32', 16', 8', 4', 2' Osc1 detunes like Osc2 and Osc3 (unlike in the Minimoog where it would be an expensive extra knob): External input = MAIN OUTPUT when "off" ("[0] use as LFO")); LO, 32', 16', 8', 4', 2' pink noise needs some "make-up gain" ("[0] use as LFO")); LO, 32', 16', 8', 4', 2' compute oscillator frequency scale factor, staying in lg(Hz) as much as possible: Manual says 0 to 1.5 octaves Leave this off until triangle-wave modulation is debugged F# a tritone above middle C osc3 not allowed to FM itself i=1,2 When disconnected from the keyboard, Osc3 can detune 3 octaves up or down (Pat video): i=1,2 used when osc3 (only) is in LFO mode lowest range setting is LFO mode for any osc i is 1-based: from Minimoog manual Note: a Duty knob would be better than these two, or in addition Soon to appear in oscillators.lib: BYPASS WILL GO AWAY (I think you just open it up all the way to bypass): VCF is always on Frequency Cutoff (aka Brightness ) 9 octaves (from Minimoog manual) p: 40, 30, 80, 0.01)) p: : ba.pianokey2hz was in mr2 Note that VCF has three sources of corner-frequency setting that are added together: - Corner Freq knob (40 Hz to 20 kHz) - VCF Contour envelope (0 to 4 octaves) - Injection 32 of Modulation Mix (0 to 1.5 octaves) Manual says maximum vcf sweep spans 0 to 4 octaves: Original Knob went to 10, but we're going to 4 so we can say the knob is in "octaves" units: in octaves We are assuming that the modulation-mix range for the VCF freq is 1.5 octaves like it is for oscs 1 and 2: octaves FIXME: Start w freqLogHz not freq so we don't need exp(log()) here FIXME: ARBITRARILY centering on middle C - check device minus the open-loop location of all four poles frequency-scaling parameter for bilinear xform fourth root of Moog VCF feedback gain Attack, Decay, and Sustain ranges are set according to the Minimoog manual: was Staccato was Legato --- Smart Keyboard interface --- --- functions --- Signal controls: MIDI only (see smartkeyb doc) right? Signal Parameters envelopeAmp is multiplied once on entire signal sum elecGuitar.dsp values used: Previous guess: p: MIDI requires frequency in Hz, not piano-keys as we had before Frequency Range is 0.1 Hz to 20 kHz according to the Minimoog manual: MIDI REQUIRES THE FOLLOWING PARAMETER TO BE NAMED 'freq': Oscillator Modulation HrockerRed => apply Modulation Mix output osc1&2 pitches convert 1/e to 1/2 by slowing down exp noise amplitude and off-switch ignored here any offset? Let layout2.dsp lay us out one and done Increase until you get the desired maximum amount of smoothing when fbs==1 fastpow2 = ffunction(float fastpow2(float), "fast_pow2.h", ""); pole radius of feedback smoother "ground input" switches input to zeros Warp and Scrubber stuff: enableEcho went 0 to 1 enableEcho went 1 to 0 Ramps up only during scrub "hold" time and is otherwise zero: implementation that continues scrubbing where it left off: Created from flange.dsp 2015/06/21 ideal for dc and reinforced sinusoids (in-phase summed signals) Kill the groups to save vertical space: ~1 ms at 44.1 kHz = min delay MUST BE EVEN to become ba.bypass1to2 in Faust's basics.lib: /l/fdlo/music.lib /l/fdlo/effect.lib /l/fdlo/oscillator.lib wo = library("waveoscs.dsp"); pi = 4.0*atan(1.0); osc = oscs; // music.lib Hz use when depth=1 means "multivibrato" effect (no original => all are modulated) ====================================================== Freeverb Faster version using fixed delays (20% gain) ====================================================== Constant Parameters -------------------- value of the gain of fxctrl feedback of the delays used in allpass filters Filter Parameters ------------------ Control Sliders -------------------- Damp : filters the high frequencies of the echoes (especially active for great values of RoomSize) RoomSize : size of the reverberation room Dry : original signal Wet : reverberated signal Comb and Allpass filters ------------------------- Reverb components ------------------ fxctrl : add an input gain and a wet-dry control to a stereo FX ---------------------------------------------------------------- Freeverb --------- JOS:freeverb = fxctrl(fixedgain, wetSlider, stereoReverb(combfeed, allpassfeed, dampSlider, stereospread)); This layout loosely follows the MiniMoog-V Arturia-only features are labeled Original versions also added where different Need vrocker and hrocker toggle switches in Faust! Need orange and blue color choices Orange => Connect modulation sources to their destinations Blue => Turn audio sources On and Off - and later - White => Turn performance features On and Off Black => Select between modulation sources Julius Smith for Analog Devices 3/1/2017 USAGE: vrockerorange("[0] ModulationEnable"); Minimoog + Effects Formerly named "Modules" but "Minimoog" group-title is enough Tune knob = master tune Oscillator Modulation HrockerRed => apply Modulation Mix output to osc1&2 pitches [MOVED here from osc3 group] Osc 3 Control VrockerRed => use osc3 as LFO instead of osc3 Glide knob [0:10] = portamento speed Modulation Mix knob [0:10] (between Osc3 and Noise) = mix of noise and osc3 modulating osc1&2 pitch and/or VCF freq UNUSED Control switch (for alignment) - Could put Oscillator Modulation switch there Range rotary switch: LO (slow pulses or rhythm), 32', 16', 8', 4', 2' Frequency <something> switch: LED to right Waveform rotary switch: tri, impulse/bent-triangle, saw, pulseWide, pulseMed, pulseNarrow UNUSED (originall) or Osc 2 Control VrockerRed Range rotary switch: LO, 32', 16', 8', 4', 2' Detuning knob: -7 to 7 [NO SWITCH] Waveform rotary switch: tri, impulse(?), saw, pulseWide, pulseMed, pulseNarrow Osc 3 Control VrockerRed => use osc3 as LFO instead of osc3 Range rotary switch: LO, 32', 16', 8', 4', 2' Detuning knob: -7 to 7 [NO SWITCH] Waveform rotary switch: tri, impulse(?), saw, pulseWide, pulseMed, pulseNarrow Each row 5 slots to maintain alignment and include red rockers joining VCF area: mixer row 1 = Osc1 Volume and Osc1 HrockerBlue & _ & _ & Filter Modulation HrockerRed Filter Modulation => Modulation Mix output to VCF freq row 2 = Ext In HrockerBlue and Vol and Overload LED and Keyboard Ctl HrockerRed 1 = Osc2 Volume and Osc2 HrockerBlue and Keyboard Ctl HrockerRed 2 Keyboard Control Modulation 1&2 => 0, 1/3, 2/3, all of Keyboard Control Signal ("gate?") applied to VCF freq = Noise HrockerBlue and Volume and Noise Type VrockerBlue = Noise Off and White/Pink selection two rockers Osc3 Volume and Osc3 HrockerBlue Filter Modulation switch VCF Off switch Corner Frequency knob Filter Emphasis knob Amount of Contour knob Attack Time knob Decay Time knob Sustain Level knob Attack Time knob Decay Time knob Sustain Level knob Volume knob [0-10] Unison switch (Arturia) or Output connect/disconnect switch (original) When set, all voices are stacked and instrument is in mono mode Voice Detune knob [0-10] (Arturia) or Polyphonic switch [red LED below] (Arturia) When set, instrument is in polyphonic mode with one oscillator per key Soft Clipping switch [red LED above] Keyboard was 3 1/2 octaves Arturia Glide Hrocker (see original Button version below) Decay Hrocker (see original Button version below) => Sets Release (R) of ADSR to either 0 or Decay (R) Legato Hrocker (not in original) Using Glide/Decay/Legato enables above following Arturia: dg(x) = s2g(hgroup("[2] Glide and Decay momentary pushbuttons", x)); Glide Button injects portamento as set by Glide knob Decay Button uses decay of Loudness Contour (else 0) leave slot 1 open for sustain (below)
import("stdfaust.lib"); main = (signal + attach(extInput,amp) : filters : *(ampScaling)) ~ _; signal = oscs + noise * noiseOff * namp; oscs = par(i,3,(oscamp(i+1)*osc(i+1))) :> _; detuneOctaves(1) = osc1(vslider("[2] DeTuning1 [units:Octaves] [midi:ctrl 24] [style:knob]",0.0,-1.0,1.0,0.001)); waveSelect(1) = osc1(vslider("[3] Waveform1 [midi:ctrl 25] [style:knob]",5,0,5,1):int); amp1Enable = mr1(vslider("[1] On [midi:ctrl 12] [style:knob] [color:blue]",1,0,1,1)); oscamp(1) = mr1(vslider("[0] Osc1 Amp [midi:ctrl 26] [style:knob]",0.5,0.0,1.0,0.001)) * amp1Enable; sei = mr2(vslider("[0] Ext Input [midi:ctrl 27] [style: knob]",0,0,1.0,0.001)); extInput(fb,extSig) = fb,extSig : select2(eei) : *(sei) : extClipLED; extClipLED = _ <: _, (abs : >(0.95) : mr2(vbargraph("[2] Ext Input Clip [style:led]",0,1)):!); keycLED = attach(mr2(vbargraph("[3] Keyboard Ctl [style:led]",0,1))); detuneOctaves(2) = osc2(vslider("[2] DeTuning2 [units:Octaves] [midi:ctrl 29] [style:knob]",0.41667,-1.0,1.0,0.001)); waveSelect(2) = osc2(vslider("[3] Waveform2 [midi:ctrl 30] [style:knob]",5,0,5,1):int); amp2Enable = mr3(vslider("[1] On [midi:ctrl 14] [style:knob] [color:blue]",1,0,1,1)); oscamp(2) = mr3(vslider("[0] Osc2 Amp [midi:ctrl 31] [style:knob]",0.5,0.0,1.0,0.001)) * amp2Enable; namp = mr4(vslider("[0] Noise Amp [midi:ctrl 32] [style: knob]",0.0,0.0,1.0,0.001)); noiseOff = mr4cbg(vslider("[0] On [midi:ctrl 15] [style:knob] [color:blue]",0,0,1,1)); ntype = mr4cbg(vslider("[1] White/Pink [midi:ctrl 16] [tooltip: Choose either White or Pink Noise] [style: knob] [color:blue]",1,0,1,1)); detuneOctaves(3) = osc3(vslider("[2] DeTuning3 [units:Octaves] [midi:ctrl 34] [style:knob]",0.3,-1.0,1.0,0.001)); waveSelect(3) = osc3(vslider("[3] Waveform3 [midi:ctrl 35] [style:knob]",0,0,5,1):int); amp3Enable = mr5(vslider("[1] On [midi:ctrl 17] [style:knob] [color:blue]",0,0,1,1)); oscamp(3) = mr5(vslider("[0] Osc3 Amp [midi:ctrl 36] [style:knob]",0.5,0.0,1.0,0.001)) * amp3Enable; waveforms(i) = (tri(i), bent(i), saw(i), sq(i), ptm(i), ptn(i)); modulationShift = select2(oscModEnable, 0.0, modWheelShift * ( modulationCenterShift + (1.0-modulationCenterShift) * oscNoiseModulation )); octaveShift(i) = -2+int(octaveSelect(i)); keyFreqGlidedMaybe = select2(osc3Control,osc3FixedFreq,keyFreqGlided); detuneBoost(3) = select2(osc3Control,3.0,1.0); detuneOctavesFinal(i) = detuneOctaves(i)*detuneBoost(i); fBase(i) = keyFreqModulatedShifted(i) * pow(2.0, (masterTuneOctaves+octaveShift(i)+detuneOctavesFinal(i))) : si.smooth(ba.tau2pole(0.016)); lfoMode(i) = (octaveSelect(i) == 0); osc(i) = ba.selectn(6, int(waveSelect(i)), tri(i), bent(i), saw(i), sq(i), ptm(i), ptn(i)); tri(i) = select2(lfoMode(i), os.triangle(f(i)), os.lf_triangle(f(i))); saw(i) = select2(lfoMode(i), os.sawtooth(f(i)), os.lf_saw(f(i))); sq(i) = select2(lfoMode(i), os.square(f(i)), os.lf_squarewave(f(i))); os.pulsetrain(f(i),0.25), lf_pulsetrain(f(i),0.25)); ptn(i) = select2(lfoMode(i), os.pulsetrain(f(i),0.125), lf_pulsetrain(f(i),0.125)); lf_pulsetrain(freq,duty) = 2.0*os.lf_pulsetrainpos(freq,duty) - 1.0; fcLgHz = vcf1(vslider("[1] Corner Freq [unit:Log2(Hz)] [tooltip: Corner resonance frequency in Log2(Hertz)] [style: knob] : si.smooth(ba.tau2pole(0.016)); res = vcf1(vslider("[2] Corner Resonance [midi:ctrl 37] [tooltip: Resonance Q at VCF corner frequency (0 to 1)] [style: knob]", 0.7, 0, 1, 0.01)); vcfKeyRange = vcf1cbg(vslider("[2] Kbd Ctl [midi:ctrl 38] [tooltip: Keyboard tracking of VCF corner-frequency (0=none, 1=full)] [style: knob]", vcfModEnable = vcf1cbg(vslider("[1] Filter Mod. [midi:ctrl 19] [color:red] [style:knob] [tooltip: Filter Modulation => Route Modulation Mix output to VCF frequency]",1,0,1,1)); vcfContourAmountOctaves = vcf1(vslider("[3] Amount of Contour (octaves) [midi:ctrl 39] [style: knob]", 1.2, 0, 4.0, 0.001)); vcfModulationOctaves = vcfModMixModulationOctaves + vcfContourOctaves; vcfKeyShiftOctaves = vcfKeyRange * keyShiftOctaves; modulatedFcLgHz = fcLgHz + vcfModulationOctaves + vcfKeyShiftOctaves; fc = min((0.5*ma.SR), pow(2.0,modulatedFcLgHz)); vcf = moog_vcf_2bn(res,fc) with { moog_vcf_2bn(res,fr) = fi.tf2snp(0,0,b0,a11,a01,w1) : fi.tf2snp(0,0,b0,a12,a02,w1) with { b0 = s^2; s2k = sqrt(2) * k; a11 = s * (2 + s2k); a12 = s * (2 - s2k); a01 = b0 * (1 + s2k + k^2); a02 = b0 * (1 - s2k + k^2); }; }; attT60VCF = 0.001 * vcf2(vslider("[0] AttackF [midi:ctrl 40] [tooltip: Attack Time] [unit:ms] [style: knob]",1400,10,10000,1)); decT60VCF = 0.001 * vcf2(vslider("[0] DecayF [midi:ctrl 41] [tooltip: Decay-to-Sustain Time] [unit:ms] [style: knob]",10,10,10000,1)); susLvlVCF = vcf2(vslider("[0] SustainF [midi:ctrl 42] [tooltip: Sustain level as percent of max] [style: knob]",80,0,100,0.1)); relT60VCF = select2(decayButton,0.010,decT60VCF); envelopeVCF = en.adsre(attT60VCF,decT60VCF,susLvlVCF,relT60VCF,gate); declare interface "SmartKeyboard{ 'Number of Keyboards':'2', 'Keyboard 0 - Number of Keys':'13', 'Keyboard 1 - Number of Keys':'13', 'Keyboard 0 - Lowest Key':'72', 'Keyboard 1 - Lowest Key':'60' }"; keyDownHold = gg(vslider("[0] gateHold [tooltip: lock sustain pedal on (hold gate set at 1)][style:knob]",0,0,1,1)); keyDown = gg(button("[1] gate [tooltip: The gate signal is 1 during a note and 0 otherwise. For MIDI, NoteOn occurs when the gate transitions from 0 to 1, and NoteOff is an event corresponding to the gate transition from 1 to 0. The name of this Faust button must be 'gate'.]")); sustain = gg(button("[1] sustain [midi:ctrl 64] gate = keyDown + keyDownHold + sustain : min(1); attT60 = 0.001 * ng(vslider("[0] AttackA [midi:ctrl 43] [tooltip: Attack Time] [unit:ms] [style: knob]",2,0,5000,0.1)); decT60 = 0.001 * ng(vslider("[0] DecayA [midi:ctrl 44] [tooltip: Decay-to-Sustain Time] [unit:ms] [style: knob]",10,0,10000,0.1)); susLvl = ng(vslider("[0] SustainA [midi:ctrl 45] [tooltip: Sustain level as percent of max] [style: knob]",80,0,100,0.1)); envelopeAmpNoAM = en.adsre(attT60,decT60,susLvl,relT60,gate); AMDepth = 0.5; envelopeAmp = select2(oscModEnable, envelopeAmpNoAM, envelopeAmpNoAM * (1.0 + AMDepth*modWheel * 0.5 * (1.0+oscNoiseModulation))); ampL = volg(vslider("[1] gain [style:knob] [tooltip: Amplitude]",0.2,0,1.0,0.001)); bend = wg(hslider("[0] bend [style:knob] [midi:pitchwheel]",1,0.001,10,0.01)) : si.polySmooth(gate,0.999,1); modWheel = wg(vslider("[1] mod [midi:ctrl 1] [style:knob] [tooltip: PitchModulation amplitude in octaves]", 0,0,1.0,0.01)) : si.polySmooth(gate,0.999,1); keyFreqBent = bend * kg(hslider("[2] freq [unit:Hz] [style:knob]",220,0.1,20000,0.1)); masterVolume = vg(vslider("MasterVolume [style:knob] [midi:ctrl 7] [tooltip: master volume, MIDI controlled]", 0.7,0,1,0.001)) : si.smooth(ba.tau2pole(0.16)); masterTuneOctaves = dg(vslider("[0] Tune [midi:ctrl 47] [unit:Octaves] [style:knob] [tooltip: Frequency-shift up or down for all oscillators in Octaves]", 0.0,-1.0,1.0,0.001)); glide = gmmg(vslider("[0] Glide [midi:ctrl 5] [unit:sec/octave] [style:knob] [scale:log] [tooltip: Portamento (frequency-glide) in seconds per octave]", 0.008,0.001,1.0,0.001)); keyFreqGlided = keyFreqBent : si.smooth(legatoPole); mmix = gmmg(vslider("[1] Mod. Mix [midi:ctrl 48] [style:knob] [tooltip: Modulation Mix: Osc3 (0) to Noise (1)]", 0.0,0.0,1.0,0.001)); osc3Control = dsg(vslider("[1] Osc. 3 Ctl [midi:ctrl 9] [color:red] [style:knob] [tooltip:Oscillator 3 frequency tracks the keyboard if on, else not",0,0,1,1):int); effect = _,_ : + : component_echo : component_flanger : component_chorus : component_freeverb; component_echo = environment { knobs_group(x) = ekg(x); switches_group(x) = esg(x); dmaxs = float(dmax)/44100.0; inputSelect(gi) = _,0 : select2(gi); echo_mono(dmax,curdel,tapdel,fb,fbspr,gi) = inputSelect(gi) : (+:si.smooth(fbspr) <: de.fdelay(dmax,curdel), de.fdelay(dmax,tapdel)) ~(*(fb),!) : !,_; tau2pole(tau) = ba.if(tau>0, exp(-1.0/(tau*ma.SR)), 0.0); t60smoother(dEchoT60) = si.smooth(tau2pole(dEchoT60/6.91)); dEchoT60 = knobs_group(vslider("[1] DelayT60 [midi:ctrl 60] [style:knob]", 0.5, 0, 100, 0.001)); dEchoSamplesRaw = knobs_group(vslider("[0] Delay [midi:ctrl 61] [style:knob]", 0.5, 0.001, (dmaxs-0.001), 0.001)) * ma.SR; dEchoSamples = dEchoSamplesRaw : t60smoother(dEchoT60); warpRaw = knobs_group(vslider("[0] Warp [midi:ctrl 62] [style:knob]", 0, -1.0, 1.0, 0.001)); scrubAmpRaw = 0; scrubPhaseRaw = 0; fb = knobs_group(vslider("[2] Feedback [midi:ctrl 2] [style:knob]", .3, 0.0, 1.0, 0.0001)); amp = knobs_group(vslider("[3] Amp [midi:ctrl 75] [style:knob]", .5, 0, 1, 0.001)) : si.smooth(ba.tau2pole(ampT60/6.91)); ampT60 = 0.15661; fbs = knobs_group(vslider("[5] [midi:ctrl 76] FeedbackSm [style:knob]", 0, 0, 1, 0.00001)); enableEcho = (scrubAmpRaw > 0.00001); counter = (enableEcho * (triggerScrubOn : + ~ +(1) * enableEcho : -(2))) & (dmax-1); scrubPhase = scrubPhaseRaw : t60smoother(dEchoT60*(1-triggerScrubOff)); scrubAmp = scrubAmpRaw : t60smoother(dEchoT60*(1-triggerScrubOff)); warp = warpRaw : t60smoother(dEchoT60); dTapSamplesRaw = dEchoSamplesRaw * (1.0 + warp + scrubPhase * scrubAmp) + float(counter); dTapSamples = dTapSamplesRaw : t60smoother(dEchoT60*(1-triggerScrubOff)); echo_process = _ <: _, amp * echo_mono(dmax,dEchoSamples,dTapSamples,fb,fbspr(fbs),gi) : +; }.echo_process; component_flanger = environment { flanger_mono(dmax,curdel,depth,fb,invert,lfoshape) = _ <: _, (-:de.fdelay(dmax,curdel)) ~ *(fb) : _, *(select2(invert,depth,0-depth)) flanger_process = ba.bypass1(fbp,flanger_mono_gui); meter_group(x) = flsg(x); ctl_group(x) = flkg(x); del_group(x) = flkg(x); lvl_group(x) = flkf(x); flangeview = lfo(freq); flanger_mono_gui = attach(flangeview) : flanger_mono(dmax,curdel,depth,fb,invert,lfoshape); sinlfo(freq) = (1 + os.oscrs(freq))/2; trilfo(freq) = 1.0-abs(os.saw1(freq)); lfo(f) = (lfoshape * trilfo(f)) + ((1-lfoshape) * sinlfo(f)); dmax = 2048; dflange = ((dmax-1)-odflange)*del_group(vslider("[1] Delay [midi:ctrl 50][style:knob]", 0.22, 0, 1, 1)); freq = ctl_group(vslider("[1] Rate [midi:ctrl 51] [unit:Hz] [style:knob]", 0.5, 0, 10, 0.01)) : si.smooth(ba.tau2pole(freqT60/6.91)); freqT60 = 0.15661; depth = ctl_group(vslider("[3] Depth [midi:ctrl 52] [style:knob]", .75, 0, 1, 0.001)) : si.smooth(ba.tau2pole(depthT60/6.91)); depthT60 = 0.15661; fb = ctl_group(vslider("[5] Feedback [midi:ctrl 53] [style:knob]", 0, -0.995, 0.99, 0.001)) : si.smooth(ba.tau2pole(fbT60/6.91)); fbT60 = 0.15661; lfoshape = ctl_group(vslider("[7] Waveshape [midi:ctrl 54] [style:knob]", 0, 0, 1, 0.001)); curdel = odflange+dflange*lfo(freq); fbp = 1-int(flsg(vslider("[0] Enable [midi:ctrl 102][style:knob]",0,0,1,1))); invert = flsg(vslider("[1] Invert [midi:ctrl 49][style:knob]",0,0,1,1):int); }.flanger_process; component_chorus = environment { chorus_process = bypass1to2(cbp,chorus_mono(dmax,curdel,rate,sigma,do2,voices)); bypass1to2(bpc,e) = _ <: ((inswitch:e),_,_) : ba.select2stereo(bpc) with {inswitch = select2(bpc,_,0);}; fl = library("filter.lib"); oscs(freq) = rdtable(tablesize, sinwaveform, int(ml.phase(freq)) ); oscc(freq) = rdtable(tablesize, coswaveform, int(ml.phase(freq)) ); oscp(freq,p) = oscs(freq) * cos(p) + oscc(freq) * sin(p); sinwaveform = float(ml.time)*(2.0*pi)/float(tablesize) : sin; coswaveform = float(ml.time)*(2.0*pi)/float(tablesize) : cos; tablesize = 1 << 16; pi = 4.0*atan(1.0); dmax = 8192; curdel = dmax * ckg(vslider("[0] Delay [midi:ctrl 55] [style:knob]", 0.5, 0, 1, 1)) : fl.smooth(0.999); rateMin = 0.01; rateT60 = 0.15661; rate = ckg(vslider("[1] Rate [midi:ctrl 56] [unit:Hz] [style:knob]", 0.5, rateMin, rateMax, 0.0001)) : fl.smooth(fl.tau2pole(rateT60/6.91)); depth = ckg(vslider("[4] Depth [midi:ctrl 57] [style:knob]", 0.5, 0, 1, 0.001)) : fl.smooth(fl.tau2pole(depthT60/6.91)); depthT60 = 0.15661; delayPerVoice = 0.5*curdel/voices; sigma = delayPerVoice * ckg(vslider("[6] Deviation [midi:ctrl 58] [style:knob]",0.5,0,1,0.001)) : fl.smooth(0.999); periodic = 1; cbp = 1-int(csg(vslider("[0] Enable [midi:ctrl 103][style:knob]",0,0,1,1))); chorus_mono(dmax,curdel,rate,sigma,do2,voices) = _ <: (*(1-do2)<:_,_),(*(do2) <: par(i,voices,voice(i)) :> _,_) : ml.interleave(2,2) : +,+ with { angle(i) = 2*pi*(i/2)/voices + (i%2)*pi/2; voice(i) = ml.fdelay(dmax,min(dmax,del(i))) * cos(angle(i)); del(i) = curdel*(i+1)/voices + dev(i); rates(i) = rate/float(i+1); dev(i) = sigma * oscp(rates(i),i*2*pi/voices); }; chorus_stereo(dmax,curdel,rate,sigma,do2,voices) = _,_ <: *(1-do2),*(1-do2),(*(do2),*(do2) <: par(i,voices,voice(i)):>_,_) : ml.interleave(2,2) : +,+; voice(i) = ml.fdelay(dmax,min(dmax,del(i)))/(i+1) with { angle(i) = 2*pi*(i/2)/voices + (i%2)*pi/2; voice(i) = ml.fdelay(dmax,min(dmax,del(i))) * cos(angle(i)); del(i) = curdel*(i+1)/voices + dev(i); rates(i) = rate/float(i+1); dev(i) = sigma * oscp(rates(i),i*2*pi/voices); }; }.chorus_process; component_freeverb = environment { import("stdfaust.lib"); declare name "freeverb"; declare version "1.0"; declare author "Grame"; declare license "BSD"; declare copyright "(c) GRAME 2006 and MoForte Inc. 2017"; declare reference "https://ccrma.stanford.edu/~jos/pasp/Freeverb.html"; scalewet = 3.0; scaledry = 2.0; scaledamp = 0.4; scaleroom = 0.28; offsetroom = 0.7; initialroom = 0.5; initialdamp = 0.5; initialwet = 1.0/scalewet; initialdry = 0; initialwidth= 1.0; initialmode = 0.0; freezemode = 0.5; stereospread= 23; combtuningL1 = 1116; combtuningL2 = 1188; combtuningL3 = 1277; combtuningL4 = 1356; combtuningL5 = 1422; combtuningL6 = 1491; combtuningL7 = 1557; combtuningL8 = 1617; allpasstuningL1 = 556; allpasstuningL2 = 441; allpasstuningL3 = 341; allpasstuningL4 = 225; dampSlider = rkg(vslider("Damp [midi:ctrl 3] [style:knob]",0.5, 0, 1, 0.025))*scaledamp; roomsizeSlider = rkg(vslider("RoomSize [midi:ctrl 4] [style:knob]", 0.5, 0, 1, 0.025))*scaleroom + offsetroom; wetSlider = rkg(vslider("Wet [midi:ctrl 79] [style:knob]", 0.3333, 0, 1, 0.025)); combfeed = roomsizeSlider; allpass(dt,fb) = (_,_ <: (*(fb),_:+:@(dt)), -) ~ _ : (!,_); comb(dt, fb, damp) = (+:@(dt)) ~ (*(1-damp) : (+ ~ *(damp)) : *(fb)); monoReverb(fb1, fb2, damp, spread) = _ <: comb(combtuningL1+spread, fb1, damp), comb(combtuningL2+spread, fb1, damp), comb(combtuningL3+spread, fb1, damp), comb(combtuningL4+spread, fb1, damp), comb(combtuningL5+spread, fb1, damp), comb(combtuningL6+spread, fb1, damp), comb(combtuningL7+spread, fb1, damp), comb(combtuningL8+spread, fb1, damp) +> allpass (allpasstuningL1+spread, fb2) : allpass (allpasstuningL2+spread, fb2) : allpass (allpasstuningL3+spread, fb2) : allpass (allpasstuningL4+spread, fb2) ; monoReverbToStereo(fb1, fb2, damp, spread) = + <: monoReverb(fb1, fb2, damp, 0) <: _,_; stereoReverb(fb1, fb2, damp, spread) = + <: monoReverb(fb1, fb2, damp, 0), monoReverb(fb1, fb2, damp, spread); monoToStereoReverb(fb1, fb2, damp, spread) = _ <: monoReverb(fb1, fb2, damp, 0), monoReverb(fb1, fb2, damp, spread); fxctrl(g,w,Fx) = _,_ <: (*(g),*(g) : Fx : *(w),*(w)), *(1-w), *(1-w) +> _,_; rbp = 1-int(rsg(vslider("[0] Enable [midi:ctrl 104][style:knob]",0,0,1,1))); freeverb = fxctrl(fixedgain, wetSlider, monoReverbToStereo(combfeed, allpassfeed, dampSlider, stereospread)); freeverb_process = ba.bypass2(rbp,freeverb); }.freeverb_process; vrocker(x) = checkbox("%%x [style:vrocker]"); hrocker(x) = checkbox("%%x [style:hrocker]"); vrockerblue(x) = checkbox("%x [style:vrocker] [color:blue]"); vrockerblue(x) = checkbox("%x [style:vrocker] [color:blue]"); hrockerblue(x) = checkbox("%%x [style:hrocker] [color:blue]"); vrockerred(x) = checkbox("%%x [style:vrocker] [color:red]"); hrockerred(x) = checkbox("%%x [style:hrocker] [color:red]"); declare designer "Robert A. Moog"; synthg(x) = mmg(vgroup("[0] Minimoog",x)); fxg(x) = mmg(hgroup("[1] Effects",x)); mg(x) = synthg(hgroup("[0]",x)); vg(x) = cg(hgroup("[0] Master Volume", x)); dg(x) = cg(hgroup("[1] Oscillator Tuning & Switching", x)); dsg(x) = dg(vgroup("[1] Switches", x)); gmmg(x) = cg(hgroup("[2] Glide and ModMix", x)); og(x) = mg(vgroup("[1] Oscillator Bank", x)); osc1(x) = og(hgroup("[1] Oscillator 1", x)); osc2(x) = og(hgroup("[2] Oscillator 2", x)); osc3(x) = og(hgroup("[3] Oscillator 3", x)); mixg(x) = mg(vgroup("[2] Mixer", x)); modg(x) = mg(vgroup("[3] Modifiers", x)); vcfg(x) = modg(vgroup("[0] Filter", x)); vcf1(x) = vcfg(hgroup("[0] [tooltip:freq, Q, ContourScale]", x)); vcf1cbg(x) = vcf1(vgroup("[0] [tooltip:two checkboxes]", x)); vcf2(x) = vcfg(hgroup("[1] Filter Contour [tooltip:AttFilt, DecFilt, Sustain Level for Filter Contour]", x)); ng(x) = modg(hgroup("[1] Loudness Contour", x)); echog(x) = fxg(hgroup("[4] Echo",x)); ekg(x) = echog(vgroup("[0] Knobs",x)); esg(x) = echog(vgroup("[1] Switches",x)); flg(x) = fxg(hgroup("[5] Flanger",x)); flkg(x) = flg(vgroup("[0] Knobs",x)); flsg(x) = flg(vgroup("[1] Switches",x)); chg(x) = fxg(hgroup("[6] Chorus",x)); ckg(x) = chg(vgroup("[0] Knobs",x)); csg(x) = chg(vgroup("[1] Switches",x)); rg(x) = fxg(hgroup("[7] Reverb",x)); rkg(x) = rg(vgroup("[0] Knobs",x)); rsg(x) = rg(vgroup("[1] Switches",x)); outg(x) = fxg(vgroup("[8] Output", x)); volg(x) = outg(hgroup("[0] Volume Main Output", x)); tunerg(x) = outg(hgroup("[1] A-440 Switch", x)); vdtpolyg(x) = outg(hgroup("[2] Voice Detune / Poly", x)); clipg(x) = fxg(vgroup("[9] Soft Clip", x)); ws(x) = kg(vgroup("[0] Wheels and Switches", x)); s1g(x) = ws(hgroup("[0] Jacks and Rockers", x)); jg(x) = s1g(vgroup("[0] MiniJacks",x)); s2g(x) = ws(hgroup("[1] [tooltip:Wheels+]", x)); bg(x) = s2g(vgroup("[0] [tooltip:Bend Enable and Range]", x)); wg(x) = s2g(hgroup("[1] [tooltip:Bend and Mod Wheels]", x)); keys(x) = kg(hgroup("[1] [tooltip:Keys]", x)); gg(x) = keys(hgroup("[0] [tooltip: Gates]",x));
de08f972fdf424433498b920c6b5283407638e760c42a3e2bc0ecf8bf875b462
moforte/sam-faust
virtualAnalogForBrowser.dsp
import("stdfaust.lib"); // These are now in a separate file ./effects.dsp // echo = echog(component("echo.dsp")); // ./echo.dsp // flanger = flg(component("flanger.dsp")); // ./flanger.dsp // chorus = chg(component("chorus.dsp")); // ./chorus.dsp // reverb = rg(component("freeverb.dsp")); process = main <: _,_; // Now separate: : echo : flanger : chorus : reverb; main = (signal + attach(extInput,amp) : filters : *(ampScaling)) ~ _; signal = oscs + noise * noiseOff * namp; ampScaling = envelopeAmp * masterVolume; // masterVolume is redundant but easier to find oscs = par(i,3,(oscamp(i+1)*osc(i+1))) :> _; controlSelect(1) = osc1(vrockerred); // ("[0] use as LFO")); octaveSelect(1) = osc1(vslider("[1] Octave1 [midi:ctrl 23] [style:knob]",1,0,5,1):int); // LO, 32', 16', 8', 4', 2' // Osc1 detunes like Osc2 and Osc3 (unlike in the Minimoog where it would be an expensive extra knob): detuneOctaves(1) = osc1(vslider("[2] DeTuning1 [units:Octaves] [midi:ctrl 24] [style:knob]",0.0,-1.0,1.0,0.001)); waveSelect(1) = osc1(vslider("[3] Waveform1 [midi:ctrl 25] [style:knob]",5,0,5,1):int); amp1Enable = mr1(vslider("[1] On [midi:ctrl 12] [style:knob] [color:blue]",1,0,1,1)); oscamp(1) = mr1(vslider("[0] Osc1 Amp [midi:ctrl 26] [style:knob]",0.5,0.0,1.0,0.001)) * amp1Enable; eei = mr2(vslider("[1] On [midi:ctrl 13] [style:knob] [color:blue]",0,0,1,1)); // External input = MAIN OUTPUT when "off" sei = mr2(vslider("[0] Ext Input [midi:ctrl 27] [style: knob]",0,0,1.0,0.001)); extInput(fb,extSig) = fb,extSig : select2(eei) : *(sei) : extClipLED; extClipLED = _ <: _, (abs : >(0.95) : mr2(vbargraph("[2] Ext Input Clip [style:led]",0,1)):!); keycLED = attach(mr2(vbargraph("[3] Keyboard Ctl [style:led]",0,1))); controlSelect(2) = osc2(vrockerred); // ("[0] use as LFO")); octaveSelect(2) = osc2(vslider("[1] Octave2 [midi:ctrl 28] [style:knob]",1,0,5,1):int); // LO, 32', 16', 8', 4', 2' detuneOctaves(2) = osc2(vslider("[2] DeTuning2 [units:Octaves] [midi:ctrl 29] [style:knob]",0.41667,-1.0,1.0,0.001)); waveSelect(2) = osc2(vslider("[3] Waveform2 [midi:ctrl 30] [style:knob]",5,0,5,1):int); amp2Enable = mr3(vslider("[1] On [midi:ctrl 14] [style:knob] [color:blue]",1,0,1,1)); oscamp(2) = mr3(vslider("[0] Osc2 Amp [midi:ctrl 31] [style:knob]",0.5,0.0,1.0,0.001)) * amp2Enable; noise = select2(ntype,no.noise,10.0*no.pink_noise); // pink noise needs some "make-up gain" namp = mr4(vslider("[0] Noise Amp [midi:ctrl 32] [style: knob]",0.0,0.0,1.0,0.001)); noiseOff = mr4cbg(vslider("[0] On [midi:ctrl 15] [style:knob] [color:blue]",0,0,1,1)); ntype = mr4cbg(vslider("[1] White/Pink [midi:ctrl 16] [tooltip: Choose either White or Pink Noise] [style: knob] [color:blue]",1,0,1,1)); controlSelect(3) = osc3(vrockerred); // ("[0] use as LFO")); octaveSelect(3) = osc3(vslider("[1] Octave3 [midi:ctrl 33] [style:knob]",0,0,5,1):int); // LO, 32', 16', 8', 4', 2' detuneOctaves(3) = osc3(vslider("[2] DeTuning3 [units:Octaves] [midi:ctrl 34] [style:knob]",0.3,-1.0,1.0,0.001)); waveSelect(3) = osc3(vslider("[3] Waveform3 [midi:ctrl 35] [style:knob]",0,0,5,1):int); amp3Enable = mr5(vslider("[1] On [midi:ctrl 17] [style:knob] [color:blue]",0,0,1,1)); oscamp(3) = mr5(vslider("[0] Osc3 Amp [midi:ctrl 36] [style:knob]",0.5,0.0,1.0,0.001)) * amp3Enable; waveforms(i) = (tri(i), bent(i), saw(i), sq(i), ptm(i), ptn(i)); // compute oscillator frequency scale factor, staying in lg(Hz) as much as possible: modWheelShift = 1.5*modWheel; // Manual says 0 to 1.5 octaves modulationCenterShift = 0; // Leave this off until triangle-wave modulation is debugged modulationShift = select2(oscModEnable, 0.0, modWheelShift * ( modulationCenterShift + (1.0-modulationCenterShift) * oscNoiseModulation )); octaveShift(i) = -2+int(octaveSelect(i)); osc3FixedFreq = 369.994; // F# a tritone above middle C keyFreqGlidedMaybe = select2(osc3Control,osc3FixedFreq,keyFreqGlided); keyFreqModulatedShifted(3) = keyFreqGlidedMaybe; // osc3 not allowed to FM itself keyFreqModulatedShifted(i) = keyFreqGlided * pow(2.0, modulationShift); // i=1,2 // When disconnected from the keyboard, Osc3 can detune 3 octaves up or down (Pat video): detuneBoost(3) = select2(osc3Control,3.0,1.0); detuneBoost(i) = 1.0; // i=1,2 detuneOctavesFinal(i) = detuneOctaves(i)*detuneBoost(i); fBase(i) = keyFreqModulatedShifted(i) * pow(2.0, (masterTuneOctaves+octaveShift(i)+detuneOctavesFinal(i))) : si.smooth(ba.tau2pole(0.016)); fLFOBase(i) = 3.0 * pow(2.0, detuneOctavesFinal(i)); // used when osc3 (only) is in LFO mode lfoMode(i) = (octaveSelect(i) == 0); f(i) = select2(lfoMode(i), fBase(i), fLFOBase(i)); // lowest range setting is LFO mode for any osc // i is 1-based: osc(i) = ba.selectn(6, int(waveSelect(i)), tri(i), bent(i), saw(i), sq(i), ptm(i), ptn(i)); tri(i) = select2(lfoMode(i), os.triangle(f(i)), os.lf_triangle(f(i))); bent(i) = 0.5*tri(i) + 0.5*saw(i); // from Minimoog manual saw(i) = select2(lfoMode(i), os.sawtooth(f(i)), os.lf_saw(f(i))); sq(i) = select2(lfoMode(i), os.square(f(i)), os.lf_squarewave(f(i))); ptm(i) = select2(lfoMode(i), // Note: a Duty knob would be better than these two, or in addition os.pulsetrain(f(i),0.25), lf_pulsetrain(f(i),0.25)); ptn(i) = select2(lfoMode(i), os.pulsetrain(f(i),0.125), lf_pulsetrain(f(i),0.125)); // Soon to appear in oscillators.lib: lf_pulsetrain(freq,duty) = 2.0*os.lf_pulsetrainpos(freq,duty) - 1.0; filters = ba.bypass1(bp,vcf); // BYPASS WILL GO AWAY (I think you just open it up all the way to bypass): bp = 0; // VCF is always on fcLgHz = vcf1(vslider("[1] Corner Freq [unit:Log2(Hz)] [tooltip: Corner resonance frequency in Log2(Hertz)] [style: knob] [midi:ctrl 74]", // Frequency Cutoff (aka Brightness ) 10.6, log(40.0)/log(2), log(20000.0)/log(2), 0.000001)) // 9 octaves (from Minimoog manual) //p: 40, 30, 80, 0.01)) //p: : ba.pianokey2hz : si.smooth(ba.tau2pole(0.016)); res = vcf1(vslider("[2] Corner Resonance [midi:ctrl 37] [tooltip: Resonance Q at VCF corner frequency (0 to 1)] [style: knob]", 0.7, 0, 1, 0.01)); vcfKeyRange = vcf1cbg(vslider("[2] Kbd Ctl [midi:ctrl 38] [tooltip: Keyboard tracking of VCF corner-frequency (0=none, 1=full)] [style: knob]", 1, 0, 1, 0.001)); // was in mr2 vcfModEnable = vcf1cbg(vslider("[1] Filter Mod. [midi:ctrl 19] [color:red] [style:knob] [tooltip: Filter Modulation => Route Modulation Mix output to VCF frequency]",1,0,1,1)); // Note that VCF has three sources of corner-frequency setting that are added together: // - Corner Freq knob (40 Hz to 20 kHz) // - VCF Contour envelope (0 to 4 octaves) // - Injection 32 of Modulation Mix (0 to 1.5 octaves) // Manual says maximum vcf sweep spans 0 to 4 octaves: // Original Knob went to 10, but we're going to 4 so we can say the knob is in "octaves" units: vcfContourAmountOctaves = vcf1(vslider("[3] Amount of Contour (octaves) [midi:ctrl 39] [style: knob]", 1.2, 0, 4.0, 0.001)); vcfContourOctaves = vcfContourAmountOctaves * envelopeVCF; // in octaves // We are assuming that the modulation-mix range for the VCF freq is 1.5 octaves like it is for oscs 1 and 2: vcfModMixModulationOctaves = select2(vcfModEnable, 0, (1.5 * oscNoiseModulation * modWheel)); // octaves vcfModulationOctaves = vcfModMixModulationOctaves + vcfContourOctaves; keyFreqLogHzGlided = log(keyFreqGlided)/log(2.0); // FIXME: Start w freqLogHz not freq so we don't need exp(log()) here keyShiftOctaves = keyFreqLogHzGlided - log(261.625565)/log(2.0); // FIXME: ARBITRARILY centering on middle C - check device vcfKeyShiftOctaves = vcfKeyRange * keyShiftOctaves; modulatedFcLgHz = fcLgHz + vcfModulationOctaves + vcfKeyShiftOctaves; fc = min((0.5*ma.SR), pow(2.0,modulatedFcLgHz)); vcf = moog_vcf_2bn(res,fc) with { moog_vcf_2bn(res,fr) = fi.tf2snp(0,0,b0,a11,a01,w1) : fi.tf2snp(0,0,b0,a12,a02,w1) with { s = 1; // minus the open-loop location of all four poles w1 = 2*ma.PI*max(fr,20); // frequency-scaling parameter for bilinear xform k = sqrt(2)*0.99999*res; // fourth root of Moog VCF feedback gain b0 = s^2; s2k = sqrt(2) * k; a11 = s * (2 + s2k); a12 = s * (2 - s2k); a01 = b0 * (1 + s2k + k^2); a02 = b0 * (1 - s2k + k^2); }; }; // Attack, Decay, and Sustain ranges are set according to the Minimoog manual: attT60VCF = 0.001 * vcf2(vslider("[0] AttackF [midi:ctrl 40] [tooltip: Attack Time] [unit:ms] [style: knob]",1400,10,10000,1)); decT60VCF = 0.001 * vcf2(vslider("[0] DecayF [midi:ctrl 41] [tooltip: Decay-to-Sustain Time] [unit:ms] [style: knob]",10,10,10000,1)); susLvlVCF = vcf2(vslider("[0] SustainF [midi:ctrl 42] [tooltip: Sustain level as percent of max] [style: knob]",80,0,100,0.1)); decayButton = wg(vslider("Decay [midi:ctrl 20] [tooltip:Envelope Release either Decay value or 0][style:knob]",1,0,1,1):int); // was Staccato legatoButton = wg(vslider("Glide [midi:ctrl 65] [tooltip: Glide from note to note][style:knob]",1,0,1,1)); // was Legato relT60VCF = select2(decayButton,0.010,decT60VCF); envelopeVCF = en.adsre(attT60VCF,decT60VCF,susLvlVCF,relT60VCF,gate); // --- Smart Keyboard interface --- declare interface "SmartKeyboard{ 'Number of Keyboards':'2', 'Keyboard 0 - Number of Keys':'13', 'Keyboard 1 - Number of Keys':'13', 'Keyboard 0 - Lowest Key':'72', 'Keyboard 1 - Lowest Key':'60' }"; // --- functions --- // Signal controls: keyDownHold = gg(vslider("[0] gateHold [tooltip: lock sustain pedal on (hold gate set at 1)][style:knob]",0,0,1,1)); keyDown = gg(button("[1] gate [tooltip: The gate signal is 1 during a note and 0 otherwise. For MIDI, NoteOn occurs when the gate transitions from 0 to 1, and NoteOff is an event corresponding to the gate transition from 1 to 0. The name of this Faust button must be 'gate'.]")); sustain = gg(button("[1] sustain [midi:ctrl 64] [tooltip: extends the gate (keeps it set to 1)]")); // MIDI only (see smartkeyb doc) gate = keyDown + keyDownHold + sustain : min(1); attT60 = 0.001 * ng(vslider("[0] AttackA [midi:ctrl 43] [tooltip: Attack Time] [unit:ms] [style: knob]",2,0,5000,0.1)); decT60 = 0.001 * ng(vslider("[0] DecayA [midi:ctrl 44] [tooltip: Decay-to-Sustain Time] [unit:ms] [style: knob]",10,0,10000,0.1)); susLvl = ng(vslider("[0] SustainA [midi:ctrl 45] [tooltip: Sustain level as percent of max] [style: knob]",80,0,100,0.1)); relT60 = select2(decayButton,0.010,decT60); // right? envelopeAmpNoAM = en.adsre(attT60,decT60,susLvl,relT60,gate); AMDepth = 0.5; envelopeAmp = select2(oscModEnable, envelopeAmpNoAM, envelopeAmpNoAM * (1.0 + AMDepth*modWheel * 0.5 * (1.0+oscNoiseModulation))); // Signal Parameters ampL = volg(vslider("[1] gain [style:knob] [tooltip: Amplitude]",0.2,0,1.0,0.001)); amp = ampL : si.smoo; // envelopeAmp is multiplied once on entire signal sum //elecGuitar.dsp values used: bend = wg(hslider("[0] bend [style:knob] [midi:pitchwheel]",1,0.001,10,0.01)) : si.polySmooth(gate,0.999,1); //Previous guess: modWheel = wg(vslider("[1] mod [midi:ctrl 1] [style:knob] [tooltip: PitchModulation amplitude in octaves]", 0,0,1.0,0.01)) : si.polySmooth(gate,0.999,1); //p: MIDI requires frequency in Hz, not piano-keys as we had before // Frequency Range is 0.1 Hz to 20 kHz according to the Minimoog manual: // MIDI REQUIRES THE FOLLOWING PARAMETER TO BE NAMED 'freq': keyFreqBent = bend * kg(hslider("[2] freq [unit:Hz] [style:knob]",220,0.1,20000,0.1)); masterVolume = vg(vslider("MasterVolume [style:knob] [midi:ctrl 7] [tooltip: master volume, MIDI controlled]", 0.7,0,1,0.001)) : si.smooth(ba.tau2pole(0.16)); masterTuneOctaves = dg(vslider("[0] Tune [midi:ctrl 47] [unit:Octaves] [style:knob] [tooltip: Frequency-shift up or down for all oscillators in Octaves]", 0.0,-1.0,1.0,0.001)); // Oscillator Modulation HrockerRed => apply Modulation Mix output osc1&2 pitches glide = gmmg(vslider("[0] Glide [midi:ctrl 5] [unit:sec/octave] [style:knob] [scale:log] [tooltip: Portamento (frequency-glide) in seconds per octave]", 0.008,0.001,1.0,0.001)); legatoPole = select2(legatoButton,0.5,ba.tau2pole(glide*exp(1.0f)/2.0f)); // convert 1/e to 1/2 by slowing down exp keyFreqGlided = keyFreqBent : si.smooth(legatoPole); mmix = gmmg(vslider("[1] Mod. Mix [midi:ctrl 48] [style:knob] [tooltip: Modulation Mix: Osc3 (0) to Noise (1)]", 0.0,0.0,1.0,0.001)); oscNoiseModulation = (mmix * noise) + ((1.0-mmix) * osc(3)); // noise amplitude and off-switch ignored here oscModEnable = dsg(vslider("[0] Osc. Mod. [midi:ctrl 22] [color:red] [style:knob] [tooltip:Oscillator Modulation adds Modulation Mix output to osc1&2 frequencies",1,0,1,1)); // any offset? osc3Control = dsg(vslider("[1] Osc. 3 Ctl [midi:ctrl 9] [color:red] [style:knob] [tooltip:Oscillator 3 frequency tracks the keyboard if on, else not",0,0,1,1):int); // This layout loosely follows the MiniMoog-V // Arturia-only features are labeled // Original versions also added where different // Need vrocker and hrocker toggle switches in Faust! // Need orange and blue color choices // Orange => Connect modulation sources to their destinations // Blue => Turn audio sources On and Off // - and later - // White => Turn performance features On and Off // Black => Select between modulation sources // Julius Smith for Analog Devices 3/1/2017 vrocker(x) = checkbox("%%x [style:vrocker]"); hrocker(x) = checkbox("%%x [style:hrocker]"); vrockerblue(x) = checkbox("%x [style:vrocker] [color:blue]"); vrockerblue(x) = checkbox("%x [style:vrocker] [color:blue]"); // USAGE: vrockerorange("[0] ModulationEnable"); hrockerblue(x) = checkbox("%%x [style:hrocker] [color:blue]"); vrockerred(x) = checkbox("%%x [style:vrocker] [color:red]"); hrockerred(x) = checkbox("%%x [style:hrocker] [color:red]"); declare designer "Robert A. Moog"; mmg(x) = hgroup("",x); // Minimoog + Effects synthg(x) = mmg(vgroup("[0] Minimoog",x)); fxg(x) = mmg(hgroup("[1] Effects",x)); mg(x) = synthg(hgroup("[0]",x)); cg(x) = mg(vgroup("[0] Controllers",x)); // Formerly named "Modules" but "Minimoog" group-title is enough vg(x) = cg(hgroup("[0] Master Volume", x)); dg(x) = cg(hgroup("[1] Oscillator Tuning & Switching", x)); // Tune knob = master tune dsg(x) = dg(vgroup("[1] Switches", x)); // Oscillator Modulation HrockerRed => apply Modulation Mix output to osc1&2 pitches // [MOVED here from osc3 group] Osc 3 Control VrockerRed => use osc3 as LFO instead of osc3 gmmg(x) = cg(hgroup("[2] Glide and ModMix", x)); // Glide knob [0:10] = portamento speed // Modulation Mix knob [0:10] (between Osc3 and Noise) = mix of noise and osc3 modulating osc1&2 pitch and/or VCF freq og(x) = mg(vgroup("[1] Oscillator Bank", x)); osc1(x) = og(hgroup("[1] Oscillator 1", x)); // UNUSED Control switch (for alignment) - Could put Oscillator Modulation switch there // Range rotary switch: LO (slow pulses or rhythm), 32', 16', 8', 4', 2' // Frequency <something> switch: LED to right // Waveform rotary switch: tri, impulse/bent-triangle, saw, pulseWide, pulseMed, pulseNarrow osc2(x) = og(hgroup("[2] Oscillator 2", x)); // UNUSED (originall) or Osc 2 Control VrockerRed // Range rotary switch: LO, 32', 16', 8', 4', 2' // Detuning knob: -7 to 7 [NO SWITCH] // Waveform rotary switch: tri, impulse(?), saw, pulseWide, pulseMed, pulseNarrow osc3(x) = og(hgroup("[3] Oscillator 3", x)); // Osc 3 Control VrockerRed => use osc3 as LFO instead of osc3 // Range rotary switch: LO, 32', 16', 8', 4', 2' // Detuning knob: -7 to 7 [NO SWITCH] // Waveform rotary switch: tri, impulse(?), saw, pulseWide, pulseMed, pulseNarrow mixg(x) = mg(vgroup("[2] Mixer", x)); // Each row 5 slots to maintain alignment and include red rockers joining VCF area: mr1(x) = mixg(hgroup("[0] Osc1", x)); // mixer row 1 = // Osc1 Volume and Osc1 HrockerBlue & _ & _ & Filter Modulation HrockerRed // Filter Modulation => Modulation Mix output to VCF freq mr2(x) = mixg(hgroup("[1] Ext In, KeyCtl", x)); // row 2 = Ext In HrockerBlue and Vol and Overload LED and Keyboard Ctl HrockerRed 1 mr3(x) = mixg(hgroup("[2] Osc2", x)); // = Osc2 Volume and Osc2 HrockerBlue and Keyboard Ctl HrockerRed 2 // Keyboard Control Modulation 1&2 => 0, 1/3, 2/3, all of Keyboard Control Signal ("gate?") applied to VCF freq mr4(x) = mixg(hgroup("[3] Noise", x)); // = Noise HrockerBlue and Volume and Noise Type VrockerBlue mr4cbg(x) = mr4(vgroup("[1]", x)); // = Noise Off and White/Pink selection // two rockers mr5(x) = mixg(hgroup("[4] Osc3", x)); // Osc3 Volume and Osc3 HrockerBlue modg(x) = mg(vgroup("[3] Modifiers", x)); vcfg(x) = modg(vgroup("[0] Filter", x)); vcf1(x) = vcfg(hgroup("[0] [tooltip:freq, Q, ContourScale]", x)); vcf1cbg(x) = vcf1(vgroup("[0] [tooltip:two checkboxes]", x)); // Filter Modulation switch // VCF Off switch // Corner Frequency knob // Filter Emphasis knob // Amount of Contour knob vcf2(x) = vcfg(hgroup("[1] Filter Contour [tooltip:AttFilt, DecFilt, Sustain Level for Filter Contour]", x)); // Attack Time knob // Decay Time knob // Sustain Level knob ng(x) = modg(hgroup("[1] Loudness Contour", x)); // Attack Time knob // Decay Time knob // Sustain Level knob echog(x) = fxg(hgroup("[4] Echo",x)); ekg(x) = echog(vgroup("[0] Knobs",x)); esg(x) = echog(vgroup("[1] Switches",x)); flg(x) = fxg(hgroup("[5] Flanger",x)); flkg(x) = flg(vgroup("[0] Knobs",x)); flsg(x) = flg(vgroup("[1] Switches",x)); chg(x) = fxg(hgroup("[6] Chorus",x)); ckg(x) = chg(vgroup("[0] Knobs",x)); csg(x) = chg(vgroup("[1] Switches",x)); rg(x) = fxg(hgroup("[7] Reverb",x)); rkg(x) = rg(vgroup("[0] Knobs",x)); rsg(x) = rg(vgroup("[1] Switches",x)); outg(x) = fxg(vgroup("[8] Output", x)); volg(x) = outg(hgroup("[0] Volume Main Output", x)); // Volume knob [0-10] // Unison switch (Arturia) or Output connect/disconnect switch (original) // When set, all voices are stacked and instrument is in mono mode tunerg(x) = outg(hgroup("[1] A-440 Switch", x)); vdtpolyg(x) = outg(hgroup("[2] Voice Detune / Poly", x)); // Voice Detune knob [0-10] (Arturia) or // Polyphonic switch [red LED below] (Arturia) // When set, instrument is in polyphonic mode with one oscillator per key clipg(x) = fxg(vgroup("[9] Soft Clip", x)); // Soft Clipping switch [red LED above] kg(x) = synthg(hgroup("[1] Keyboard Group", x)); // Keyboard was 3 1/2 octaves ws(x) = kg(vgroup("[0] Wheels and Switches", x)); s1g(x) = ws(hgroup("[0] Jacks and Rockers", x)); jg(x) = s1g(vgroup("[0] MiniJacks",x)); gdlg(x) = s1g(vgroup("[1] Glide/Decay/Legato Enables",x)); // Arturia // Glide Hrocker (see original Button version below) // Decay Hrocker (see original Button version below) => Sets Release (R) of ADSR to either 0 or Decay (R) // Legato Hrocker (not in original) s2g(x) = ws(hgroup("[1] [tooltip:Wheels+]", x)); bg(x) = s2g(vgroup("[0] [tooltip:Bend Enable and Range]", x)); wg(x) = s2g(hgroup("[1] [tooltip:Bend and Mod Wheels]", x)); // Using Glide/Decay/Legato enables above following Arturia: // dg(x) = s2g(hgroup("[2] Glide and Decay momentary pushbuttons", x)); // Glide Button injects portamento as set by Glide knob // Decay Button uses decay of Loudness Contour (else 0) keys(x) = kg(hgroup("[1] [tooltip:Keys]", x)); gg(x) = keys(hgroup("[0] [tooltip: Gates]",x)); // leave slot 1 open for sustain (below)
https://raw.githubusercontent.com/moforte/sam-faust/85be03f262e384c1befa9eaac237e052040b2cc1/faust-examples/virtualAnalog/virtualAnalogForBrowser.dsp
faust
These are now in a separate file ./effects.dsp echo = echog(component("echo.dsp")); // ./echo.dsp flanger = flg(component("flanger.dsp")); // ./flanger.dsp chorus = chg(component("chorus.dsp")); // ./chorus.dsp reverb = rg(component("freeverb.dsp")); Now separate: : echo : flanger : chorus : reverb; masterVolume is redundant but easier to find ("[0] use as LFO")); LO, 32', 16', 8', 4', 2' Osc1 detunes like Osc2 and Osc3 (unlike in the Minimoog where it would be an expensive extra knob): External input = MAIN OUTPUT when "off" ("[0] use as LFO")); LO, 32', 16', 8', 4', 2' pink noise needs some "make-up gain" ("[0] use as LFO")); LO, 32', 16', 8', 4', 2' compute oscillator frequency scale factor, staying in lg(Hz) as much as possible: Manual says 0 to 1.5 octaves Leave this off until triangle-wave modulation is debugged F# a tritone above middle C osc3 not allowed to FM itself i=1,2 When disconnected from the keyboard, Osc3 can detune 3 octaves up or down (Pat video): i=1,2 used when osc3 (only) is in LFO mode lowest range setting is LFO mode for any osc i is 1-based: from Minimoog manual Note: a Duty knob would be better than these two, or in addition Soon to appear in oscillators.lib: BYPASS WILL GO AWAY (I think you just open it up all the way to bypass): VCF is always on Frequency Cutoff (aka Brightness ) 9 octaves (from Minimoog manual) p: 40, 30, 80, 0.01)) p: : ba.pianokey2hz was in mr2 Note that VCF has three sources of corner-frequency setting that are added together: - Corner Freq knob (40 Hz to 20 kHz) - VCF Contour envelope (0 to 4 octaves) - Injection 32 of Modulation Mix (0 to 1.5 octaves) Manual says maximum vcf sweep spans 0 to 4 octaves: Original Knob went to 10, but we're going to 4 so we can say the knob is in "octaves" units: in octaves We are assuming that the modulation-mix range for the VCF freq is 1.5 octaves like it is for oscs 1 and 2: octaves FIXME: Start w freqLogHz not freq so we don't need exp(log()) here FIXME: ARBITRARILY centering on middle C - check device minus the open-loop location of all four poles frequency-scaling parameter for bilinear xform fourth root of Moog VCF feedback gain Attack, Decay, and Sustain ranges are set according to the Minimoog manual: was Staccato was Legato --- Smart Keyboard interface --- --- functions --- Signal controls: MIDI only (see smartkeyb doc) right? Signal Parameters envelopeAmp is multiplied once on entire signal sum elecGuitar.dsp values used: Previous guess: p: MIDI requires frequency in Hz, not piano-keys as we had before Frequency Range is 0.1 Hz to 20 kHz according to the Minimoog manual: MIDI REQUIRES THE FOLLOWING PARAMETER TO BE NAMED 'freq': Oscillator Modulation HrockerRed => apply Modulation Mix output osc1&2 pitches convert 1/e to 1/2 by slowing down exp noise amplitude and off-switch ignored here any offset? This layout loosely follows the MiniMoog-V Arturia-only features are labeled Original versions also added where different Need vrocker and hrocker toggle switches in Faust! Need orange and blue color choices Orange => Connect modulation sources to their destinations Blue => Turn audio sources On and Off - and later - White => Turn performance features On and Off Black => Select between modulation sources Julius Smith for Analog Devices 3/1/2017 USAGE: vrockerorange("[0] ModulationEnable"); Minimoog + Effects Formerly named "Modules" but "Minimoog" group-title is enough Tune knob = master tune Oscillator Modulation HrockerRed => apply Modulation Mix output to osc1&2 pitches [MOVED here from osc3 group] Osc 3 Control VrockerRed => use osc3 as LFO instead of osc3 Glide knob [0:10] = portamento speed Modulation Mix knob [0:10] (between Osc3 and Noise) = mix of noise and osc3 modulating osc1&2 pitch and/or VCF freq UNUSED Control switch (for alignment) - Could put Oscillator Modulation switch there Range rotary switch: LO (slow pulses or rhythm), 32', 16', 8', 4', 2' Frequency <something> switch: LED to right Waveform rotary switch: tri, impulse/bent-triangle, saw, pulseWide, pulseMed, pulseNarrow UNUSED (originall) or Osc 2 Control VrockerRed Range rotary switch: LO, 32', 16', 8', 4', 2' Detuning knob: -7 to 7 [NO SWITCH] Waveform rotary switch: tri, impulse(?), saw, pulseWide, pulseMed, pulseNarrow Osc 3 Control VrockerRed => use osc3 as LFO instead of osc3 Range rotary switch: LO, 32', 16', 8', 4', 2' Detuning knob: -7 to 7 [NO SWITCH] Waveform rotary switch: tri, impulse(?), saw, pulseWide, pulseMed, pulseNarrow Each row 5 slots to maintain alignment and include red rockers joining VCF area: mixer row 1 = Osc1 Volume and Osc1 HrockerBlue & _ & _ & Filter Modulation HrockerRed Filter Modulation => Modulation Mix output to VCF freq row 2 = Ext In HrockerBlue and Vol and Overload LED and Keyboard Ctl HrockerRed 1 = Osc2 Volume and Osc2 HrockerBlue and Keyboard Ctl HrockerRed 2 Keyboard Control Modulation 1&2 => 0, 1/3, 2/3, all of Keyboard Control Signal ("gate?") applied to VCF freq = Noise HrockerBlue and Volume and Noise Type VrockerBlue = Noise Off and White/Pink selection two rockers Osc3 Volume and Osc3 HrockerBlue Filter Modulation switch VCF Off switch Corner Frequency knob Filter Emphasis knob Amount of Contour knob Attack Time knob Decay Time knob Sustain Level knob Attack Time knob Decay Time knob Sustain Level knob Volume knob [0-10] Unison switch (Arturia) or Output connect/disconnect switch (original) When set, all voices are stacked and instrument is in mono mode Voice Detune knob [0-10] (Arturia) or Polyphonic switch [red LED below] (Arturia) When set, instrument is in polyphonic mode with one oscillator per key Soft Clipping switch [red LED above] Keyboard was 3 1/2 octaves Arturia Glide Hrocker (see original Button version below) Decay Hrocker (see original Button version below) => Sets Release (R) of ADSR to either 0 or Decay (R) Legato Hrocker (not in original) Using Glide/Decay/Legato enables above following Arturia: dg(x) = s2g(hgroup("[2] Glide and Decay momentary pushbuttons", x)); Glide Button injects portamento as set by Glide knob Decay Button uses decay of Loudness Contour (else 0) leave slot 1 open for sustain (below)
import("stdfaust.lib"); main = (signal + attach(extInput,amp) : filters : *(ampScaling)) ~ _; signal = oscs + noise * noiseOff * namp; oscs = par(i,3,(oscamp(i+1)*osc(i+1))) :> _; detuneOctaves(1) = osc1(vslider("[2] DeTuning1 [units:Octaves] [midi:ctrl 24] [style:knob]",0.0,-1.0,1.0,0.001)); waveSelect(1) = osc1(vslider("[3] Waveform1 [midi:ctrl 25] [style:knob]",5,0,5,1):int); amp1Enable = mr1(vslider("[1] On [midi:ctrl 12] [style:knob] [color:blue]",1,0,1,1)); oscamp(1) = mr1(vslider("[0] Osc1 Amp [midi:ctrl 26] [style:knob]",0.5,0.0,1.0,0.001)) * amp1Enable; sei = mr2(vslider("[0] Ext Input [midi:ctrl 27] [style: knob]",0,0,1.0,0.001)); extInput(fb,extSig) = fb,extSig : select2(eei) : *(sei) : extClipLED; extClipLED = _ <: _, (abs : >(0.95) : mr2(vbargraph("[2] Ext Input Clip [style:led]",0,1)):!); keycLED = attach(mr2(vbargraph("[3] Keyboard Ctl [style:led]",0,1))); detuneOctaves(2) = osc2(vslider("[2] DeTuning2 [units:Octaves] [midi:ctrl 29] [style:knob]",0.41667,-1.0,1.0,0.001)); waveSelect(2) = osc2(vslider("[3] Waveform2 [midi:ctrl 30] [style:knob]",5,0,5,1):int); amp2Enable = mr3(vslider("[1] On [midi:ctrl 14] [style:knob] [color:blue]",1,0,1,1)); oscamp(2) = mr3(vslider("[0] Osc2 Amp [midi:ctrl 31] [style:knob]",0.5,0.0,1.0,0.001)) * amp2Enable; namp = mr4(vslider("[0] Noise Amp [midi:ctrl 32] [style: knob]",0.0,0.0,1.0,0.001)); noiseOff = mr4cbg(vslider("[0] On [midi:ctrl 15] [style:knob] [color:blue]",0,0,1,1)); ntype = mr4cbg(vslider("[1] White/Pink [midi:ctrl 16] [tooltip: Choose either White or Pink Noise] [style: knob] [color:blue]",1,0,1,1)); detuneOctaves(3) = osc3(vslider("[2] DeTuning3 [units:Octaves] [midi:ctrl 34] [style:knob]",0.3,-1.0,1.0,0.001)); waveSelect(3) = osc3(vslider("[3] Waveform3 [midi:ctrl 35] [style:knob]",0,0,5,1):int); amp3Enable = mr5(vslider("[1] On [midi:ctrl 17] [style:knob] [color:blue]",0,0,1,1)); oscamp(3) = mr5(vslider("[0] Osc3 Amp [midi:ctrl 36] [style:knob]",0.5,0.0,1.0,0.001)) * amp3Enable; waveforms(i) = (tri(i), bent(i), saw(i), sq(i), ptm(i), ptn(i)); modulationShift = select2(oscModEnable, 0.0, modWheelShift * ( modulationCenterShift + (1.0-modulationCenterShift) * oscNoiseModulation )); octaveShift(i) = -2+int(octaveSelect(i)); keyFreqGlidedMaybe = select2(osc3Control,osc3FixedFreq,keyFreqGlided); detuneBoost(3) = select2(osc3Control,3.0,1.0); detuneOctavesFinal(i) = detuneOctaves(i)*detuneBoost(i); fBase(i) = keyFreqModulatedShifted(i) * pow(2.0, (masterTuneOctaves+octaveShift(i)+detuneOctavesFinal(i))) : si.smooth(ba.tau2pole(0.016)); lfoMode(i) = (octaveSelect(i) == 0); osc(i) = ba.selectn(6, int(waveSelect(i)), tri(i), bent(i), saw(i), sq(i), ptm(i), ptn(i)); tri(i) = select2(lfoMode(i), os.triangle(f(i)), os.lf_triangle(f(i))); saw(i) = select2(lfoMode(i), os.sawtooth(f(i)), os.lf_saw(f(i))); sq(i) = select2(lfoMode(i), os.square(f(i)), os.lf_squarewave(f(i))); os.pulsetrain(f(i),0.25), lf_pulsetrain(f(i),0.25)); ptn(i) = select2(lfoMode(i), os.pulsetrain(f(i),0.125), lf_pulsetrain(f(i),0.125)); lf_pulsetrain(freq,duty) = 2.0*os.lf_pulsetrainpos(freq,duty) - 1.0; fcLgHz = vcf1(vslider("[1] Corner Freq [unit:Log2(Hz)] [tooltip: Corner resonance frequency in Log2(Hertz)] [style: knob] : si.smooth(ba.tau2pole(0.016)); res = vcf1(vslider("[2] Corner Resonance [midi:ctrl 37] [tooltip: Resonance Q at VCF corner frequency (0 to 1)] [style: knob]", 0.7, 0, 1, 0.01)); vcfKeyRange = vcf1cbg(vslider("[2] Kbd Ctl [midi:ctrl 38] [tooltip: Keyboard tracking of VCF corner-frequency (0=none, 1=full)] [style: knob]", vcfModEnable = vcf1cbg(vslider("[1] Filter Mod. [midi:ctrl 19] [color:red] [style:knob] [tooltip: Filter Modulation => Route Modulation Mix output to VCF frequency]",1,0,1,1)); vcfContourAmountOctaves = vcf1(vslider("[3] Amount of Contour (octaves) [midi:ctrl 39] [style: knob]", 1.2, 0, 4.0, 0.001)); vcfModulationOctaves = vcfModMixModulationOctaves + vcfContourOctaves; vcfKeyShiftOctaves = vcfKeyRange * keyShiftOctaves; modulatedFcLgHz = fcLgHz + vcfModulationOctaves + vcfKeyShiftOctaves; fc = min((0.5*ma.SR), pow(2.0,modulatedFcLgHz)); vcf = moog_vcf_2bn(res,fc) with { moog_vcf_2bn(res,fr) = fi.tf2snp(0,0,b0,a11,a01,w1) : fi.tf2snp(0,0,b0,a12,a02,w1) with { b0 = s^2; s2k = sqrt(2) * k; a11 = s * (2 + s2k); a12 = s * (2 - s2k); a01 = b0 * (1 + s2k + k^2); a02 = b0 * (1 - s2k + k^2); }; }; attT60VCF = 0.001 * vcf2(vslider("[0] AttackF [midi:ctrl 40] [tooltip: Attack Time] [unit:ms] [style: knob]",1400,10,10000,1)); decT60VCF = 0.001 * vcf2(vslider("[0] DecayF [midi:ctrl 41] [tooltip: Decay-to-Sustain Time] [unit:ms] [style: knob]",10,10,10000,1)); susLvlVCF = vcf2(vslider("[0] SustainF [midi:ctrl 42] [tooltip: Sustain level as percent of max] [style: knob]",80,0,100,0.1)); relT60VCF = select2(decayButton,0.010,decT60VCF); envelopeVCF = en.adsre(attT60VCF,decT60VCF,susLvlVCF,relT60VCF,gate); declare interface "SmartKeyboard{ 'Number of Keyboards':'2', 'Keyboard 0 - Number of Keys':'13', 'Keyboard 1 - Number of Keys':'13', 'Keyboard 0 - Lowest Key':'72', 'Keyboard 1 - Lowest Key':'60' }"; keyDownHold = gg(vslider("[0] gateHold [tooltip: lock sustain pedal on (hold gate set at 1)][style:knob]",0,0,1,1)); keyDown = gg(button("[1] gate [tooltip: The gate signal is 1 during a note and 0 otherwise. For MIDI, NoteOn occurs when the gate transitions from 0 to 1, and NoteOff is an event corresponding to the gate transition from 1 to 0. The name of this Faust button must be 'gate'.]")); sustain = gg(button("[1] sustain [midi:ctrl 64] gate = keyDown + keyDownHold + sustain : min(1); attT60 = 0.001 * ng(vslider("[0] AttackA [midi:ctrl 43] [tooltip: Attack Time] [unit:ms] [style: knob]",2,0,5000,0.1)); decT60 = 0.001 * ng(vslider("[0] DecayA [midi:ctrl 44] [tooltip: Decay-to-Sustain Time] [unit:ms] [style: knob]",10,0,10000,0.1)); susLvl = ng(vslider("[0] SustainA [midi:ctrl 45] [tooltip: Sustain level as percent of max] [style: knob]",80,0,100,0.1)); envelopeAmpNoAM = en.adsre(attT60,decT60,susLvl,relT60,gate); AMDepth = 0.5; envelopeAmp = select2(oscModEnable, envelopeAmpNoAM, envelopeAmpNoAM * (1.0 + AMDepth*modWheel * 0.5 * (1.0+oscNoiseModulation))); ampL = volg(vslider("[1] gain [style:knob] [tooltip: Amplitude]",0.2,0,1.0,0.001)); bend = wg(hslider("[0] bend [style:knob] [midi:pitchwheel]",1,0.001,10,0.01)) : si.polySmooth(gate,0.999,1); modWheel = wg(vslider("[1] mod [midi:ctrl 1] [style:knob] [tooltip: PitchModulation amplitude in octaves]", 0,0,1.0,0.01)) : si.polySmooth(gate,0.999,1); keyFreqBent = bend * kg(hslider("[2] freq [unit:Hz] [style:knob]",220,0.1,20000,0.1)); masterVolume = vg(vslider("MasterVolume [style:knob] [midi:ctrl 7] [tooltip: master volume, MIDI controlled]", 0.7,0,1,0.001)) : si.smooth(ba.tau2pole(0.16)); masterTuneOctaves = dg(vslider("[0] Tune [midi:ctrl 47] [unit:Octaves] [style:knob] [tooltip: Frequency-shift up or down for all oscillators in Octaves]", 0.0,-1.0,1.0,0.001)); glide = gmmg(vslider("[0] Glide [midi:ctrl 5] [unit:sec/octave] [style:knob] [scale:log] [tooltip: Portamento (frequency-glide) in seconds per octave]", 0.008,0.001,1.0,0.001)); keyFreqGlided = keyFreqBent : si.smooth(legatoPole); mmix = gmmg(vslider("[1] Mod. Mix [midi:ctrl 48] [style:knob] [tooltip: Modulation Mix: Osc3 (0) to Noise (1)]", 0.0,0.0,1.0,0.001)); osc3Control = dsg(vslider("[1] Osc. 3 Ctl [midi:ctrl 9] [color:red] [style:knob] [tooltip:Oscillator 3 frequency tracks the keyboard if on, else not",0,0,1,1):int); vrocker(x) = checkbox("%%x [style:vrocker]"); hrocker(x) = checkbox("%%x [style:hrocker]"); vrockerblue(x) = checkbox("%x [style:vrocker] [color:blue]"); vrockerblue(x) = checkbox("%x [style:vrocker] [color:blue]"); hrockerblue(x) = checkbox("%%x [style:hrocker] [color:blue]"); vrockerred(x) = checkbox("%%x [style:vrocker] [color:red]"); hrockerred(x) = checkbox("%%x [style:hrocker] [color:red]"); declare designer "Robert A. Moog"; synthg(x) = mmg(vgroup("[0] Minimoog",x)); fxg(x) = mmg(hgroup("[1] Effects",x)); mg(x) = synthg(hgroup("[0]",x)); vg(x) = cg(hgroup("[0] Master Volume", x)); dg(x) = cg(hgroup("[1] Oscillator Tuning & Switching", x)); dsg(x) = dg(vgroup("[1] Switches", x)); gmmg(x) = cg(hgroup("[2] Glide and ModMix", x)); og(x) = mg(vgroup("[1] Oscillator Bank", x)); osc1(x) = og(hgroup("[1] Oscillator 1", x)); osc2(x) = og(hgroup("[2] Oscillator 2", x)); osc3(x) = og(hgroup("[3] Oscillator 3", x)); mixg(x) = mg(vgroup("[2] Mixer", x)); modg(x) = mg(vgroup("[3] Modifiers", x)); vcfg(x) = modg(vgroup("[0] Filter", x)); vcf1(x) = vcfg(hgroup("[0] [tooltip:freq, Q, ContourScale]", x)); vcf1cbg(x) = vcf1(vgroup("[0] [tooltip:two checkboxes]", x)); vcf2(x) = vcfg(hgroup("[1] Filter Contour [tooltip:AttFilt, DecFilt, Sustain Level for Filter Contour]", x)); ng(x) = modg(hgroup("[1] Loudness Contour", x)); echog(x) = fxg(hgroup("[4] Echo",x)); ekg(x) = echog(vgroup("[0] Knobs",x)); esg(x) = echog(vgroup("[1] Switches",x)); flg(x) = fxg(hgroup("[5] Flanger",x)); flkg(x) = flg(vgroup("[0] Knobs",x)); flsg(x) = flg(vgroup("[1] Switches",x)); chg(x) = fxg(hgroup("[6] Chorus",x)); ckg(x) = chg(vgroup("[0] Knobs",x)); csg(x) = chg(vgroup("[1] Switches",x)); rg(x) = fxg(hgroup("[7] Reverb",x)); rkg(x) = rg(vgroup("[0] Knobs",x)); rsg(x) = rg(vgroup("[1] Switches",x)); outg(x) = fxg(vgroup("[8] Output", x)); volg(x) = outg(hgroup("[0] Volume Main Output", x)); tunerg(x) = outg(hgroup("[1] A-440 Switch", x)); vdtpolyg(x) = outg(hgroup("[2] Voice Detune / Poly", x)); clipg(x) = fxg(vgroup("[9] Soft Clip", x)); ws(x) = kg(vgroup("[0] Wheels and Switches", x)); s1g(x) = ws(hgroup("[0] Jacks and Rockers", x)); jg(x) = s1g(vgroup("[0] MiniJacks",x)); s2g(x) = ws(hgroup("[1] [tooltip:Wheels+]", x)); bg(x) = s2g(vgroup("[0] [tooltip:Bend Enable and Range]", x)); wg(x) = s2g(hgroup("[1] [tooltip:Bend and Mod Wheels]", x)); keys(x) = kg(hgroup("[1] [tooltip:Keys]", x)); gg(x) = keys(hgroup("[0] [tooltip: Gates]",x));
e09af7121e7131e2df9996f4439e9cc763a32d3d0788171d8729d75f8f962a3a
danidev/microcosmos
MicrocosmosDsp.dsp
import("stdfaust.lib"); page(num, x) = hgroup("page%num", x); note = hslider("note", 64, 0, 127, 1); gate = button("gate"); duty = page(1, hslider("[0]duty[style:knob]", 0.5, 0, 1, .1) : si.smoo); osc1vol = page(1, hslider("[1]vol_a[style:knob]", 0.5, 0, 1, 0.1) : si.smoo); osc2vol = page(1, hslider("[2]vol_b[style:knob]", 0, 0, 1, 0.1) : si.smoo); osc3vol = page(1, hslider("[3]vol_c[style:knob]", 0, 0, 1, 0.1) : si.smoo); cutoff = page(2, hslider("[0]cutoff[style:knob]", 5000, 50, 10000, 0.1) : si.smoo); resonance = page(2, hslider("[1]resonance[style:knob]", 1, 1, 15, 0.1) : si.smoo); noiseVol = page(2, hslider("[2]noise[style:knob]", 0, 0, 1, 0.1) : si.smoo); env1A = page(3, hslider("[0]1a[style:knob]", 0.01, 0.01, 4.5, 0.1) : si.smoo); env1D = page(3, hslider("[1]2d[style:knob]", 0.01, 0.01, 4.5, 0.1) : si.smoo); env1S = page(3, hslider("[2]3s[style:knob]", 1, 0, 1, 0.1) : si.smoo); env1R = page(3, hslider("[3]4r[style:knob]", 0.01, 0.01, 4.5, 0.1) : si.smoo); envPitch = page(4, hslider("[0]pitch_env[style:knob]", 0, 0, 1, 0.1) : si.smoo); envDuty = page(4, hslider("[1]duty_env[style:knob]", 0, 0, 1, 0.1) : si.smoo); envFilter = page(4, hslider("[2]cutoff_env[style:knob]", 0, 0, 1, 0.1) : si.smoo); lfoSpeed = page(5, hslider("[0]lfo_1_freq[style:knob]", 1, 0.01, 8.0, 0.1) : si.smoo); lfoPitch = page(5, hslider("[1]pitch_lfo[style:knob]", 0, 0, 1, 0.1) : si.smoo); lfoDuty = page(5, hslider("[2]duty_lfo[style:knob]", 0, 0, 1, 0.1) : si.smoo); lfoFilter = page(5, hslider("[3]cutoff_lfo[style:knob]", 0, 0, 1, 0.1) : si.smoo); // modulations lfo = os.lf_triangle(lfoSpeed); env = en.adsr(env1A, env1D, env1S, env1R, gate); freq = ba.midikey2hz(note) + ba.midikey2hz(note) * lfo * lfoPitch + ba.midikey2hz(note) * env * envPitch; pwm = duty + duty * lfo * lfoDuty + duty * env * envDuty; filterFreq = cutoff + cutoff * lfo * lfoFilter + cutoff * env * envFilter; osc1 = os.pulsetrain(freq, pwm); osc2 = os.sawtooth(freq); osc3 = os.pulsetrain(freq/2, 0.5); noise = no.noise; mixer = osc1 * osc1vol, osc2 * osc2vol, osc3 * osc3vol, noise * noiseVol :> _; filter = fi.resonlp(filterFreq, resonance, 0.9); process = mixer : filter * env <: _,_;
https://raw.githubusercontent.com/danidev/microcosmos/27b8c35df97aba336b546cca7c6dd4ec802eed30/dsp/syxtyofjune/dsp/MicrocosmosDsp.dsp
faust
modulations
import("stdfaust.lib"); page(num, x) = hgroup("page%num", x); note = hslider("note", 64, 0, 127, 1); gate = button("gate"); duty = page(1, hslider("[0]duty[style:knob]", 0.5, 0, 1, .1) : si.smoo); osc1vol = page(1, hslider("[1]vol_a[style:knob]", 0.5, 0, 1, 0.1) : si.smoo); osc2vol = page(1, hslider("[2]vol_b[style:knob]", 0, 0, 1, 0.1) : si.smoo); osc3vol = page(1, hslider("[3]vol_c[style:knob]", 0, 0, 1, 0.1) : si.smoo); cutoff = page(2, hslider("[0]cutoff[style:knob]", 5000, 50, 10000, 0.1) : si.smoo); resonance = page(2, hslider("[1]resonance[style:knob]", 1, 1, 15, 0.1) : si.smoo); noiseVol = page(2, hslider("[2]noise[style:knob]", 0, 0, 1, 0.1) : si.smoo); env1A = page(3, hslider("[0]1a[style:knob]", 0.01, 0.01, 4.5, 0.1) : si.smoo); env1D = page(3, hslider("[1]2d[style:knob]", 0.01, 0.01, 4.5, 0.1) : si.smoo); env1S = page(3, hslider("[2]3s[style:knob]", 1, 0, 1, 0.1) : si.smoo); env1R = page(3, hslider("[3]4r[style:knob]", 0.01, 0.01, 4.5, 0.1) : si.smoo); envPitch = page(4, hslider("[0]pitch_env[style:knob]", 0, 0, 1, 0.1) : si.smoo); envDuty = page(4, hslider("[1]duty_env[style:knob]", 0, 0, 1, 0.1) : si.smoo); envFilter = page(4, hslider("[2]cutoff_env[style:knob]", 0, 0, 1, 0.1) : si.smoo); lfoSpeed = page(5, hslider("[0]lfo_1_freq[style:knob]", 1, 0.01, 8.0, 0.1) : si.smoo); lfoPitch = page(5, hslider("[1]pitch_lfo[style:knob]", 0, 0, 1, 0.1) : si.smoo); lfoDuty = page(5, hslider("[2]duty_lfo[style:knob]", 0, 0, 1, 0.1) : si.smoo); lfoFilter = page(5, hslider("[3]cutoff_lfo[style:knob]", 0, 0, 1, 0.1) : si.smoo); lfo = os.lf_triangle(lfoSpeed); env = en.adsr(env1A, env1D, env1S, env1R, gate); freq = ba.midikey2hz(note) + ba.midikey2hz(note) * lfo * lfoPitch + ba.midikey2hz(note) * env * envPitch; pwm = duty + duty * lfo * lfoDuty + duty * env * envDuty; filterFreq = cutoff + cutoff * lfo * lfoFilter + cutoff * env * envFilter; osc1 = os.pulsetrain(freq, pwm); osc2 = os.sawtooth(freq); osc3 = os.pulsetrain(freq/2, 0.5); noise = no.noise; mixer = osc1 * osc1vol, osc2 * osc2vol, osc3 * osc3vol, noise * noiseVol :> _; filter = fi.resonlp(filterFreq, resonance, 0.9); process = mixer : filter * env <: _,_;
18e595bcdd87dfd03c8984b7d29fe2f36a76ce8c3b7f4d5c6676e7028bae110d
danidev/microcosmos
MicrocosmosDsp.dsp
declare name "MicrocosmosDsp"; import("stdfaust.lib"); map(x, in_min, in_max, out_min, out_max) = (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min; page(num, x) = hgroup("page%num", x); // LOOPER SECTION sampleRate = 48000; maxTime = 1; maxSamples = sampleRate * maxTime; looperModule(num) = out with { // PARAMETERS readSpeed = page(num, map(hslider("[0]read_speed_%num[style:knob]", 64, 0, 127, 1) : si.smoo, 0, 127, 0, 3)); loopLength = page(num, map(hslider("[1]loop_length_%num[style:knob]", 127, 0, 127, 1) : si.smoo, 0, 127, 0, 1)); volume = page(num, map(hslider("[2]volume_%num[style:knob]", 127, 0, 127, 1) : si.smoo, 0, 127, 0, 1)); rate = page(num, hslider("[3]rate_%num[style:knob]", 1, 1, 20, 0.1)); btnRecording = page(num, button("[4]rec_%num")); btnPlay = page(num, ba.toggle(button("[5]gate_%num"))); stutterActive = page(num, ba.toggle(button("[6]stutter_%num"))); // loop size is the duration while button is kept pressed loopSize = ba.sAndH(btnRecording, fi.pole(btnRecording, btnRecording)) : int : page(num, hbargraph("[7]loop_size_%num", 0, maxSamples)); // rec index is from 0 to maxSamples while button is pressed recIndex = (+(1) : %(maxSamples)) ~ *(btnRecording) : int : page(num, hbargraph("[8]rec_index_%num", 0, maxSamples)); // do not change loop size while recording prevLoopSize = loopSize : ba.sAndH(btnRecording == 0); memoLoopSize = prevLoopSize, loopSize : ba.selectn(2, btnRecording == 0); // avoid division by zero / NAN using max calculatedLoopLength = (memoLoopSize * loopLength), ma.EPSILON : max; // clamp to maxSamples clampedLoopLength = ba.if(calculatedLoopLength<maxSamples, calculatedLoopLength, maxSamples); // read index is from 0 to calculatedLoopLength continously readIndex = (+(1 * readSpeed) : %(clampedLoopLength)) ~_ : int : page(hbargraph("[9]read_index_%num", 0, maxSamples)); looper = rwtable(maxSamples,0.0,recIndex,_,readIndex) * volume; stutter = os.lf_pulsetrainpos(rate, 0.5); out = looper * (1,stutter : ba.selectn(2, stutterActive)) * btnPlay; }; process = _ <: (looperModule(1), looperModule(2)) :> _ <: _,_;
https://raw.githubusercontent.com/danidev/microcosmos/27b8c35df97aba336b546cca7c6dd4ec802eed30/dsp/looper/dsp/MicrocosmosDsp.dsp
faust
LOOPER SECTION PARAMETERS loop size is the duration while button is kept pressed rec index is from 0 to maxSamples while button is pressed do not change loop size while recording avoid division by zero / NAN using max clamp to maxSamples read index is from 0 to calculatedLoopLength continously
declare name "MicrocosmosDsp"; import("stdfaust.lib"); map(x, in_min, in_max, out_min, out_max) = (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min; page(num, x) = hgroup("page%num", x); sampleRate = 48000; maxTime = 1; maxSamples = sampleRate * maxTime; looperModule(num) = out with { readSpeed = page(num, map(hslider("[0]read_speed_%num[style:knob]", 64, 0, 127, 1) : si.smoo, 0, 127, 0, 3)); loopLength = page(num, map(hslider("[1]loop_length_%num[style:knob]", 127, 0, 127, 1) : si.smoo, 0, 127, 0, 1)); volume = page(num, map(hslider("[2]volume_%num[style:knob]", 127, 0, 127, 1) : si.smoo, 0, 127, 0, 1)); rate = page(num, hslider("[3]rate_%num[style:knob]", 1, 1, 20, 0.1)); btnRecording = page(num, button("[4]rec_%num")); btnPlay = page(num, ba.toggle(button("[5]gate_%num"))); stutterActive = page(num, ba.toggle(button("[6]stutter_%num"))); loopSize = ba.sAndH(btnRecording, fi.pole(btnRecording, btnRecording)) : int : page(num, hbargraph("[7]loop_size_%num", 0, maxSamples)); recIndex = (+(1) : %(maxSamples)) ~ *(btnRecording) : int : page(num, hbargraph("[8]rec_index_%num", 0, maxSamples)); prevLoopSize = loopSize : ba.sAndH(btnRecording == 0); memoLoopSize = prevLoopSize, loopSize : ba.selectn(2, btnRecording == 0); calculatedLoopLength = (memoLoopSize * loopLength), ma.EPSILON : max; clampedLoopLength = ba.if(calculatedLoopLength<maxSamples, calculatedLoopLength, maxSamples); readIndex = (+(1 * readSpeed) : %(clampedLoopLength)) ~_ : int : page(hbargraph("[9]read_index_%num", 0, maxSamples)); looper = rwtable(maxSamples,0.0,recIndex,_,readIndex) * volume; stutter = os.lf_pulsetrainpos(rate, 0.5); out = looper * (1,stutter : ba.selectn(2, stutterActive)) * btnPlay; }; process = _ <: (looperModule(1), looperModule(2)) :> _ <: _,_;
2b3f9ca0ada119e06dec6b7740f55378684bda4a1e38e388ef299b6a74cb2635
magnetophon/LazyLimiter
LazyLimiter.dsp
/* * Copyright (C) 2014 Bart Brouns * This program 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; version 2 of the License. * * This program 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. */ /*some building blocks where taken from or inspired by compressor-basics.dsp by Sampo Savolainen*/ declare name "LazyLimiter"; declare author "Bart Brouns"; declare version "0.3.2"; declare copyright "(C) 2014 Bart Brouns"; import ("GUI.lib"); import ("LazyLimiter.lib"); //process = stereoGainComputer; //process = naiveStereoLimiter; //process = ( 0:seq(i,maxHoldTime,(currentdown(x)@(i):max(lastdown)),_: min )); //process(x,y) = (((Lookahead(x):releaseEnv(minRelease)),(Lookahead(y):releaseEnv(minRelease))):min)~(+(inGain@maxHoldTime)):meter:ba.db2linear<:(_*x@maxHoldTime,_*y@maxHoldTime); //(((Lookahead(x):releaseEnv(minRelease)),(Lookahead(y):releaseEnv(minRelease))):min)~(_<:(_,_))+(inGain@maxHoldTime):meter:ba.db2linear<:(_*x@maxHoldTime,_*y@maxHoldTime); //simpleStereoLimiter; //process = slidemax(5,8); //process = minimalStereoLimiter; /*process(x) =*/ /*0: seq(i,maxAttackTime,*/ /*(currentdown(x)@(i+1-maxAttackTime+maxHoldTime))*/ /**(((i+1)/maxAttackTime))*/ /*,_: min*/ /*);*/ /*process =*/ /*(0,_):seq(i,maxAttackTime,*/ /*(*/ /*(_,*/ /*(*/ /*((_')<:(_,_)):*/ /*(*/ /*(_ *(((i+1)/maxAttackTime)))*/ /*,_*/ /*)*/ /*)*/ /*)*/ /*:min,_*/ /*)*/ /*) ;*/ /*process(x) = pmin(currentdown(x),0,4)*/ /*with {*/ /*pmin(del,mini,1) =del', ((del *((maxAttackTime/maxAttackTime))) ,mini : min);*/ /*pmin(del,mini,k) = del,(((pmin(del@(1),mini,(k-1))):(_*(((maxAttackTime-k+1)/maxAttackTime))),_) : (min));*/ /*};*/ //process =avgMeter(inGain); //process(x,y) = (stereoGainComputerHalf(x,y),stereoGainComputerHalf(y,x))~(ro.cross(2)); //(stereoGainComputerHalf(x,y),stereoGainComputerHalf(y,x))~((_,_ <: !,_,_,!),_) process = stereoLimiter; // process = naiveStereoLimiter; // process = minimalStereoLimiter; // process(x) = block_hold(x); // process(x) = Yann_hold(x); // process = ((fixed_hold(maxWinSize)@(5):max(lastdown)),_): min ; // Lookahead(x,lastdown,avgLevel) = //(((_,(_,((_,_):Lookahead(y)):min)):linearXfade(link)):releaseEnv(minRelease):rateLimit); //(((_,(_<:_,_)):(Lookahead(x)<:_,_),(_<:_,_)):ro.interleave(2,2)); //(((_,(_,Lookahead(y,prevy,avgLevely):min)):linearXfade(link)):releaseEnv(minRelease):rateLimit); //GOOD: //process(x,y,prevy) = /*(*/ /*(((_,(_,((prevy,_):Lookahead(y)):min)):linearXfade(link)):releaseEnv(minRelease):(rateLimit))*/ /*~(((_<:(_,_)),_):((ro.cross(2):Lookahead(x)<:_,_),_))*/ /*):(_,!);*/ /*(*/ /*(((_,(_,(prevy:Lookahead(y,_)):min)):linearXfade(link)):releaseEnv(minRelease):rateLimit)*/ /*~((Lookahead(x)<:_,_),_)*/ /*);*/ /*(*/ /*(((_,(_,((prevy:Lookahead(y),_):(_,!)):min)):linearXfade(link)):releaseEnv(minRelease):rateLimit)*/ /*~((Lookahead(x)<:_,_),_):(_,!)*/ /*);*/ //process(x)= rdtable(maxAttackTime, (5) ,int(x*maxAttackTime)); //process(x)= rdtable(int(maxAttackTime), ma.tanh((6/maxAttackTime):pow(1:attackScale)),int(x*maxAttackTime)); /*process(x)= rdtable(maxAttackTime, ( ma.tanh((6/maxAttackTime):pow(attack:attackScale)*(attack*5+.1))/ma.tanh(attack*5+.1)),int(x*maxAttackTime))*/ /*with { attack = 1; };*/ /*attackScale(x) = (x+1):pow(7);*/ //process = rateLimiter; //process = SMOOTH(3,4); /*process(x) = 0:seq(i,maxHoldTime,*/ /*(((i+1)>(maxHoldTime-holdTime))*(currentdown(x)@(i):max(lastdown))),_: min */ /*)*/ /*with { maxHoldTime = 1024; holdTime = 4; lastdown = no.noise;};*/
https://raw.githubusercontent.com/magnetophon/LazyLimiter/f3bbb2c4c05858e93710272ec42bda19d8f6a608/LazyLimiter.dsp
faust
* Copyright (C) 2014 Bart Brouns * This program 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; version 2 of the License. * * This program 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. some building blocks where taken from or inspired by compressor-basics.dsp by Sampo Savolainen process = stereoGainComputer; process = naiveStereoLimiter; process = ( 0:seq(i,maxHoldTime,(currentdown(x)@(i):max(lastdown)),_: min )); process(x,y) = (((Lookahead(x):releaseEnv(minRelease)),(Lookahead(y):releaseEnv(minRelease))):min)~(+(inGain@maxHoldTime)):meter:ba.db2linear<:(_*x@maxHoldTime,_*y@maxHoldTime); (((Lookahead(x):releaseEnv(minRelease)),(Lookahead(y):releaseEnv(minRelease))):min)~(_<:(_,_))+(inGain@maxHoldTime):meter:ba.db2linear<:(_*x@maxHoldTime,_*y@maxHoldTime); simpleStereoLimiter; process = slidemax(5,8); process = minimalStereoLimiter; process(x) = 0: seq(i,maxAttackTime, (currentdown(x)@(i+1-maxAttackTime+maxHoldTime)) *(((i+1)/maxAttackTime)) ,_: min ); process = (0,_):seq(i,maxAttackTime, ( (_, ( ((_')<:(_,_)): ( (_ *(((i+1)/maxAttackTime))) ,_ ) ) ) :min,_ ) ) ; process(x) = pmin(currentdown(x),0,4) with { pmin(del,mini,1) =del', ((del *((maxAttackTime/maxAttackTime))) ,mini : min); pmin(del,mini,k) = del,(((pmin(del@(1),mini,(k-1))):(_*(((maxAttackTime-k+1)/maxAttackTime))),_) : (min)); }; process =avgMeter(inGain); process(x,y) = (stereoGainComputerHalf(x,y),stereoGainComputerHalf(y,x))~(ro.cross(2)); (stereoGainComputerHalf(x,y),stereoGainComputerHalf(y,x))~((_,_ <: !,_,_,!),_) process = naiveStereoLimiter; process = minimalStereoLimiter; process(x) = block_hold(x); process(x) = Yann_hold(x); process = ((fixed_hold(maxWinSize)@(5):max(lastdown)),_): min ; Lookahead(x,lastdown,avgLevel) = (((_,(_,((_,_):Lookahead(y)):min)):linearXfade(link)):releaseEnv(minRelease):rateLimit); (((_,(_<:_,_)):(Lookahead(x)<:_,_),(_<:_,_)):ro.interleave(2,2)); (((_,(_,Lookahead(y,prevy,avgLevely):min)):linearXfade(link)):releaseEnv(minRelease):rateLimit); GOOD: process(x,y,prevy) = ( (((_,(_,((prevy,_):Lookahead(y)):min)):linearXfade(link)):releaseEnv(minRelease):(rateLimit)) ~(((_<:(_,_)),_):((ro.cross(2):Lookahead(x)<:_,_),_)) ):(_,!); ( (((_,(_,(prevy:Lookahead(y,_)):min)):linearXfade(link)):releaseEnv(minRelease):rateLimit) ~((Lookahead(x)<:_,_),_) ); ( (((_,(_,((prevy:Lookahead(y),_):(_,!)):min)):linearXfade(link)):releaseEnv(minRelease):rateLimit) ~((Lookahead(x)<:_,_),_):(_,!) ); process(x)= rdtable(maxAttackTime, (5) ,int(x*maxAttackTime)); process(x)= rdtable(int(maxAttackTime), ma.tanh((6/maxAttackTime):pow(1:attackScale)),int(x*maxAttackTime)); process(x)= rdtable(maxAttackTime, ( ma.tanh((6/maxAttackTime):pow(attack:attackScale)*(attack*5+.1))/ma.tanh(attack*5+.1)),int(x*maxAttackTime)) with { attack = 1; }; attackScale(x) = (x+1):pow(7); process = rateLimiter; process = SMOOTH(3,4); process(x) = 0:seq(i,maxHoldTime, (((i+1)>(maxHoldTime-holdTime))*(currentdown(x)@(i):max(lastdown))),_: min ) with { maxHoldTime = 1024; holdTime = 4; lastdown = no.noise;};
declare name "LazyLimiter"; declare author "Bart Brouns"; declare version "0.3.2"; declare copyright "(C) 2014 Bart Brouns"; import ("GUI.lib"); import ("LazyLimiter.lib"); process = stereoLimiter;
4653114930368b090ea608459700246fce56d53db478f1e3cf3c2a0dbba868f7
magnetophon/LazyLimiter
HardWorkingLimiterMono.dsp
/* * Copyright (C) 2014 Bart Brouns * This program 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; version 2 of the License. * * This program 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. */ /*some building blocks where taken from or inspired on compressor-basics.dsp by Sampo Savolainen*/ declare name "LookAheadLimiterMono"; declare author "Bart Brouns"; declare version "0.1"; declare copyright "(C) 2014 Bart Brouns"; import ("LookaheadLimiter.lib"); //LookaheadPar needs a power of 2 as a size //the following maxHoldTime related bug-comments only manifest with another implementation of "currentdown" //maxHoldTime = 4; // = 0.1ms //maxHoldTime = 128; // = 3ms //maxHoldTime = 256; // = 6ms //no overs till here, independent of -vec compile option //maxHoldTime = 512; // = 12ms //no overs till here, but only without -vec or with both -vec and -lv 1 maxHoldTime = 1024; // = 23ms //always gives overs with par lookahead, never gives overs with seq lookahead. Unfortunately, seq @ 1024 doesn't like ratelimiter: as soon as it is faded in, we get silence. // seq @ < 1024 works fine... //maxHoldTime = 2048; // = 46ms //maxHoldTime = 8192; // = 186ms //with maxHoldTime = 1024, having maxAttackTime = 512 uses more cpu then maxAttackTime = 1024 maxAttackTime = 1024:min(maxHoldTime); rmsMaxSize = 4096; time_ratio_target = 1.5; //time_ratio_target_atk = hslider("attack time ratio", 1.5, 0.2, 10.0, 0.1); time_ratio_target_atk = 8.0; //time_ratio_target_rel = 4.0; // this could be too slow //time_ratio_target_rel = 1.5; main_group(x) = (hgroup("[1]", x)); meter_group(x) = main_group(hgroup("[1]", x)); knob_group(x) = main_group(vgroup("[2]", x)); detector_group(x) = knob_group(vgroup("[0]detector", x)); post_group(x) = knob_group(vgroup("[1]", x)); ratelimit_group(x) = knob_group(vgroup("[2]ratelimit", x)); shape_group(x) = post_group(vgroup("[0]shape", x)); out_group(x) = post_group(vgroup("[2]", x)); envelop = abs : max ~ -(100.0/ma.SR) ; meter = meter_group(_<:(_, ( (vbargraph("[1]GR[unit:dB][tooltip: gain reduction in dB]", -60, 0)))):attach); mtr = meter_group(_<:(_, ( (vbargraph("punch", 0, 128)))):attach); mymeter = meter_group(_<:(_, ( (vbargraph("[1][unit:dB][tooltip: input level in dB]", 0, 144)))):attach); threshold = knob_group(hslider("[0]threshold [unit:dB] [tooltip: maximum output level]", -12, -60, 0, 0.1)); attack = knob_group(hslider("[1]attack shape[tooltip: attack speed]", 0.841 , 0, 1 , 0.001)); //hardcoding holdTime to maxHoldTime uses more cpu then having a fader! holdTime = knob_group(hslider("[2]hold time[tooltip: maximum hold time]", maxHoldTime, 0, maxHoldTime , 1)); release = knob_group(hslider("[3]lin release[unit:dB/s][tooltip: maximum release rate]", 113, 6, 500 , 1)/ma.SR); logRelease = knob_group(hslider("[4]release time[unit:ms] [tooltip: Time constant in ms (1/e smoothing time) for the compression gain to approach (exponentially) a new higher target level (the compression 'releasing')]",150, 0.1, 500, 0.1)/1000):time_ratio_release; time_ratio_target_rel = knob_group(hslider("[5]release shape", 0.5, 0.2, 5.0, 0.1)); // hardcoding link to 1 leads to much longer compilation times, yet similar cpu-usage, while one would expect less cpu usage and maybe shorter compilation time link = knob_group(hslider("[6]stereo link[tooltip: ]", 1, 0, 1 , 0.001)); ratelimit = knob_group(hslider("[0]ratelimit amount[tooltip: ]", 1, 0, 1 , 0.001)); mult = ratelimit_group(hslider("[3]mult[tooltip: ]", 1 , 0.1,20, 0.1)); IMattack = ratelimit_group(time_ratio_attack(hslider("[6] Attack [unit:ms] [tooltip: Time constant in ms (1/e smoothing time) for the compression gain to approach (exponentially) a new lower target level (the compression `kicking in')]", 23.7, 0.1, 500, 0.1)/1000)) ; IMrelease = ratelimit_group(time_ratio_release(hslider("[7] Release [unit:ms] [tooltip: Time constant in ms (1/e smoothing time) for the compression gain to approach (exponentially) a new higher target level (the compression 'releasing')]",0.1, 0.1, 2000, 0.1)/1000)); maxChange = hslider("[0]maxChange[tooltip: ]", 84 , 1, 144 , 1); decayPower = ratelimit_group(hslider("[4]decayPower[tooltip: ]", 10, 0, 10 , 0.001)); decayMult = ratelimit_group(hslider("[3]decayMult[tooltip: ]", 200 , 0,500, 1))*10; IMpower = ratelimit_group(hslider("[1]IMpower[tooltip: ]", -64 , -128, 0 , 0.001)):limPowerScale; IM_size = ratelimit_group(hslider("[5]IM_size[tooltip: ]",108, 1, rmsMaxSize, 1)*44100/ma.SR); //0.0005 * min(192000.0, max(22050.0, ma.SR)); process = limiter; //process = naiveStereoLimiter; //process = simpleStereoLimiter; //process = stereoLimiter;
https://raw.githubusercontent.com/magnetophon/LazyLimiter/f3bbb2c4c05858e93710272ec42bda19d8f6a608/docs/HardWorkingLimiterMono.dsp
faust
* Copyright (C) 2014 Bart Brouns * This program 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; version 2 of the License. * * This program 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. some building blocks where taken from or inspired on compressor-basics.dsp by Sampo Savolainen LookaheadPar needs a power of 2 as a size the following maxHoldTime related bug-comments only manifest with another implementation of "currentdown" maxHoldTime = 4; // = 0.1ms maxHoldTime = 128; // = 3ms maxHoldTime = 256; // = 6ms //no overs till here, independent of -vec compile option maxHoldTime = 512; // = 12ms //no overs till here, but only without -vec or with both -vec and -lv 1 = 23ms //always gives overs with par lookahead, never gives overs with seq lookahead. Unfortunately, seq @ 1024 doesn't like ratelimiter: as soon as it is faded in, we get silence. seq @ < 1024 works fine... maxHoldTime = 2048; // = 46ms maxHoldTime = 8192; // = 186ms with maxHoldTime = 1024, having maxAttackTime = 512 uses more cpu then maxAttackTime = 1024 time_ratio_target_atk = hslider("attack time ratio", 1.5, 0.2, 10.0, 0.1); time_ratio_target_rel = 4.0; // this could be too slow time_ratio_target_rel = 1.5; hardcoding holdTime to maxHoldTime uses more cpu then having a fader! hardcoding link to 1 leads to much longer compilation times, yet similar cpu-usage, while one would expect less cpu usage and maybe shorter compilation time 0.0005 * min(192000.0, max(22050.0, ma.SR)); process = naiveStereoLimiter; process = simpleStereoLimiter; process = stereoLimiter;
declare name "LookAheadLimiterMono"; declare author "Bart Brouns"; declare version "0.1"; declare copyright "(C) 2014 Bart Brouns"; import ("LookaheadLimiter.lib"); maxAttackTime = 1024:min(maxHoldTime); rmsMaxSize = 4096; time_ratio_target = 1.5; time_ratio_target_atk = 8.0; main_group(x) = (hgroup("[1]", x)); meter_group(x) = main_group(hgroup("[1]", x)); knob_group(x) = main_group(vgroup("[2]", x)); detector_group(x) = knob_group(vgroup("[0]detector", x)); post_group(x) = knob_group(vgroup("[1]", x)); ratelimit_group(x) = knob_group(vgroup("[2]ratelimit", x)); shape_group(x) = post_group(vgroup("[0]shape", x)); out_group(x) = post_group(vgroup("[2]", x)); envelop = abs : max ~ -(100.0/ma.SR) ; meter = meter_group(_<:(_, ( (vbargraph("[1]GR[unit:dB][tooltip: gain reduction in dB]", -60, 0)))):attach); mtr = meter_group(_<:(_, ( (vbargraph("punch", 0, 128)))):attach); mymeter = meter_group(_<:(_, ( (vbargraph("[1][unit:dB][tooltip: input level in dB]", 0, 144)))):attach); threshold = knob_group(hslider("[0]threshold [unit:dB] [tooltip: maximum output level]", -12, -60, 0, 0.1)); attack = knob_group(hslider("[1]attack shape[tooltip: attack speed]", 0.841 , 0, 1 , 0.001)); holdTime = knob_group(hslider("[2]hold time[tooltip: maximum hold time]", maxHoldTime, 0, maxHoldTime , 1)); release = knob_group(hslider("[3]lin release[unit:dB/s][tooltip: maximum release rate]", 113, 6, 500 , 1)/ma.SR); logRelease = knob_group(hslider("[4]release time[unit:ms] [tooltip: Time constant in ms (1/e smoothing time) for the compression gain to approach (exponentially) a new higher target level (the compression 'releasing')]",150, 0.1, 500, 0.1)/1000):time_ratio_release; time_ratio_target_rel = knob_group(hslider("[5]release shape", 0.5, 0.2, 5.0, 0.1)); link = knob_group(hslider("[6]stereo link[tooltip: ]", 1, 0, 1 , 0.001)); ratelimit = knob_group(hslider("[0]ratelimit amount[tooltip: ]", 1, 0, 1 , 0.001)); mult = ratelimit_group(hslider("[3]mult[tooltip: ]", 1 , 0.1,20, 0.1)); IMattack = ratelimit_group(time_ratio_attack(hslider("[6] Attack [unit:ms] [tooltip: Time constant in ms (1/e smoothing time) for the compression gain to approach (exponentially) a new lower target level (the compression `kicking in')]", 23.7, 0.1, 500, 0.1)/1000)) ; IMrelease = ratelimit_group(time_ratio_release(hslider("[7] Release [unit:ms] [tooltip: Time constant in ms (1/e smoothing time) for the compression gain to approach (exponentially) a new higher target level (the compression 'releasing')]",0.1, 0.1, 2000, 0.1)/1000)); maxChange = hslider("[0]maxChange[tooltip: ]", 84 , 1, 144 , 1); decayPower = ratelimit_group(hslider("[4]decayPower[tooltip: ]", 10, 0, 10 , 0.001)); decayMult = ratelimit_group(hslider("[3]decayMult[tooltip: ]", 200 , 0,500, 1))*10; IMpower = ratelimit_group(hslider("[1]IMpower[tooltip: ]", -64 , -128, 0 , 0.001)):limPowerScale; process = limiter;
5873158ce8af86f81ac08f1e6cff62557bbd7e86ad31a0b0fe58b8e3506c1b0b
chevremaudite/zosimos
modsourceUI.dsp
//Modulation source page. //--------------PARAMETERS: // 1 - Mode : Modulation mode (0-free, 1-sync, 2-reset, 3-envelope) /*BUG : currently only free and reset modes work*/ // 2 - Polarity : The LFO's polarity (0-Unipolar[0-1], 1-Bipolar[-1,1]) // 3 - Shape : Mod carrier's waveform (0-sine, 1-tri, 2-saw, 3-square, 4-random) // 4 - Rate : Mod carrier's rate // 5 - Depth : Mod carrier's amplitude // 6 - destVoice : The voice of destination // 7 - destParam : The parameter of destination inside the chosen voice import("modsource.lib"); process = hgroup("Modulation source", modsource(rate, depth, shape, mode, pol, destVoice, destParam, trigger)) with{ trigger = button("T"):ba.impulsify; mode = hslider("[0]Mode [style:menu{'Free':0;'Sync':1;'Reset':2;'Envelope':3}]", 0, 0, 3, 1); pol = hslider("[0]Polarity [style:menu{'Unipolar':0;'Bipolar':1}]", 0, 0, 1, 1); shape = hslider("[1]Shape [style:menu{'Sine':0;'Tri':1;'Saw':2;'Square':3;'Random':4}]", 0, 0, 4, 1); rate = hslider("[2]Rate [style:knob]", 1, 0.01, 20, 0.001) : si.smoo; depth = hslider("[3]Depth [style:knob]", 0, 0, 1, 0.001) : si.smoo; destVoice = hslider("[5]Destination Voice[style:knob]", 1, 1, 8, 1); destParam = hslider("[6]Destination Parameter[style:knob]", 1, 1, 8, 1); };
https://raw.githubusercontent.com/chevremaudite/zosimos/851055add4bd8a970cde22da9e4e4c822f40e43e/SOFTWARE/FAUST/ui/modsourceUI.dsp
faust
Modulation source page. --------------PARAMETERS: 1 - Mode : Modulation mode (0-free, 1-sync, 2-reset, 3-envelope) BUG : currently only free and reset modes work 2 - Polarity : The LFO's polarity (0-Unipolar[0-1], 1-Bipolar[-1,1]) 3 - Shape : Mod carrier's waveform (0-sine, 1-tri, 2-saw, 3-square, 4-random) 4 - Rate : Mod carrier's rate 5 - Depth : Mod carrier's amplitude 6 - destVoice : The voice of destination 7 - destParam : The parameter of destination inside the chosen voice
import("modsource.lib"); process = hgroup("Modulation source", modsource(rate, depth, shape, mode, pol, destVoice, destParam, trigger)) with{ trigger = button("T"):ba.impulsify; mode = hslider("[0]Mode [style:menu{'Free':0;'Sync':1;'Reset':2;'Envelope':3}]", 0, 0, 3, 1); pol = hslider("[0]Polarity [style:menu{'Unipolar':0;'Bipolar':1}]", 0, 0, 1, 1); shape = hslider("[1]Shape [style:menu{'Sine':0;'Tri':1;'Saw':2;'Square':3;'Random':4}]", 0, 0, 4, 1); rate = hslider("[2]Rate [style:knob]", 1, 0.01, 20, 0.001) : si.smoo; depth = hslider("[3]Depth [style:knob]", 0, 0, 1, 0.001) : si.smoo; destVoice = hslider("[5]Destination Voice[style:knob]", 1, 1, 8, 1); destParam = hslider("[6]Destination Parameter[style:knob]", 1, 1, 8, 1); };
cc634e6736d0a7971869f92e3d23b435d08ef3ab1f76783b0b53853146df1634
chevremaudite/zosimos
mixerchannelUI.dsp
//-----------------MIXER CHANNEL----------------// // A voice's mixer channel. //--------------PARAMETERS: // 1 - Sample Level : the gain of the sample part // 2 - Sample Pan : the panning of the sample part // 1 - Engine Level : the gain of the engine part // 2 - Engine Pan : the panning of the engine part import("mixerchannel.lib"); mixerUI = hgroup("Mixer", mixer(smpLvl, smpPan, engLvl, engPan)) with{ smpLvl = hslider("[1]Sample Level[style:knob]", 0, 0, 1, 0.001) : si.smoo; smpPan = hslider("[2]Sample Pan[style:knob]", 0, 0, 1, 0.001) : si.smoo; engLvl = hslider("[3]Engine Level[style:knob]", 0, 0, 1, 0.001) : si.smoo; engPan = hslider("[4]Engine Pan[style:knob]", 0, 0, 1, 0.001) : si.smoo; };
https://raw.githubusercontent.com/chevremaudite/zosimos/b7ee97299aff8bcbcb1b0213dd642a38a29f3af0/SOFTWARE/FAUST/ui/mixerchannelUI.dsp
faust
-----------------MIXER CHANNEL----------------// A voice's mixer channel. --------------PARAMETERS: 1 - Sample Level : the gain of the sample part 2 - Sample Pan : the panning of the sample part 1 - Engine Level : the gain of the engine part 2 - Engine Pan : the panning of the engine part
import("mixerchannel.lib"); mixerUI = hgroup("Mixer", mixer(smpLvl, smpPan, engLvl, engPan)) with{ smpLvl = hslider("[1]Sample Level[style:knob]", 0, 0, 1, 0.001) : si.smoo; smpPan = hslider("[2]Sample Pan[style:knob]", 0, 0, 1, 0.001) : si.smoo; engLvl = hslider("[3]Engine Level[style:knob]", 0, 0, 1, 0.001) : si.smoo; engPan = hslider("[4]Engine Pan[style:knob]", 0, 0, 1, 0.001) : si.smoo; };
c7738a26bd6e454e2382d764b28bc8c7937dd32c5ddc79ecd1b21e17f344d762
chevremaudite/zosimos
volenvUI.dsp
//-----------------ENVELOPE----------------// //Simple volume envelope with attack, release and a release curve control. //--------------PARAMETERS: // 1 - Attack : envelope attack time // 2 - Release : envelope release time // 3 - Hold : envelope hold time // 4 - Curve : curve type (linear to exponential) for attack and release no = library("noises.lib"); env = library("volenv.lib"); volEnv = hgroup("[0]Volume Envelope", _ : env.volenv(volA, volH, volD, curve)) with{ volA = vslider("[0]Attack[style:knob]", 0.2, 0.00, 1, 0.001); volH = vslider("[1]Hold[style:knob]", 0.2, 0.00, 1, 0.001); volD = vslider("[2]Decay[style:knob]", 0.2, 0.00, 1, 0.001); curve = vslider("[3]Curve[style:knob]", 0.0001, 0, 1, 0.000001); };
https://raw.githubusercontent.com/chevremaudite/zosimos/55a532489c278fa47ffd37a84322c9a27800f588/SOFTWARE/FAUST/ui/volenvUI.dsp
faust
-----------------ENVELOPE----------------// Simple volume envelope with attack, release and a release curve control. --------------PARAMETERS: 1 - Attack : envelope attack time 2 - Release : envelope release time 3 - Hold : envelope hold time 4 - Curve : curve type (linear to exponential) for attack and release
no = library("noises.lib"); env = library("volenv.lib"); volEnv = hgroup("[0]Volume Envelope", _ : env.volenv(volA, volH, volD, curve)) with{ volA = vslider("[0]Attack[style:knob]", 0.2, 0.00, 1, 0.001); volH = vslider("[1]Hold[style:knob]", 0.2, 0.00, 1, 0.001); volD = vslider("[2]Decay[style:knob]", 0.2, 0.00, 1, 0.001); curve = vslider("[3]Curve[style:knob]", 0.0001, 0, 1, 0.000001); };
d4f1f3863d9ee2fa57580194ffd826a9aa3fb96afdde4522fda57c7df0598e00
chevremaudite/zosimos
testing.dsp
import("93bangbang.lib"); import("addictive.lib"); import("bitwise.lib"); import("dist.lib"); import("filter.lib"); import("fm.dsp"); import("modaldrums.lib"); import("noisy.lib"); import("volenv.lib"); import("utilities.lib");
https://raw.githubusercontent.com/chevremaudite/zosimos/f9e350f6ffc8c5256e48b3e8e7a0389160540b66/SOFTWARE/FAUST/libs/testing.dsp
faust
import("93bangbang.lib"); import("addictive.lib"); import("bitwise.lib"); import("dist.lib"); import("filter.lib"); import("fm.dsp"); import("modaldrums.lib"); import("noisy.lib"); import("volenv.lib"); import("utilities.lib");
ad0e01e89a37bb466040814eb4a12f3bca518eb01519c92e5e0073ce4ee5e111
FineArtMaths/FaustExperiments
TinePiano.dsp
import("stdfaust.lib"); junkGroup(x) = tgroup("Junk",x); // I don't think tab groups are working properly, or I didn't do this right; either way this just hides the junk, which works for me. gain = junkGroup(hslider("gain", 0.5, 0, 1, 0.01)); freq = junkGroup(hslider("freq", 440, 50, 1000, 0.01)); gate = junkGroup(button("gate") : en.adsr(0.01, 0.01, 0.9, 0.1)); pitchwheel = junkGroup(hslider("bend [midi:pitchwheel]",1,0.9,1.1,0.001)); gFreq = freq * pitchwheel; generalGroup(x) = hgroup("1. General",x); volume = generalGroup(hslider("Overall Volume", 0.12, 0.0, 1.0, 0.01) /4); treble = generalGroup(3 - hslider("Treble", 0.62, 0, 3, 0.01) + 0.001); bass = generalGroup(3 - hslider("Bass", 2.25, 0, 3, 0.01) + 0.001); energyLoss = generalGroup(hslider("Energy Loss", 0.02, 0, 1.0, 0.001) / 3); keyGroup(x) = hgroup("2. Key Noise",x); keyClick = keyGroup(hslider("Tine level", 0.2, 0, 1.0, 0.001)); keyClickF = keyGroup(hslider("Tine Freq", 9, 1, 20, 0.25)); keyClickSus = keyGroup(hslider("Tine Sustain", 0, 0, 1, 0.01) * 0.01 + 0.99); keyClickInharm = keyGroup(hslider("Tine Inharmonicty", 0.1, 0, 0.5, 0.001)); keyThud = keyGroup(hslider("Key thud", 1.0, 0, 2.0, 0.01)); keyThudF = keyGroup(hslider("Key thud Freq", 150, 10, 300.0, 1)); keyNoiseAttackEffect = keyGroup(hslider("Vel sens", 1.0, 0.0, 1.0, 0.01)); exciterGroup(x) = hgroup("3. Exciter",x); excAttack = exciterGroup(hslider("Attack Time", 0, 0, 1, 0.001)); excSus = exciterGroup(hslider("Sustain", 0.0, 0, 1, 0.001)); noiseDensity = exciterGroup(hslider("Pick hardness", 2141, 0, 10000, 1)); excShape = exciterGroup(hslider("Noise / Square", 0.012, 0.0, 0.2, 0.001)); excVel = exciterGroup(hslider("Velocity Multiplier", 1.0, 0.01, 2.0, 0.01)); bodyGroup(x) = hgroup("4. Body",x); rez1 = bodyGroup(vslider("H01", 0, 0, 0.5, 0.01)); rez2 = bodyGroup(vslider("H02", 0, 0, 0.5, 0.01)); rez3 = bodyGroup(vslider("H03", 0, 0, 0.5, 0.01)); rez4 = bodyGroup(vslider("H04", 0, 0, 0.5, 0.01)); rez5 = bodyGroup(vslider("H05", 0, 0, 0.5, 0.01)); rez6 = bodyGroup(vslider("H06", 0, 0, 0.5, 0.01)); rez7 = bodyGroup(vslider("H07", 0, 0, 0.5, 0.01)); rez8 = bodyGroup(vslider("H08", 0, 0, 0.5, 0.01)); rez9 = bodyGroup(vslider("H09", 0, 0, 0.5, 0.01)); rez10 = bodyGroup(vslider("H10", 0, 0, 0.5, 0.01)); rez11 = bodyGroup(vslider("H11", 0, 0, 0.5, 0.01)); rez12 = bodyGroup(vslider("H12", 0, 0, 0.5, 0.01)); rezBloom = bodyGroup(vslider("Bloom", 0, 0, 2, 0.01)); rezA = bodyGroup(vslider("Amount", 30, 15, 100, 1)); rezAmt = rezA * en.adsr(rezBloom, 0.0, 1.0, 1.0, gate); exciter(f) = no.lfnoise0(noiseDensity) * (1 - excShape), os.square(f/2) * excShape : + : _ * excVel; enxciterEnv = en.adsr(excAttack, excAttack + 0.1, (1.0, 0.0 : select2(excSus == 0.0)),0.0, gate) * (excSus, 1.0 : select2(excSus == 0.0)); resonator = _ , fi.resonlp(gFreq * 1,rezAmt,rez1), fi.resonlp(gFreq * 2,rezAmt,rez2), fi.resonlp(gFreq * 3,rezAmt,rez3), fi.resonlp(gFreq * 4,rezAmt,rez4), fi.resonlp(gFreq * 5,rezAmt,rez5), fi.resonlp(gFreq * 6,rezAmt,rez6), fi.resonlp(gFreq * 7,rezAmt,rez7), fi.resonlp(gFreq * 8,rezAmt,rez8), fi.resonlp(gFreq * 9,rezAmt,rez9), fi.resonlp(gFreq * 10,rezAmt,rez10), fi.resonlp(gFreq * 11,rezAmt,rez11), fi.resonlp(gFreq * 12,rezAmt,rez12) :> _ / (rez1 + rez2 + rez3 + rez4 + rez5 + rez6 + rez7 + rez8 + rez9 + rez10 + rez11 + rez12 + 1); oscillator(h, d) = exciter(gFreq * h + d) * enxciterEnv : fi.fb_fcomb(44100,ma.SR/(gFreq * h + d),1.0,0.999 - energyLoss/10), 1 - energyLoss/5 : * : fi.lowpass(1, freq * treble) : fi.fb_fcomb(44100,ma.SR/(gFreq * h + d),1.0,-0.999 + energyLoss/10) : fi.highpass(1, freq / bass); keyClickOsc = os.osc(keyClickF * gFreq) + os.osc(keyClickF * gFreq*(1 + keyClickInharm)) + os.osc(keyClickF * gFreq * (1 + keyClickInharm * 2)) : _ * en.adsr(0.0, 0.01, 0.0, 0.01, gate) : fi.fb_fcomb(44100,ma.SR/140, 1.0, keyClickSus) ; keyThudOsc = os.osc(keyThudF) + os.osc(keyThudF*1.005) + os.osc(keyThudF * 1.01) : _ * en.adsr(0.0, 0.01, 0.0, 0.01, gate) : fi.fb_fcomb(44100,ma.SR/140, 1.0, -0.9) ; keyNoise = (keyClickOsc * keyClick + keyThudOsc * keyThud) * (keyNoiseAttackEffect * gain + (1 - keyNoiseAttackEffect)); voice = (oscillator(1, 0) + keyNoise) * gain * gate; process = voice * volume <: resonator <: _,_ ; effect = /*dm.phaser2_demo :*/ dm.freeverb_demo; // phaser sounds good but it's a bit of a cheat
https://raw.githubusercontent.com/FineArtMaths/FaustExperiments/5b39401ea9cc16c56a06d0174b26763f8f5653e3/TinePiano.dsp
faust
I don't think tab groups are working properly, or I didn't do this right; either way this just hides the junk, which works for me. dm.phaser2_demo : phaser sounds good but it's a bit of a cheat
import("stdfaust.lib"); gain = junkGroup(hslider("gain", 0.5, 0, 1, 0.01)); freq = junkGroup(hslider("freq", 440, 50, 1000, 0.01)); gate = junkGroup(button("gate") : en.adsr(0.01, 0.01, 0.9, 0.1)); pitchwheel = junkGroup(hslider("bend [midi:pitchwheel]",1,0.9,1.1,0.001)); gFreq = freq * pitchwheel; generalGroup(x) = hgroup("1. General",x); volume = generalGroup(hslider("Overall Volume", 0.12, 0.0, 1.0, 0.01) /4); treble = generalGroup(3 - hslider("Treble", 0.62, 0, 3, 0.01) + 0.001); bass = generalGroup(3 - hslider("Bass", 2.25, 0, 3, 0.01) + 0.001); energyLoss = generalGroup(hslider("Energy Loss", 0.02, 0, 1.0, 0.001) / 3); keyGroup(x) = hgroup("2. Key Noise",x); keyClick = keyGroup(hslider("Tine level", 0.2, 0, 1.0, 0.001)); keyClickF = keyGroup(hslider("Tine Freq", 9, 1, 20, 0.25)); keyClickSus = keyGroup(hslider("Tine Sustain", 0, 0, 1, 0.01) * 0.01 + 0.99); keyClickInharm = keyGroup(hslider("Tine Inharmonicty", 0.1, 0, 0.5, 0.001)); keyThud = keyGroup(hslider("Key thud", 1.0, 0, 2.0, 0.01)); keyThudF = keyGroup(hslider("Key thud Freq", 150, 10, 300.0, 1)); keyNoiseAttackEffect = keyGroup(hslider("Vel sens", 1.0, 0.0, 1.0, 0.01)); exciterGroup(x) = hgroup("3. Exciter",x); excAttack = exciterGroup(hslider("Attack Time", 0, 0, 1, 0.001)); excSus = exciterGroup(hslider("Sustain", 0.0, 0, 1, 0.001)); noiseDensity = exciterGroup(hslider("Pick hardness", 2141, 0, 10000, 1)); excShape = exciterGroup(hslider("Noise / Square", 0.012, 0.0, 0.2, 0.001)); excVel = exciterGroup(hslider("Velocity Multiplier", 1.0, 0.01, 2.0, 0.01)); bodyGroup(x) = hgroup("4. Body",x); rez1 = bodyGroup(vslider("H01", 0, 0, 0.5, 0.01)); rez2 = bodyGroup(vslider("H02", 0, 0, 0.5, 0.01)); rez3 = bodyGroup(vslider("H03", 0, 0, 0.5, 0.01)); rez4 = bodyGroup(vslider("H04", 0, 0, 0.5, 0.01)); rez5 = bodyGroup(vslider("H05", 0, 0, 0.5, 0.01)); rez6 = bodyGroup(vslider("H06", 0, 0, 0.5, 0.01)); rez7 = bodyGroup(vslider("H07", 0, 0, 0.5, 0.01)); rez8 = bodyGroup(vslider("H08", 0, 0, 0.5, 0.01)); rez9 = bodyGroup(vslider("H09", 0, 0, 0.5, 0.01)); rez10 = bodyGroup(vslider("H10", 0, 0, 0.5, 0.01)); rez11 = bodyGroup(vslider("H11", 0, 0, 0.5, 0.01)); rez12 = bodyGroup(vslider("H12", 0, 0, 0.5, 0.01)); rezBloom = bodyGroup(vslider("Bloom", 0, 0, 2, 0.01)); rezA = bodyGroup(vslider("Amount", 30, 15, 100, 1)); rezAmt = rezA * en.adsr(rezBloom, 0.0, 1.0, 1.0, gate); exciter(f) = no.lfnoise0(noiseDensity) * (1 - excShape), os.square(f/2) * excShape : + : _ * excVel; enxciterEnv = en.adsr(excAttack, excAttack + 0.1, (1.0, 0.0 : select2(excSus == 0.0)),0.0, gate) * (excSus, 1.0 : select2(excSus == 0.0)); resonator = _ , fi.resonlp(gFreq * 1,rezAmt,rez1), fi.resonlp(gFreq * 2,rezAmt,rez2), fi.resonlp(gFreq * 3,rezAmt,rez3), fi.resonlp(gFreq * 4,rezAmt,rez4), fi.resonlp(gFreq * 5,rezAmt,rez5), fi.resonlp(gFreq * 6,rezAmt,rez6), fi.resonlp(gFreq * 7,rezAmt,rez7), fi.resonlp(gFreq * 8,rezAmt,rez8), fi.resonlp(gFreq * 9,rezAmt,rez9), fi.resonlp(gFreq * 10,rezAmt,rez10), fi.resonlp(gFreq * 11,rezAmt,rez11), fi.resonlp(gFreq * 12,rezAmt,rez12) :> _ / (rez1 + rez2 + rez3 + rez4 + rez5 + rez6 + rez7 + rez8 + rez9 + rez10 + rez11 + rez12 + 1); oscillator(h, d) = exciter(gFreq * h + d) * enxciterEnv : fi.fb_fcomb(44100,ma.SR/(gFreq * h + d),1.0,0.999 - energyLoss/10), 1 - energyLoss/5 : * : fi.lowpass(1, freq * treble) : fi.fb_fcomb(44100,ma.SR/(gFreq * h + d),1.0,-0.999 + energyLoss/10) : fi.highpass(1, freq / bass); keyClickOsc = os.osc(keyClickF * gFreq) + os.osc(keyClickF * gFreq*(1 + keyClickInharm)) + os.osc(keyClickF * gFreq * (1 + keyClickInharm * 2)) : _ * en.adsr(0.0, 0.01, 0.0, 0.01, gate) : fi.fb_fcomb(44100,ma.SR/140, 1.0, keyClickSus) ; keyThudOsc = os.osc(keyThudF) + os.osc(keyThudF*1.005) + os.osc(keyThudF * 1.01) : _ * en.adsr(0.0, 0.01, 0.0, 0.01, gate) : fi.fb_fcomb(44100,ma.SR/140, 1.0, -0.9) ; keyNoise = (keyClickOsc * keyClick + keyThudOsc * keyThud) * (keyNoiseAttackEffect * gain + (1 - keyNoiseAttackEffect)); voice = (oscillator(1, 0) + keyNoise) * gain * gate; process = voice * volume <: resonator <: _,_ ;
1be4ab7b87b5dec2e13750dfc3e1a3ee8db817d316e76e58e94d45aaef1b4339
FineArtMaths/FaustExperiments
DelaySelfModulation.dsp
import("stdfaust.lib"); junkGroup(x) = tgroup("Junk",x); // I don't think tab groups are working properly, or I didn't do this right; either way this just hides the junk, which works for me. gain = junkGroup(nentry("gain", 1, 0, 1, 0.01)) * en.adsr(0.0, 0.1, 0.7, 1.0, gate); freq = junkGroup(hslider("freq", 440, 50, 1000, 0.01))* pitchwheel; gate = junkGroup(button("gate") : en.adsr(0.01, 0.01, 0.9, 0.1)); pitchwheel = junkGroup(hslider("bend [midi:pitchwheel]",1,0.9,1.1,0.001)); /* Delay Modulation */ /////////////// // GUI /////////////// modFreqFine = hslider("DM Fine", 0.01, 0.0, 1, 0.001); modFreqCoarse = hslider("DM Course", 2, 1, 20, 1); modAmpCoarse = hslider("DM Amp Coarse", 0, 0, 5000, 100); modAmpFine = hslider("DM Amp Fine", 0, 0, 100, 1); modAmp = modAmpCoarse + modAmpFine; modWave = hslider("DM Wave", 0, 0, 2, 1); lpc = hslider("LPF Cutoff", 10000, -10000, 10000, 10); hpc = hslider("HPF Cutoff", 0, -10000, 10000, 10); volume = hslider("Overall volume", 1, 0, 1, 0.01); ampModFreqFine = hslider("Amp Mod Freq Fine", 0.0, 0.0, 1, 0.001); ampModFreqCoarse = hslider("Amp Mod Freq Coarse", 0, 0, 10, 1); ampModFreq = ampModFreqFine + ampModFreqCoarse; ampModWidth = hslider("Amp Mod Width", 0, 0, 1, 0.001); feedback = hslider("Feedback", 0.99, 0, 0.99, 0.01); /////////////// // Algorithm /////////////// // Calc the delay time based on current pitch and GUI settings dmFreqCalc = max(0.1, freq * (modFreqCoarse + modFreqFine + os.osc(freq * (ampModFreqFine + ampModFreqCoarse)) * ampModWidth)); // A delay line with feedback; delay time is calculated by dmFreqCalc delayline = + ~ (@(ma.SR/dmFreqCalc) : *(feedback)); process = os.osc(freq) * gate * gain : delayline : fi.lowpass6e(min(20000, freq + lpc)) : fi.highpass(6, max(1, freq + hpc)) * volume <: _,_; effect = dm.freeverb_demo;
https://raw.githubusercontent.com/FineArtMaths/FaustExperiments/5b39401ea9cc16c56a06d0174b26763f8f5653e3/DelaySelfModulation.dsp
faust
I don't think tab groups are working properly, or I didn't do this right; either way this just hides the junk, which works for me. Delay Modulation ///////////// GUI ///////////// ///////////// Algorithm ///////////// Calc the delay time based on current pitch and GUI settings A delay line with feedback; delay time is calculated by dmFreqCalc
import("stdfaust.lib"); gain = junkGroup(nentry("gain", 1, 0, 1, 0.01)) * en.adsr(0.0, 0.1, 0.7, 1.0, gate); freq = junkGroup(hslider("freq", 440, 50, 1000, 0.01))* pitchwheel; gate = junkGroup(button("gate") : en.adsr(0.01, 0.01, 0.9, 0.1)); pitchwheel = junkGroup(hslider("bend [midi:pitchwheel]",1,0.9,1.1,0.001)); modFreqFine = hslider("DM Fine", 0.01, 0.0, 1, 0.001); modFreqCoarse = hslider("DM Course", 2, 1, 20, 1); modAmpCoarse = hslider("DM Amp Coarse", 0, 0, 5000, 100); modAmpFine = hslider("DM Amp Fine", 0, 0, 100, 1); modAmp = modAmpCoarse + modAmpFine; modWave = hslider("DM Wave", 0, 0, 2, 1); lpc = hslider("LPF Cutoff", 10000, -10000, 10000, 10); hpc = hslider("HPF Cutoff", 0, -10000, 10000, 10); volume = hslider("Overall volume", 1, 0, 1, 0.01); ampModFreqFine = hslider("Amp Mod Freq Fine", 0.0, 0.0, 1, 0.001); ampModFreqCoarse = hslider("Amp Mod Freq Coarse", 0, 0, 10, 1); ampModFreq = ampModFreqFine + ampModFreqCoarse; ampModWidth = hslider("Amp Mod Width", 0, 0, 1, 0.001); feedback = hslider("Feedback", 0.99, 0, 0.99, 0.01); dmFreqCalc = max(0.1, freq * (modFreqCoarse + modFreqFine + os.osc(freq * (ampModFreqFine + ampModFreqCoarse)) * ampModWidth)); delayline = + ~ (@(ma.SR/dmFreqCalc) : *(feedback)); process = os.osc(freq) * gate * gain : delayline : fi.lowpass6e(min(20000, freq + lpc)) : fi.highpass(6, max(1, freq + hpc)) * volume <: _,_; effect = dm.freeverb_demo;
170ed9bbcb41c6dacab981447dfb24285172f8a7f7297f8a44423ebe107c1da2
FineArtMaths/FaustExperiments
PluckedString.dsp
import("stdfaust.lib"); junkGroup(x) = tgroup("Junk",x); // I don't think tab groups are working properly, or I didn't do this right; either way this just hides the junk, which works for me. gain = junkGroup(hslider("gain", 0.5, 0, 1, 0.01)); freq = junkGroup(hslider("freq", 440, 50, 1000, 0.01)); gate = junkGroup(button("gate") : en.adsr(0.01, 0.01, 0.9, 0.1)); pitchwheel = junkGroup(hslider("bend [midi:pitchwheel]",1,0.9,1.1,0.001)); gFreq = freq * pitchwheel; generalGroup(x) = hgroup("General",x); volume = generalGroup(hslider("Overall Volume", 0.12, 0.0, 1.0, 0.01) /4); hfLoss = generalGroup(3 - hslider("HF Loss", 0, 0, 3, 0.01) + 0.001); energyLoss = generalGroup(hslider("Energy Loss", 0, 0, 0.02, 0.001) / 3); exciterGroup(x) = hgroup("Exciter",x); excAttack = exciterGroup(hslider("Attack Time", 0, 0, 1, 0.001)); excSus = exciterGroup(hslider("Sustain", 0, 0, 1, 0.001)); noiseDensity = exciterGroup(hslider("Pick hardness", 1000, 0, 10000, 1) + (gain - 0.5) * noiseDensityVel); noiseDensityVel = exciterGroup(hslider("Pick hardness velocity sensitivity", 200, 0, 10000, 1)); excShape = exciterGroup(hslider("Noise / Square", 0.0, 0.0, 0.2, 0.001)); excVel = exciterGroup(hslider("Velocity Multiplier", 1.0, 0.01, 2.0, 0.01)); bodyGroup(x) = hgroup("Body",x); rez1 = bodyGroup(vslider("H01", 0, 0, 0.5, 0.01)); rez2 = bodyGroup(vslider("H02", 0, 0, 0.5, 0.01)); rez3 = bodyGroup(vslider("H03", 0, 0, 0.5, 0.01)); rez4 = bodyGroup(vslider("H04", 0, 0, 0.5, 0.01)); rez5 = bodyGroup(vslider("H05", 0, 0, 0.5, 0.01)); rez6 = bodyGroup(vslider("H06", 0, 0, 0.5, 0.01)); rez7 = bodyGroup(vslider("H07", 0, 0, 0.5, 0.01)); rez8 = bodyGroup(vslider("H08", 0, 0, 0.5, 0.01)); rez9 = bodyGroup(vslider("H09", 0, 0, 0.5, 0.01)); rez10 = bodyGroup(vslider("H10", 0, 0, 0.5, 0.01)); rez11 = bodyGroup(vslider("H11", 0, 0, 0.5, 0.01)); rez12 = bodyGroup(vslider("H12", 0, 0, 0.5, 0.01)); exciter(f) = no.lfnoise0(noiseDensity) * (1 - excShape), os.square(f) * excShape : + : _ * excVel; enxciterEnv = en.adsr(excAttack, excAttack + 0.1, (1.0, 0.0 : select2(excSus == 0.0)),0.0, gate) * (excSus, 1.0 : select2(excSus == 0.0)); resonator = _ , fi.resonlp(gFreq * 1,15,rez1), fi.resonlp(gFreq * 2,15,rez2), fi.resonlp(gFreq * 3,15,rez3), fi.resonlp(gFreq * 4,15,rez4), fi.resonlp(gFreq * 5,15,rez5), fi.resonlp(gFreq * 6,15,rez6), fi.resonlp(gFreq * 7,15,rez7), fi.resonlp(gFreq * 8,15,rez8), fi.resonlp(gFreq * 9,15,rez9), fi.resonlp(gFreq * 10,15,rez10), fi.resonlp(gFreq * 11,15,rez11), fi.resonlp(gFreq * 12,15,rez12) :> _ / (rez1 + rez2 + rez3 + rez4 + rez5 + rez6 + rez7 + rez8 + rez9 + rez10 + rez11 + rez12 + 1); oscillator(h, d) = exciter(gFreq * h + d) * enxciterEnv : fi.fb_fcomb(44100,ma.SR/(gFreq * h + d),1.0,0.999 - energyLoss/10), 1 - energyLoss/5 : * : fi.lowpass(1, freq * hfLoss) : fi.fb_fcomb(44100,ma.SR/(gFreq * h + d),1.0,-0.999 + energyLoss/10); voice = oscillator(1, 0) * gain * gate; process = voice * volume <: resonator <: _,_ ; effect = dm.freeverb_demo;
https://raw.githubusercontent.com/FineArtMaths/FaustExperiments/5b39401ea9cc16c56a06d0174b26763f8f5653e3/PluckedString.dsp
faust
I don't think tab groups are working properly, or I didn't do this right; either way this just hides the junk, which works for me.
import("stdfaust.lib"); gain = junkGroup(hslider("gain", 0.5, 0, 1, 0.01)); freq = junkGroup(hslider("freq", 440, 50, 1000, 0.01)); gate = junkGroup(button("gate") : en.adsr(0.01, 0.01, 0.9, 0.1)); pitchwheel = junkGroup(hslider("bend [midi:pitchwheel]",1,0.9,1.1,0.001)); gFreq = freq * pitchwheel; generalGroup(x) = hgroup("General",x); volume = generalGroup(hslider("Overall Volume", 0.12, 0.0, 1.0, 0.01) /4); hfLoss = generalGroup(3 - hslider("HF Loss", 0, 0, 3, 0.01) + 0.001); energyLoss = generalGroup(hslider("Energy Loss", 0, 0, 0.02, 0.001) / 3); exciterGroup(x) = hgroup("Exciter",x); excAttack = exciterGroup(hslider("Attack Time", 0, 0, 1, 0.001)); excSus = exciterGroup(hslider("Sustain", 0, 0, 1, 0.001)); noiseDensity = exciterGroup(hslider("Pick hardness", 1000, 0, 10000, 1) + (gain - 0.5) * noiseDensityVel); noiseDensityVel = exciterGroup(hslider("Pick hardness velocity sensitivity", 200, 0, 10000, 1)); excShape = exciterGroup(hslider("Noise / Square", 0.0, 0.0, 0.2, 0.001)); excVel = exciterGroup(hslider("Velocity Multiplier", 1.0, 0.01, 2.0, 0.01)); bodyGroup(x) = hgroup("Body",x); rez1 = bodyGroup(vslider("H01", 0, 0, 0.5, 0.01)); rez2 = bodyGroup(vslider("H02", 0, 0, 0.5, 0.01)); rez3 = bodyGroup(vslider("H03", 0, 0, 0.5, 0.01)); rez4 = bodyGroup(vslider("H04", 0, 0, 0.5, 0.01)); rez5 = bodyGroup(vslider("H05", 0, 0, 0.5, 0.01)); rez6 = bodyGroup(vslider("H06", 0, 0, 0.5, 0.01)); rez7 = bodyGroup(vslider("H07", 0, 0, 0.5, 0.01)); rez8 = bodyGroup(vslider("H08", 0, 0, 0.5, 0.01)); rez9 = bodyGroup(vslider("H09", 0, 0, 0.5, 0.01)); rez10 = bodyGroup(vslider("H10", 0, 0, 0.5, 0.01)); rez11 = bodyGroup(vslider("H11", 0, 0, 0.5, 0.01)); rez12 = bodyGroup(vslider("H12", 0, 0, 0.5, 0.01)); exciter(f) = no.lfnoise0(noiseDensity) * (1 - excShape), os.square(f) * excShape : + : _ * excVel; enxciterEnv = en.adsr(excAttack, excAttack + 0.1, (1.0, 0.0 : select2(excSus == 0.0)),0.0, gate) * (excSus, 1.0 : select2(excSus == 0.0)); resonator = _ , fi.resonlp(gFreq * 1,15,rez1), fi.resonlp(gFreq * 2,15,rez2), fi.resonlp(gFreq * 3,15,rez3), fi.resonlp(gFreq * 4,15,rez4), fi.resonlp(gFreq * 5,15,rez5), fi.resonlp(gFreq * 6,15,rez6), fi.resonlp(gFreq * 7,15,rez7), fi.resonlp(gFreq * 8,15,rez8), fi.resonlp(gFreq * 9,15,rez9), fi.resonlp(gFreq * 10,15,rez10), fi.resonlp(gFreq * 11,15,rez11), fi.resonlp(gFreq * 12,15,rez12) :> _ / (rez1 + rez2 + rez3 + rez4 + rez5 + rez6 + rez7 + rez8 + rez9 + rez10 + rez11 + rez12 + 1); oscillator(h, d) = exciter(gFreq * h + d) * enxciterEnv : fi.fb_fcomb(44100,ma.SR/(gFreq * h + d),1.0,0.999 - energyLoss/10), 1 - energyLoss/5 : * : fi.lowpass(1, freq * hfLoss) : fi.fb_fcomb(44100,ma.SR/(gFreq * h + d),1.0,-0.999 + energyLoss/10); voice = oscillator(1, 0) * gain * gate; process = voice * volume <: resonator <: _,_ ; effect = dm.freeverb_demo;
dafec1e8e71597e9fd16a07c265e478605e3f56875b278b2cb37c17f6ec78c52
FineArtMaths/FaustExperiments
BowedString.dsp
import("stdfaust.lib"); junkGroup(x) = tgroup("Junk",x); // I don't think tab groups are working properly, or I didn't do this right; either way this just hides the junk, which works for me. gain = junkGroup(hslider("gain", 0.5, 0, 1, 0.01)); freq = junkGroup(hslider("freq", 440, 50, 1000, 0.01)); gate = junkGroup(button("gate") : en.adsr(0.01, 0.01, 0.9, 0.1)); pitchwheel = junkGroup(hslider("bend [midi:pitchwheel]",1,0.9,1.1,0.001)); gFreq = freq * pitchwheel; generalGroup(x) = hgroup("General",x); volume = generalGroup(hslider("Overall Volume", 0.12, 0.0, 1.0, 0.01) /4); treble = generalGroup(3 - hslider("Treble", 0.62, 0, 3, 0.01) + 0.001); bass = generalGroup(3 - hslider("Bass", 2.25, 0, 3, 0.01) + 0.001); energyLoss = generalGroup(hslider("Energy Loss", 0.02, 0, 1.0, 0.001) / 3); exciterGroup(x) = hgroup("Exciter",x); excAttack = exciterGroup(hslider("Attack Time", 0, 0, 1, 0.001)); excSus = exciterGroup(hslider("Sustain", 0.549, 0, 1, 0.001)); noiseDensity = exciterGroup(hslider("Pick hardness", 2141, 0, 10000, 1) + (gain - 0.5) * noiseDensityVel); noiseDensityVel = exciterGroup(hslider("Pick hardness velocity sensitivity", 200, 0, 10000, 1)); excShape = exciterGroup(hslider("Noise / Square", 0.012, 0.0, 0.2, 0.001)); excVel = exciterGroup(hslider("Velocity Multiplier", 1.0, 0.01, 2.0, 0.01)); bodyGroup(x) = hgroup("Body",x); rez1 = bodyGroup(vslider("H01", 0, 0, 0.5, 0.01)); rez2 = bodyGroup(vslider("H02", 0, 0, 0.5, 0.01)); rez3 = bodyGroup(vslider("H03", 0, 0, 0.5, 0.01)); rez4 = bodyGroup(vslider("H04", 0, 0, 0.5, 0.01)); rez5 = bodyGroup(vslider("H05", 0, 0, 0.5, 0.01)); rez6 = bodyGroup(vslider("H06", 0, 0, 0.5, 0.01)); rez7 = bodyGroup(vslider("H07", 0, 0, 0.5, 0.01)); rez8 = bodyGroup(vslider("H08", 0, 0, 0.5, 0.01)); rez9 = bodyGroup(vslider("H09", 0, 0, 0.5, 0.01)); rez10 = bodyGroup(vslider("H10", 0, 0, 0.5, 0.01)); rez11 = bodyGroup(vslider("H11", 0, 0, 0.5, 0.01)); rez12 = bodyGroup(vslider("H12", 0, 0, 0.5, 0.01)); rezAmt = bodyGroup(vslider("H Amt", 15, 15, 55, 1)); exciter(f) = no.lfnoise0(noiseDensity) * (1 - excShape), os.square(f/2) * excShape : + : _ * excVel; enxciterEnv = en.adsr(excAttack, excAttack + 0.1, (1.0, 0.0 : select2(excSus == 0.0)),0.0, gate) * (excSus, 1.0 : select2(excSus == 0.0)); resonator = _ , fi.resonlp(gFreq * 1,rezAmt,rez1), fi.resonlp(gFreq * 2,rezAmt,rez2), fi.resonlp(gFreq * 3,rezAmt,rez3), fi.resonlp(gFreq * 4,rezAmt,rez4), fi.resonlp(gFreq * 5,rezAmt,rez5), fi.resonlp(gFreq * 6,rezAmt,rez6), fi.resonlp(gFreq * 7,rezAmt,rez7), fi.resonlp(gFreq * 8,rezAmt,rez8), fi.resonlp(gFreq * 9,rezAmt,rez9), fi.resonlp(gFreq * 10,rezAmt,rez10), fi.resonlp(gFreq * 11,rezAmt,rez11), fi.resonlp(gFreq * 12,rezAmt,rez12) :> _ / (rez1 + rez2 + rez3 + rez4 + rez5 + rez6 + rez7 + rez8 + rez9 + rez10 + rez11 + rez12 + 1); oscillator(h, d) = exciter(gFreq * h + d) * enxciterEnv : fi.fb_fcomb(44100,ma.SR/(gFreq * h + d),1.0,0.999 - energyLoss/10), 1 - energyLoss/5 : * : fi.lowpass(1, freq * treble) : fi.fb_fcomb(44100,ma.SR/(gFreq * h + d),1.0,-0.999 + energyLoss/10) : fi.highpass(1, freq / bass); voice = oscillator(1, 0) * gain * gate; process = voice * volume <: resonator <: _,_ ; effect = dm.phaser2_demo : dm.freeverb_demo;
https://raw.githubusercontent.com/FineArtMaths/FaustExperiments/5b39401ea9cc16c56a06d0174b26763f8f5653e3/BowedString.dsp
faust
I don't think tab groups are working properly, or I didn't do this right; either way this just hides the junk, which works for me.
import("stdfaust.lib"); gain = junkGroup(hslider("gain", 0.5, 0, 1, 0.01)); freq = junkGroup(hslider("freq", 440, 50, 1000, 0.01)); gate = junkGroup(button("gate") : en.adsr(0.01, 0.01, 0.9, 0.1)); pitchwheel = junkGroup(hslider("bend [midi:pitchwheel]",1,0.9,1.1,0.001)); gFreq = freq * pitchwheel; generalGroup(x) = hgroup("General",x); volume = generalGroup(hslider("Overall Volume", 0.12, 0.0, 1.0, 0.01) /4); treble = generalGroup(3 - hslider("Treble", 0.62, 0, 3, 0.01) + 0.001); bass = generalGroup(3 - hslider("Bass", 2.25, 0, 3, 0.01) + 0.001); energyLoss = generalGroup(hslider("Energy Loss", 0.02, 0, 1.0, 0.001) / 3); exciterGroup(x) = hgroup("Exciter",x); excAttack = exciterGroup(hslider("Attack Time", 0, 0, 1, 0.001)); excSus = exciterGroup(hslider("Sustain", 0.549, 0, 1, 0.001)); noiseDensity = exciterGroup(hslider("Pick hardness", 2141, 0, 10000, 1) + (gain - 0.5) * noiseDensityVel); noiseDensityVel = exciterGroup(hslider("Pick hardness velocity sensitivity", 200, 0, 10000, 1)); excShape = exciterGroup(hslider("Noise / Square", 0.012, 0.0, 0.2, 0.001)); excVel = exciterGroup(hslider("Velocity Multiplier", 1.0, 0.01, 2.0, 0.01)); bodyGroup(x) = hgroup("Body",x); rez1 = bodyGroup(vslider("H01", 0, 0, 0.5, 0.01)); rez2 = bodyGroup(vslider("H02", 0, 0, 0.5, 0.01)); rez3 = bodyGroup(vslider("H03", 0, 0, 0.5, 0.01)); rez4 = bodyGroup(vslider("H04", 0, 0, 0.5, 0.01)); rez5 = bodyGroup(vslider("H05", 0, 0, 0.5, 0.01)); rez6 = bodyGroup(vslider("H06", 0, 0, 0.5, 0.01)); rez7 = bodyGroup(vslider("H07", 0, 0, 0.5, 0.01)); rez8 = bodyGroup(vslider("H08", 0, 0, 0.5, 0.01)); rez9 = bodyGroup(vslider("H09", 0, 0, 0.5, 0.01)); rez10 = bodyGroup(vslider("H10", 0, 0, 0.5, 0.01)); rez11 = bodyGroup(vslider("H11", 0, 0, 0.5, 0.01)); rez12 = bodyGroup(vslider("H12", 0, 0, 0.5, 0.01)); rezAmt = bodyGroup(vslider("H Amt", 15, 15, 55, 1)); exciter(f) = no.lfnoise0(noiseDensity) * (1 - excShape), os.square(f/2) * excShape : + : _ * excVel; enxciterEnv = en.adsr(excAttack, excAttack + 0.1, (1.0, 0.0 : select2(excSus == 0.0)),0.0, gate) * (excSus, 1.0 : select2(excSus == 0.0)); resonator = _ , fi.resonlp(gFreq * 1,rezAmt,rez1), fi.resonlp(gFreq * 2,rezAmt,rez2), fi.resonlp(gFreq * 3,rezAmt,rez3), fi.resonlp(gFreq * 4,rezAmt,rez4), fi.resonlp(gFreq * 5,rezAmt,rez5), fi.resonlp(gFreq * 6,rezAmt,rez6), fi.resonlp(gFreq * 7,rezAmt,rez7), fi.resonlp(gFreq * 8,rezAmt,rez8), fi.resonlp(gFreq * 9,rezAmt,rez9), fi.resonlp(gFreq * 10,rezAmt,rez10), fi.resonlp(gFreq * 11,rezAmt,rez11), fi.resonlp(gFreq * 12,rezAmt,rez12) :> _ / (rez1 + rez2 + rez3 + rez4 + rez5 + rez6 + rez7 + rez8 + rez9 + rez10 + rez11 + rez12 + 1); oscillator(h, d) = exciter(gFreq * h + d) * enxciterEnv : fi.fb_fcomb(44100,ma.SR/(gFreq * h + d),1.0,0.999 - energyLoss/10), 1 - energyLoss/5 : * : fi.lowpass(1, freq * treble) : fi.fb_fcomb(44100,ma.SR/(gFreq * h + d),1.0,-0.999 + energyLoss/10) : fi.highpass(1, freq / bass); voice = oscillator(1, 0) * gain * gate; process = voice * volume <: resonator <: _,_ ; effect = dm.phaser2_demo : dm.freeverb_demo;
c4a02e01befba1be4b66d1099f4be3a5f2c681e33f8eb2c7f513e35bbba82521
FineArtMaths/FaustExperiments
feedbackOrgan.dsp
import("stdfaust.lib"); /* This is a playable synth whose oscillators are used as exciters for comb filters. It seems to be able to do organs, glass harmonicas, wood / plastic / metal percussion etc. WARNING: It can still make very loud sounds if the Drive on any oscillator is turned up while the Tuning is close to 1.0 TO DO: * Add a noise oscillator or two * Maybe global noise oscillator on the amplitude just to create a bit of analogue variation * Include a detuning envelope per harmonic * Try to capture pitch wheel, mod wheel and key release (to add a key release noise) * Save and load a preset * Microtuning */ junkGroup(x) = tgroup("Junk",x); // I don't think tab groups are working properly, or I didn't do this right; either way this just hides the junk, which works for me. gain = en.adsr(0.0, 0.1, 0.7, 1.0, gate); freq = junkGroup(hslider("freq", 440, 50, 1000, 0.01)); gate = junkGroup(button("gate") : en.adsr(0.01, 0.01, 0.9, 0.1)); generalGroup(x) = hgroup("General",x); unison = generalGroup(hslider("Unison", 0.0, 0.0, 0.1, 0.001)); unisonOnset = generalGroup(hslider("Unison Onset", 0.0, 0.0, 3.0, 0.1)); unisonOnsetEnv = en.adsr(unisonOnset, 0.0, unison, unisonOnset, gate); baseLevel = generalGroup(hslider("Volume", 0.3, 0.0, 1.0, 0.001)); fmOscRate = generalGroup(hslider("FM Osc Rate", 0.1, 0.01, 200.0, 0.01)); fmOscAmt = generalGroup(hslider("FM Osc Amt", 0.0, 0.0, fmMaxRate, 1)); // Default values for setting up sliders to make them easier to change minA = 0.0; maxA = 2.0; maxDr = 100.0; baseFeedback = 0.999; minfeed = 0.0; maxfeed = 1.0; fmMaxRate = 5000; h1Group(x) = hgroup("Harmonic 1",x); h1Harm = h1Group(hslider("Harmonic", 1, 1, 20, 1)); h1Tuning = h1Group(hslider("Tuning", 1, 0.75, 1.5, 0.001)); h1Drive = h1Group(hslider("Drive", 0.1, 0.0, maxDr, 0.01)); h1Attack = h1Group(hslider("Attack", 0.1, minA, maxA, 0.01)); h1Decay = h1Group(hslider("Decay", 0.1, 0.01, 2.0, 0.01)); h1Feedback = h1Group(hslider("Feedback", baseFeedback, minfeed, maxfeed, 0.01)); h1Sustain = h1Group(checkbox("Sustain")); h1env = en.adsr(ba.if(h1Perc == 0, h1Attack, h1Attack / 100), ba.if(h1Perc == 0, h1Decay, h1Decay / 100), ba.if(h1Sustain == 0, 0.0, 1.0), h1Decay, gate); h1Perc = h1Group(checkbox("Percussive")); h1FMAmount = h1Group(hslider("Vibrato Amt", 0.0, 0.0, 1.0, 0.01)); h1FMFreq = h1Group(hslider("Vibrato Rate", 0.0, 0.0, fmMaxRate, 1.0)); h1FMOnset = h1Group(hslider("Vibrato Onset", 0.0, 0.0, maxA, 0.01)); h1FMenv = en.adsr(h1FMOnset, 0.0, 1.0, h1FMOnset, gate); h2Group(x) = hgroup("Harmonic 2",x); h2Harm = h2Group(hslider("Harmonic", 2, 1, 20, 1)); h2Tuning = h2Group(hslider("Tuning", 1, 0.9, 1.1, 0.0001)); h2Drive = h2Group(hslider("Drive", 0.1, 0.0, maxDr, 0.01)); h2Attack = h2Group(hslider("Attack", 0.1, minA, maxA, 0.01)); h2Decay = h2Group(hslider("Decay", 0.1, 0.01, 2.0, 0.01)); h2Feedback = h2Group(hslider("Feedback", baseFeedback, minfeed, maxfeed, 0.01)); h2Sustain = h2Group(checkbox("Sustain")); h2Perc = h2Group(checkbox("Percussive")); h2env = en.adsr(ba.if(h2Perc == 0, h2Attack, h2Attack / 100), ba.if(h2Perc == 0, h2Decay, h2Decay / 100), ba.if(h2Sustain == 0, 0.0, 1.0), h2Decay, gate); h2FMAmount = h2Group(hslider("Vibrato Amt", 0.0, 0.0, 1.0, 0.01)); h2FMFreq = h2Group(hslider("Vibrato Rate", 0.0, 0.0, fmMaxRate, 1.0)); h2FMOnset = h2Group(hslider("Vibrato Onset", 0.0, 0.0, maxA, 0.01)); h2FMenv = en.adsr(h2FMOnset, 0.0, 1.0, h2FMOnset, gate); h3Group(x) = hgroup("Harmonic 3",x); h3Harm = h3Group(hslider("Harmonic", 3, 1, 20, 1)); h3Tuning = h3Group(hslider("Tuning", 1, 0.75, 1.5, 0.001)); h3Drive = h3Group(hslider("Drive", 0.1, 0.0, maxDr, 0.01)); h3Attack = h3Group(hslider("Attack", 0.1, minA, maxA, 0.01)); h3Decay = h3Group(hslider("Decay", 0.1, 0.01, 2.0, 0.01)); h3Feedback = h3Group(hslider("Feedback", baseFeedback, minfeed, maxfeed, 0.01)); h3Sustain = h3Group(checkbox("Sustain")); h3Perc = h3Group(checkbox("Percussive")); h3env = en.adsr(ba.if(h3Perc == 0, h3Attack, h3Attack / 100), ba.if(h3Perc == 0, h3Decay, h3Decay / 100), ba.if(h3Sustain == 0, 0.0, 1.0), h3Decay, gate); h3FMAmount = h3Group(hslider("Vibrato Amt", 0.0, 0.0, 1.0, 0.01)); h3FMFreq = h3Group(hslider("Vibrato Rate", 0.0, 0.0, fmMaxRate, 1.0)); h3FMOnset = h3Group(hslider("Vibrato Onset", 0.0, 0.0, maxA, 0.01)); h3FMenv = en.adsr(h3FMOnset, 0.0, 1.0, h3FMOnset, gate); h4Group(x) = hgroup("Harmonic 4",x); h4Harm = h4Group(hslider("Harmonic", 4, 1, 20, 1)); h4Tuning = h4Group(hslider("Tuning", 1, 0.75, 1.5, 0.001)); h4Drive = h4Group(hslider("Drive", 0.1, 0.0, maxDr, 0.01)); h4Attack = h4Group(hslider("Attack", 0.1, minA, maxA, 0.01)); h4Decay = h4Group(hslider("Decay", 0.1, 0.01, 2.0, 0.01)); h4Feedback = h4Group(hslider("Feedback", baseFeedback, minfeed, maxfeed, 0.01)); h4Sustain = h4Group(checkbox("Sustain")); h4Perc = h4Group(checkbox("Percussive")); h4env = en.adsr(ba.if(h4Perc == 0, h4Attack, h4Attack / 100), ba.if(h4Perc == 0, h4Decay, h4Decay / 100), ba.if(h4Sustain == 0, 0.0, 1.0), h4Decay, gate); h4FMAmount = h4Group(hslider("Vibrato Amt", 0.0, 0.0, 1.0, 0.01)); h4FMFreq = h4Group(hslider("Vibrato Rate", 0.0, 0.0, fmMaxRate, 1.0)); h4FMOnset = h4Group(hslider("Vibrato Onset", 0.0, 0.0, maxA, 0.01)); h4FMenv = en.adsr(h4FMOnset, 0.0, 1.0, h4FMOnset, gate); h5Group(x) = hgroup("Harmonic 5",x); h5Harm = h5Group(hslider("Harmonic", 5, 1, 20, 1)); h5Tuning = h5Group(hslider("Tuning", 1, 0.75, 1.5, 0.001)); h5Drive = h5Group(hslider("Drive", 0.0, 0.0, maxDr, 0.01)); h5Attack = h5Group(hslider("Attack", 0.1, minA, maxA, 0.01)); h5Decay = h5Group(hslider("Decay", 0.1, 0.01, 2.0, 0.01)); h5Feedback = h5Group(hslider("Feedback", baseFeedback, minfeed, maxfeed, 0.01)); h5Sustain = h5Group(checkbox("Sustain")); h5Perc = h5Group(checkbox("Percussive")); h5env = en.adsr(ba.if(h5Perc == 0, h5Attack, h5Attack / 100), ba.if(h5Perc == 0, h5Decay, h5Decay / 100), ba.if(h5Sustain == 0, 0.0, 1.0), h5Decay, gate); h5FMAmount = h5Group(hslider("Vibrato Amt", 0.0, 0.0, 1.0, 0.01)); h5FMFreq = h5Group(hslider("Vibrato Rate", 0.0, 0.0, fmMaxRate, 1.0)); h5FMOnset = h5Group(hslider("Vibrato Onset", 0.0, 0.0, maxA, 0.01)); h5FMenv = en.adsr(h5FMOnset, 0.0, 1.0, h5FMOnset, gate); h6Group(x) = hgroup("Harmonic 6",x); h6Harm = h6Group(hslider("Harmonic", 6, 1, 20, 1)); h6Tuning = h6Group(hslider("Tuning", 1, 0.75, 1.5, 0.001)); h6Drive = h6Group(hslider("Drive", 0.0, 0.0, maxDr, 0.01)); h6Attack = h6Group(hslider("Attack", 0.1, minA, maxA, 0.01)); h6Decay = h6Group(hslider("Decay", 0.1, 0.01, 2.0, 0.01)); h6Feedback = h6Group(hslider("Feedback", baseFeedback, minfeed, maxfeed, 0.01)); h6Sustain = h6Group(checkbox("Sustain")); h6Perc = h6Group(checkbox("Percussive")); h6env = en.adsr(ba.if(h6Perc == 0, h6Attack, h6Attack / 100), ba.if(h6Perc == 0, h6Decay, h6Decay / 100), ba.if(h6Sustain == 0, 0.0, 1.0), h6Decay, gate); h6FMAmount = h6Group(hslider("Vibrato Amt", 0.0, 0.0, 1.0, 0.01)); h6FMFreq = h6Group(hslider("Vibrato Rate", 0.0, 0.0, fmMaxRate, 1.0)); h6FMOnset = h6Group(hslider("Vibrato Onset", 0.0, 0.0, maxA, 0.01)); h6FMenv = en.adsr(h6FMOnset, 0.0, 1.0, h6FMOnset, gate); h7Group(x) = hgroup("Harmonic 7",x); h7Harm = h7Group(hslider("Harmonic", 7, 1, 20, 1)); h7Tuning = h7Group(hslider("Tuning", 1, 0.75, 1.5, 0.001)); h7Drive = h7Group(hslider("Drive", 0.0, 0.0, maxDr, 0.01)); h7Attack = h7Group(hslider("Attack", 0.1, minA, maxA, 0.01)); h7Decay = h7Group(hslider("Decay", 0.1, 0.01, 2.0, 0.01)); h7Feedback = h7Group(hslider("Feedback", baseFeedback, minfeed, maxfeed, 0.01)); h7Sustain = h7Group(checkbox("Sustain")); h7Perc = h7Group(checkbox("Percussive")); h7env = en.adsr(ba.if(h7Perc == 0, h7Attack, h7Attack / 100), ba.if(h7Perc == 0, h7Decay, h7Decay / 100), ba.if(h7Sustain == 0, 0.0, 1.0), h7Decay, gate); h7FMAmount = h7Group(hslider("Vibrato Amt", 0.0, 0.0, 1.0, 0.01)); h7FMFreq = h7Group(hslider("Vibrato Rate", 0.0, 0.0, fmMaxRate, 1.0)); h7FMOnset = h7Group(hslider("Vibrato Onset", 0.0, 0.0, maxA, 0.01)); h7FMenv = en.adsr(h7FMOnset, 0.0, 1.0, h7FMOnset, gate); h8Group(x) = hgroup("Harmonic 8",x); h8Harm = h8Group(hslider("Harmonic", 8, 1, 20, 1)); h8Tuning = h8Group(hslider("Tuning", 1, 0.75, 1.5, 0.001)); h8Drive = h8Group(hslider("Drive", 0.0, 0.0, maxDr, 0.01)); h8Attack = h8Group(hslider("Attack", 0.1, minA, maxA, 0.01)); h8Decay = h8Group(hslider("Decay", 0.1, 0.01, 2.0, 0.01)); h8Feedback = h8Group(hslider("Feedback", baseFeedback, minfeed, maxfeed, 0.01)); h8Sustain = h8Group(checkbox("Sustain")); h8Perc = h8Group(checkbox("Percussive")); h8env = en.adsr(ba.if(h8Perc == 0, h8Attack, h8Attack / 100), ba.if(h8Perc == 0, h8Decay, h8Decay / 100), ba.if(h8Sustain == 0, 0.0, 1.0), h8Decay, gate); h8FMAmount = h8Group(hslider("Vibrato Amt", 0.0, 0.0, 1.0, 0.01)); h8FMFreq = h8Group(hslider("Vibrato Rate", 0.0, 0.0, fmMaxRate, 1.0)); h8FMOnset = h8Group(hslider("Vibrato Onset", 0.0, 0.0, maxA, 0.01)); h8FMenv = en.adsr(h8FMOnset, 0.0, 1.0, h8FMOnset, gate); driveDamper(t) = ba.if( t == 1, 0.1, ba.if( abs(t - 1) < 0.1, max(0.1, abs(t - 1) * 10), 1.0 )) ; oVal(f, harm, level, feed, drive, fmFreq, fmAmt) = os.osc(f) * level * drive : fi.fb_fcomb(44100, harm * ma.SR/(f) + os.osc(fmFreq + os.osc(fmOscRate) * fmOscAmt) * fmAmt * 5, 0.99, -1 * feed); voice(f, detune) = oVal((f + f*detune) * h1Harm, h1Harm * h1Tuning, baseLevel * h1env, h1Feedback, h1Drive * driveDamper(h1Tuning), h1FMFreq, h1FMenv * h1FMAmount) + oVal((f + f*detune) * h2Harm, h2Harm * h2Tuning, baseLevel * h2env, h2Feedback, h2Drive * driveDamper(h2Tuning), h2FMFreq, h2FMenv * h2FMAmount) + oVal((f + f*detune) * h3Harm, h3Harm * h3Tuning, baseLevel * h3env, h3Feedback, h3Drive * driveDamper(h3Tuning), h3FMFreq, h3FMenv * h3FMAmount) + oVal((f + f*detune) * h4Harm, h4Harm * h4Tuning, baseLevel * h4env, h4Feedback, h4Drive * driveDamper(h4Tuning), h4FMFreq, h4FMenv * h4FMAmount) + oVal((f + f*detune) * h5Harm, h5Harm * h5Tuning, baseLevel * h5env, h5Feedback, h5Drive * driveDamper(h5Tuning), h5FMFreq, h5FMenv * h5FMAmount) + oVal((f + f*detune) * h6Harm, h6Harm * h6Tuning, baseLevel * h6env, h6Feedback, h6Drive * driveDamper(h6Tuning), h6FMFreq, h6FMenv * h6FMAmount) + oVal((f + f*detune) * h7Harm, h7Harm * h7Tuning, baseLevel * h7env, h7Feedback, h7Drive * driveDamper(h7Tuning), h7FMFreq, h7FMenv * h7FMAmount) + oVal((f + f*detune) * h8Harm, h8Harm * h8Tuning, baseLevel * h8env, h8Feedback, h8Drive * driveDamper(h8Tuning), h8FMFreq, h8FMenv * h8FMAmount); timbre(f) = voice(f, 0) + voice(f, unisonOnsetEnv * 0.02); process = gate * timbre(freq) * gain/20 <: _,_; effect = dm.freeverb_demo;
https://raw.githubusercontent.com/FineArtMaths/FaustExperiments/5b39401ea9cc16c56a06d0174b26763f8f5653e3/feedbackOrgan.dsp
faust
This is a playable synth whose oscillators are used as exciters for comb filters. It seems to be able to do organs, glass harmonicas, wood / plastic / metal percussion etc. WARNING: It can still make very loud sounds if the Drive on any oscillator is turned up while the Tuning is close to 1.0 TO DO: * Add a noise oscillator or two * Maybe global noise oscillator on the amplitude just to create a bit of analogue variation * Include a detuning envelope per harmonic * Try to capture pitch wheel, mod wheel and key release (to add a key release noise) * Save and load a preset * Microtuning I don't think tab groups are working properly, or I didn't do this right; either way this just hides the junk, which works for me. Default values for setting up sliders to make them easier to change
import("stdfaust.lib"); gain = en.adsr(0.0, 0.1, 0.7, 1.0, gate); freq = junkGroup(hslider("freq", 440, 50, 1000, 0.01)); gate = junkGroup(button("gate") : en.adsr(0.01, 0.01, 0.9, 0.1)); generalGroup(x) = hgroup("General",x); unison = generalGroup(hslider("Unison", 0.0, 0.0, 0.1, 0.001)); unisonOnset = generalGroup(hslider("Unison Onset", 0.0, 0.0, 3.0, 0.1)); unisonOnsetEnv = en.adsr(unisonOnset, 0.0, unison, unisonOnset, gate); baseLevel = generalGroup(hslider("Volume", 0.3, 0.0, 1.0, 0.001)); fmOscRate = generalGroup(hslider("FM Osc Rate", 0.1, 0.01, 200.0, 0.01)); fmOscAmt = generalGroup(hslider("FM Osc Amt", 0.0, 0.0, fmMaxRate, 1)); minA = 0.0; maxA = 2.0; maxDr = 100.0; baseFeedback = 0.999; minfeed = 0.0; maxfeed = 1.0; fmMaxRate = 5000; h1Group(x) = hgroup("Harmonic 1",x); h1Harm = h1Group(hslider("Harmonic", 1, 1, 20, 1)); h1Tuning = h1Group(hslider("Tuning", 1, 0.75, 1.5, 0.001)); h1Drive = h1Group(hslider("Drive", 0.1, 0.0, maxDr, 0.01)); h1Attack = h1Group(hslider("Attack", 0.1, minA, maxA, 0.01)); h1Decay = h1Group(hslider("Decay", 0.1, 0.01, 2.0, 0.01)); h1Feedback = h1Group(hslider("Feedback", baseFeedback, minfeed, maxfeed, 0.01)); h1Sustain = h1Group(checkbox("Sustain")); h1env = en.adsr(ba.if(h1Perc == 0, h1Attack, h1Attack / 100), ba.if(h1Perc == 0, h1Decay, h1Decay / 100), ba.if(h1Sustain == 0, 0.0, 1.0), h1Decay, gate); h1Perc = h1Group(checkbox("Percussive")); h1FMAmount = h1Group(hslider("Vibrato Amt", 0.0, 0.0, 1.0, 0.01)); h1FMFreq = h1Group(hslider("Vibrato Rate", 0.0, 0.0, fmMaxRate, 1.0)); h1FMOnset = h1Group(hslider("Vibrato Onset", 0.0, 0.0, maxA, 0.01)); h1FMenv = en.adsr(h1FMOnset, 0.0, 1.0, h1FMOnset, gate); h2Group(x) = hgroup("Harmonic 2",x); h2Harm = h2Group(hslider("Harmonic", 2, 1, 20, 1)); h2Tuning = h2Group(hslider("Tuning", 1, 0.9, 1.1, 0.0001)); h2Drive = h2Group(hslider("Drive", 0.1, 0.0, maxDr, 0.01)); h2Attack = h2Group(hslider("Attack", 0.1, minA, maxA, 0.01)); h2Decay = h2Group(hslider("Decay", 0.1, 0.01, 2.0, 0.01)); h2Feedback = h2Group(hslider("Feedback", baseFeedback, minfeed, maxfeed, 0.01)); h2Sustain = h2Group(checkbox("Sustain")); h2Perc = h2Group(checkbox("Percussive")); h2env = en.adsr(ba.if(h2Perc == 0, h2Attack, h2Attack / 100), ba.if(h2Perc == 0, h2Decay, h2Decay / 100), ba.if(h2Sustain == 0, 0.0, 1.0), h2Decay, gate); h2FMAmount = h2Group(hslider("Vibrato Amt", 0.0, 0.0, 1.0, 0.01)); h2FMFreq = h2Group(hslider("Vibrato Rate", 0.0, 0.0, fmMaxRate, 1.0)); h2FMOnset = h2Group(hslider("Vibrato Onset", 0.0, 0.0, maxA, 0.01)); h2FMenv = en.adsr(h2FMOnset, 0.0, 1.0, h2FMOnset, gate); h3Group(x) = hgroup("Harmonic 3",x); h3Harm = h3Group(hslider("Harmonic", 3, 1, 20, 1)); h3Tuning = h3Group(hslider("Tuning", 1, 0.75, 1.5, 0.001)); h3Drive = h3Group(hslider("Drive", 0.1, 0.0, maxDr, 0.01)); h3Attack = h3Group(hslider("Attack", 0.1, minA, maxA, 0.01)); h3Decay = h3Group(hslider("Decay", 0.1, 0.01, 2.0, 0.01)); h3Feedback = h3Group(hslider("Feedback", baseFeedback, minfeed, maxfeed, 0.01)); h3Sustain = h3Group(checkbox("Sustain")); h3Perc = h3Group(checkbox("Percussive")); h3env = en.adsr(ba.if(h3Perc == 0, h3Attack, h3Attack / 100), ba.if(h3Perc == 0, h3Decay, h3Decay / 100), ba.if(h3Sustain == 0, 0.0, 1.0), h3Decay, gate); h3FMAmount = h3Group(hslider("Vibrato Amt", 0.0, 0.0, 1.0, 0.01)); h3FMFreq = h3Group(hslider("Vibrato Rate", 0.0, 0.0, fmMaxRate, 1.0)); h3FMOnset = h3Group(hslider("Vibrato Onset", 0.0, 0.0, maxA, 0.01)); h3FMenv = en.adsr(h3FMOnset, 0.0, 1.0, h3FMOnset, gate); h4Group(x) = hgroup("Harmonic 4",x); h4Harm = h4Group(hslider("Harmonic", 4, 1, 20, 1)); h4Tuning = h4Group(hslider("Tuning", 1, 0.75, 1.5, 0.001)); h4Drive = h4Group(hslider("Drive", 0.1, 0.0, maxDr, 0.01)); h4Attack = h4Group(hslider("Attack", 0.1, minA, maxA, 0.01)); h4Decay = h4Group(hslider("Decay", 0.1, 0.01, 2.0, 0.01)); h4Feedback = h4Group(hslider("Feedback", baseFeedback, minfeed, maxfeed, 0.01)); h4Sustain = h4Group(checkbox("Sustain")); h4Perc = h4Group(checkbox("Percussive")); h4env = en.adsr(ba.if(h4Perc == 0, h4Attack, h4Attack / 100), ba.if(h4Perc == 0, h4Decay, h4Decay / 100), ba.if(h4Sustain == 0, 0.0, 1.0), h4Decay, gate); h4FMAmount = h4Group(hslider("Vibrato Amt", 0.0, 0.0, 1.0, 0.01)); h4FMFreq = h4Group(hslider("Vibrato Rate", 0.0, 0.0, fmMaxRate, 1.0)); h4FMOnset = h4Group(hslider("Vibrato Onset", 0.0, 0.0, maxA, 0.01)); h4FMenv = en.adsr(h4FMOnset, 0.0, 1.0, h4FMOnset, gate); h5Group(x) = hgroup("Harmonic 5",x); h5Harm = h5Group(hslider("Harmonic", 5, 1, 20, 1)); h5Tuning = h5Group(hslider("Tuning", 1, 0.75, 1.5, 0.001)); h5Drive = h5Group(hslider("Drive", 0.0, 0.0, maxDr, 0.01)); h5Attack = h5Group(hslider("Attack", 0.1, minA, maxA, 0.01)); h5Decay = h5Group(hslider("Decay", 0.1, 0.01, 2.0, 0.01)); h5Feedback = h5Group(hslider("Feedback", baseFeedback, minfeed, maxfeed, 0.01)); h5Sustain = h5Group(checkbox("Sustain")); h5Perc = h5Group(checkbox("Percussive")); h5env = en.adsr(ba.if(h5Perc == 0, h5Attack, h5Attack / 100), ba.if(h5Perc == 0, h5Decay, h5Decay / 100), ba.if(h5Sustain == 0, 0.0, 1.0), h5Decay, gate); h5FMAmount = h5Group(hslider("Vibrato Amt", 0.0, 0.0, 1.0, 0.01)); h5FMFreq = h5Group(hslider("Vibrato Rate", 0.0, 0.0, fmMaxRate, 1.0)); h5FMOnset = h5Group(hslider("Vibrato Onset", 0.0, 0.0, maxA, 0.01)); h5FMenv = en.adsr(h5FMOnset, 0.0, 1.0, h5FMOnset, gate); h6Group(x) = hgroup("Harmonic 6",x); h6Harm = h6Group(hslider("Harmonic", 6, 1, 20, 1)); h6Tuning = h6Group(hslider("Tuning", 1, 0.75, 1.5, 0.001)); h6Drive = h6Group(hslider("Drive", 0.0, 0.0, maxDr, 0.01)); h6Attack = h6Group(hslider("Attack", 0.1, minA, maxA, 0.01)); h6Decay = h6Group(hslider("Decay", 0.1, 0.01, 2.0, 0.01)); h6Feedback = h6Group(hslider("Feedback", baseFeedback, minfeed, maxfeed, 0.01)); h6Sustain = h6Group(checkbox("Sustain")); h6Perc = h6Group(checkbox("Percussive")); h6env = en.adsr(ba.if(h6Perc == 0, h6Attack, h6Attack / 100), ba.if(h6Perc == 0, h6Decay, h6Decay / 100), ba.if(h6Sustain == 0, 0.0, 1.0), h6Decay, gate); h6FMAmount = h6Group(hslider("Vibrato Amt", 0.0, 0.0, 1.0, 0.01)); h6FMFreq = h6Group(hslider("Vibrato Rate", 0.0, 0.0, fmMaxRate, 1.0)); h6FMOnset = h6Group(hslider("Vibrato Onset", 0.0, 0.0, maxA, 0.01)); h6FMenv = en.adsr(h6FMOnset, 0.0, 1.0, h6FMOnset, gate); h7Group(x) = hgroup("Harmonic 7",x); h7Harm = h7Group(hslider("Harmonic", 7, 1, 20, 1)); h7Tuning = h7Group(hslider("Tuning", 1, 0.75, 1.5, 0.001)); h7Drive = h7Group(hslider("Drive", 0.0, 0.0, maxDr, 0.01)); h7Attack = h7Group(hslider("Attack", 0.1, minA, maxA, 0.01)); h7Decay = h7Group(hslider("Decay", 0.1, 0.01, 2.0, 0.01)); h7Feedback = h7Group(hslider("Feedback", baseFeedback, minfeed, maxfeed, 0.01)); h7Sustain = h7Group(checkbox("Sustain")); h7Perc = h7Group(checkbox("Percussive")); h7env = en.adsr(ba.if(h7Perc == 0, h7Attack, h7Attack / 100), ba.if(h7Perc == 0, h7Decay, h7Decay / 100), ba.if(h7Sustain == 0, 0.0, 1.0), h7Decay, gate); h7FMAmount = h7Group(hslider("Vibrato Amt", 0.0, 0.0, 1.0, 0.01)); h7FMFreq = h7Group(hslider("Vibrato Rate", 0.0, 0.0, fmMaxRate, 1.0)); h7FMOnset = h7Group(hslider("Vibrato Onset", 0.0, 0.0, maxA, 0.01)); h7FMenv = en.adsr(h7FMOnset, 0.0, 1.0, h7FMOnset, gate); h8Group(x) = hgroup("Harmonic 8",x); h8Harm = h8Group(hslider("Harmonic", 8, 1, 20, 1)); h8Tuning = h8Group(hslider("Tuning", 1, 0.75, 1.5, 0.001)); h8Drive = h8Group(hslider("Drive", 0.0, 0.0, maxDr, 0.01)); h8Attack = h8Group(hslider("Attack", 0.1, minA, maxA, 0.01)); h8Decay = h8Group(hslider("Decay", 0.1, 0.01, 2.0, 0.01)); h8Feedback = h8Group(hslider("Feedback", baseFeedback, minfeed, maxfeed, 0.01)); h8Sustain = h8Group(checkbox("Sustain")); h8Perc = h8Group(checkbox("Percussive")); h8env = en.adsr(ba.if(h8Perc == 0, h8Attack, h8Attack / 100), ba.if(h8Perc == 0, h8Decay, h8Decay / 100), ba.if(h8Sustain == 0, 0.0, 1.0), h8Decay, gate); h8FMAmount = h8Group(hslider("Vibrato Amt", 0.0, 0.0, 1.0, 0.01)); h8FMFreq = h8Group(hslider("Vibrato Rate", 0.0, 0.0, fmMaxRate, 1.0)); h8FMOnset = h8Group(hslider("Vibrato Onset", 0.0, 0.0, maxA, 0.01)); h8FMenv = en.adsr(h8FMOnset, 0.0, 1.0, h8FMOnset, gate); driveDamper(t) = ba.if( t == 1, 0.1, ba.if( abs(t - 1) < 0.1, max(0.1, abs(t - 1) * 10), 1.0 )) ; oVal(f, harm, level, feed, drive, fmFreq, fmAmt) = os.osc(f) * level * drive : fi.fb_fcomb(44100, harm * ma.SR/(f) + os.osc(fmFreq + os.osc(fmOscRate) * fmOscAmt) * fmAmt * 5, 0.99, -1 * feed); voice(f, detune) = oVal((f + f*detune) * h1Harm, h1Harm * h1Tuning, baseLevel * h1env, h1Feedback, h1Drive * driveDamper(h1Tuning), h1FMFreq, h1FMenv * h1FMAmount) + oVal((f + f*detune) * h2Harm, h2Harm * h2Tuning, baseLevel * h2env, h2Feedback, h2Drive * driveDamper(h2Tuning), h2FMFreq, h2FMenv * h2FMAmount) + oVal((f + f*detune) * h3Harm, h3Harm * h3Tuning, baseLevel * h3env, h3Feedback, h3Drive * driveDamper(h3Tuning), h3FMFreq, h3FMenv * h3FMAmount) + oVal((f + f*detune) * h4Harm, h4Harm * h4Tuning, baseLevel * h4env, h4Feedback, h4Drive * driveDamper(h4Tuning), h4FMFreq, h4FMenv * h4FMAmount) + oVal((f + f*detune) * h5Harm, h5Harm * h5Tuning, baseLevel * h5env, h5Feedback, h5Drive * driveDamper(h5Tuning), h5FMFreq, h5FMenv * h5FMAmount) + oVal((f + f*detune) * h6Harm, h6Harm * h6Tuning, baseLevel * h6env, h6Feedback, h6Drive * driveDamper(h6Tuning), h6FMFreq, h6FMenv * h6FMAmount) + oVal((f + f*detune) * h7Harm, h7Harm * h7Tuning, baseLevel * h7env, h7Feedback, h7Drive * driveDamper(h7Tuning), h7FMFreq, h7FMenv * h7FMAmount) + oVal((f + f*detune) * h8Harm, h8Harm * h8Tuning, baseLevel * h8env, h8Feedback, h8Drive * driveDamper(h8Tuning), h8FMFreq, h8FMenv * h8FMAmount); timbre(f) = voice(f, 0) + voice(f, unisonOnsetEnv * 0.02); process = gate * timbre(freq) * gain/20 <: _,_; effect = dm.freeverb_demo;
2229c261dcadb1eb3920268c9be8d39b3f1ff3b1a10c290b4142ae8fd5e86d52
FineArtMaths/FaustExperiments
Bells.dsp
import("stdfaust.lib"); /** Plays a bell sound that changes timbre depending on the MIDI note **/ junkGroup(x) = tgroup("Junk",x); // This hides controls we don't need. gain = junkGroup(nentry("gain", 1, 0, 1, 0.01)); freq = junkGroup(hslider("freq", 440, 50, 1000, 0.01)); gate = junkGroup(button("gate") : en.adsr(0.01, 0.01, 0.9, 0.1)); pitchwheel = junkGroup(hslider("bend [midi:pitchwheel]",1,0.9,1.1,0.001)); a = vslider("Param A", 10, 3, 100, 1); b = floor((ba.hz2midikey(freq) +1)/(100 * (inharm + 1))); sustain = hslider("Sustain", 1, 1, 10, 0.1); inharm = hslider("Inharmonicty", 1, 0, 1, 0.01); lpc = hslider("Lowpass", 10000, 1, 10000, 1); fmAmount = hslider("FM Amount", 1, 0, 1, 0.01); numPartials = 10; baseFreq = freq; //220; //sqrt(freq)*100; //vslider("Base Freq", 5000, 20, 20000, 1); partials = par(z,numPartials, (ma.modulo(freq * z, numPartials)/numPartials) // The level of the partial ); envAs = par(z,numPartials, pow(100 / freq, 2)*(ma.modulo(freq * z, numPartials * (z + 1))/numPartials * (z + 1)) - (fmod(freq + z, 5))/4 // The level of the partial ); envDs = par(z,numPartials, (ma.modulo(freq * z, numPartials)/numPartials)/5 + log10((1/freq) *10000) // The level of the partial ); tunePitch(f, z) = baseFreq * (z + pow((z-1) * inharm * fmod(f, ((z + 1) + b))/(numPartials + b) + 1, 0.5)); fmAmt = par(z,numPartials, ma.modulo(freq + z*1000, 50) * pow(floor(fmod(freq + z * z * b, 4))/3, 4) ); fmFreq = par(z,numPartials, (ma.modulo(freq + z*976, numPartials)/numPartials)*(ma.modulo(freq, 10)) + 0.1 ); timbre(f) = par(z,numPartials, os.osc(tunePitch(f * (z + 1), z + 1) + fmAmount * ( os.osc(fmFreq : ba.selectn(numPartials, z)) * (fmAmt : ba.selectn(numPartials, z)) // FM ) ) * (partials : ba.selectn(numPartials, z) * ( ( (envAs : ba.selectn(numPartials, z)) * sustain, (envDs : ba.selectn(numPartials, z)) * sustain, 0, 0, gate ) : en.adsr ) ) ):> _ / numPartials; gainCorrect = 1/(partials :> +); process = gate * timbre(baseFreq) * gain * gainCorrect: fi.lowpass6e(min(20000, freq + lpc)) <: _, _; effect = dm.freeverb_demo;
https://raw.githubusercontent.com/FineArtMaths/FaustExperiments/5b39401ea9cc16c56a06d0174b26763f8f5653e3/Bells.dsp
faust
* Plays a bell sound that changes timbre depending on the MIDI note * This hides controls we don't need. 220; //sqrt(freq)*100; //vslider("Base Freq", 5000, 20, 20000, 1); The level of the partial The level of the partial The level of the partial FM
import("stdfaust.lib"); gain = junkGroup(nentry("gain", 1, 0, 1, 0.01)); freq = junkGroup(hslider("freq", 440, 50, 1000, 0.01)); gate = junkGroup(button("gate") : en.adsr(0.01, 0.01, 0.9, 0.1)); pitchwheel = junkGroup(hslider("bend [midi:pitchwheel]",1,0.9,1.1,0.001)); a = vslider("Param A", 10, 3, 100, 1); b = floor((ba.hz2midikey(freq) +1)/(100 * (inharm + 1))); sustain = hslider("Sustain", 1, 1, 10, 0.1); inharm = hslider("Inharmonicty", 1, 0, 1, 0.01); lpc = hslider("Lowpass", 10000, 1, 10000, 1); fmAmount = hslider("FM Amount", 1, 0, 1, 0.01); numPartials = 10; partials = par(z,numPartials, ); envAs = par(z,numPartials, ); envDs = par(z,numPartials, ); tunePitch(f, z) = baseFreq * (z + pow((z-1) * inharm * fmod(f, ((z + 1) + b))/(numPartials + b) + 1, 0.5)); fmAmt = par(z,numPartials, ma.modulo(freq + z*1000, 50) * pow(floor(fmod(freq + z * z * b, 4))/3, 4) ); fmFreq = par(z,numPartials, (ma.modulo(freq + z*976, numPartials)/numPartials)*(ma.modulo(freq, 10)) + 0.1 ); timbre(f) = par(z,numPartials, os.osc(tunePitch(f * (z + 1), z + 1) + fmAmount * ( ) ) * (partials : ba.selectn(numPartials, z) * ( ( (envAs : ba.selectn(numPartials, z)) * sustain, (envDs : ba.selectn(numPartials, z)) * sustain, 0, 0, gate ) : en.adsr ) ) ):> _ / numPartials; gainCorrect = 1/(partials :> +); process = gate * timbre(baseFreq) * gain * gainCorrect: fi.lowpass6e(min(20000, freq + lpc)) <: _, _; effect = dm.freeverb_demo;
bbd096b1f0b848311ccc3cbc29efaae17d057b8b1856f4b548c471587b6f5321
FineArtMaths/FaustExperiments
BlownTube.dsp
import("stdfaust.lib"); junkGroup(x) = tgroup("Junk",x); // I don't think tab groups are working properly, or I didn't do this right; either way this just hides the junk, which works for me. gain = junkGroup(hslider("gain", 0.5, 0, 1, 0.01)); freq = junkGroup(hslider("freq", 440, 50, 1000, 0.01)); gate = junkGroup(button("gate") : en.adsr(0.01, 0.01, 0.9, 0.1)); pitchwheel = junkGroup(hslider("bend [midi:pitchwheel]",1,0.9,1.1,0.001)); gFreq = freq * pitchwheel; generalGroup(x) = hgroup("1. General",x); volume = generalGroup(hslider("Overall Volume", 0.1, 0.0, 1.0, 0.01) /4); treble = generalGroup(3 - hslider("Treble", 1.4, 0, 3, 0.01) + 0.001); bass = generalGroup(3 - hslider("Bass", 1.6, 0, 3, 0.01) + 0.001); energyLoss = generalGroup(hslider("Energy Loss", 0.02, 0, 1.0, 0.001) / 3); filt = generalGroup(hslider("Filter", 0.0, 0.0, 1.0, 0.01)); keyGroup(x) = hgroup("2. Key noise",x); keyLevel = keyGroup(hslider("Level", 0.2, 0.0, 1.0, 0.01) * 30); keyFreq = keyGroup(hslider("Frequency", 0.5, 0, 1.5, 0.25)); keyRand = keyGroup( hslider("Humanize", 0.5, 0, 1, 0.01)); exciterGroup(x) = hgroup("3. Exciter",x); excAttack = exciterGroup(hslider("Attack Time", 0.0, 0, 1, 0.001)); excSus = exciterGroup(hslider("Sustain", 0.35, 0, 1, 0.001)); noiseDensity = 2000; excReediness = exciterGroup(hslider("Reed (Clarinet <--> Oboe)", 0.35, 0, 1, 0.001)); bite = exciterGroup(hslider("Bite", 0.0, 0.0, 5.0, 0.5)); noiseosc = ((os.osc(0.1) + os.osc(0.37) + os.osc(0.731) + 3) / 6); noiseShape = en.adsr(excAttack*(1 - gain)/2, 0.0, 1.0, 0.1, gate) * noiseosc; breathOsc(f) = (no.lfnoise0(noiseDensity) * (1 - excReediness) + os.triangle(f) * excReediness)/2 : fi.resonbp(f * (1 + bite) + os.triangle(bite * 1000) * bite, bite * 20 + 0.01, 1.0 + bite); exciter(f) = breathOsc(f) * (1 - noiseShape), os.square(f/2) * noiseShape/8 : +; enxciterEnv = en.adsr(excAttack, excAttack + 0.1, (1.0, 0.0 : select2(excSus == 0.0)),0.0, gate) * (excSus, 1.0 : select2(excSus == 0.0)); ingain = 0.99; oscillator(h, d) = exciter(gFreq * h + d) * enxciterEnv : fi.fb_fcomb(44100,ma.SR/(gFreq * h + d),ingain,0.999 - energyLoss/10), 1 - energyLoss/2 : * : fi.lowpass(1, freq * treble) : fi.fb_fcomb(44100,ma.SR/(gFreq * h + d),ingain,-0.999 + energyLoss/10), 1 - energyLoss/2 : * : fi.highpass(1, freq / bass); keyOscillator = os.osc(gFreq * keyFreq) * gain : fi.fb_fcomb(44100,ma.SR/(gFreq * keyFreq),1.0,0.9) * keyLevel * (1 + (no.lfnoise0(1) * keyRand - 0.5)); voice = (oscillator(1, 0) + keyOscillator) * gain * gate <: fi.resonbp(gFreq * (1 + filt * 6), filt * 20 + 1, 1.0), _ : select2(filt == 0); process = voice * volume * 4 <: _,_ ; effect = /*dm.phaser2_demo :*/ dm.freeverb_demo; // phaser sounds good but it's a bit of a cheat
https://raw.githubusercontent.com/FineArtMaths/FaustExperiments/5b39401ea9cc16c56a06d0174b26763f8f5653e3/BlownTube.dsp
faust
I don't think tab groups are working properly, or I didn't do this right; either way this just hides the junk, which works for me. dm.phaser2_demo : phaser sounds good but it's a bit of a cheat
import("stdfaust.lib"); gain = junkGroup(hslider("gain", 0.5, 0, 1, 0.01)); freq = junkGroup(hslider("freq", 440, 50, 1000, 0.01)); gate = junkGroup(button("gate") : en.adsr(0.01, 0.01, 0.9, 0.1)); pitchwheel = junkGroup(hslider("bend [midi:pitchwheel]",1,0.9,1.1,0.001)); gFreq = freq * pitchwheel; generalGroup(x) = hgroup("1. General",x); volume = generalGroup(hslider("Overall Volume", 0.1, 0.0, 1.0, 0.01) /4); treble = generalGroup(3 - hslider("Treble", 1.4, 0, 3, 0.01) + 0.001); bass = generalGroup(3 - hslider("Bass", 1.6, 0, 3, 0.01) + 0.001); energyLoss = generalGroup(hslider("Energy Loss", 0.02, 0, 1.0, 0.001) / 3); filt = generalGroup(hslider("Filter", 0.0, 0.0, 1.0, 0.01)); keyGroup(x) = hgroup("2. Key noise",x); keyLevel = keyGroup(hslider("Level", 0.2, 0.0, 1.0, 0.01) * 30); keyFreq = keyGroup(hslider("Frequency", 0.5, 0, 1.5, 0.25)); keyRand = keyGroup( hslider("Humanize", 0.5, 0, 1, 0.01)); exciterGroup(x) = hgroup("3. Exciter",x); excAttack = exciterGroup(hslider("Attack Time", 0.0, 0, 1, 0.001)); excSus = exciterGroup(hslider("Sustain", 0.35, 0, 1, 0.001)); noiseDensity = 2000; excReediness = exciterGroup(hslider("Reed (Clarinet <--> Oboe)", 0.35, 0, 1, 0.001)); bite = exciterGroup(hslider("Bite", 0.0, 0.0, 5.0, 0.5)); noiseosc = ((os.osc(0.1) + os.osc(0.37) + os.osc(0.731) + 3) / 6); noiseShape = en.adsr(excAttack*(1 - gain)/2, 0.0, 1.0, 0.1, gate) * noiseosc; breathOsc(f) = (no.lfnoise0(noiseDensity) * (1 - excReediness) + os.triangle(f) * excReediness)/2 : fi.resonbp(f * (1 + bite) + os.triangle(bite * 1000) * bite, bite * 20 + 0.01, 1.0 + bite); exciter(f) = breathOsc(f) * (1 - noiseShape), os.square(f/2) * noiseShape/8 : +; enxciterEnv = en.adsr(excAttack, excAttack + 0.1, (1.0, 0.0 : select2(excSus == 0.0)),0.0, gate) * (excSus, 1.0 : select2(excSus == 0.0)); ingain = 0.99; oscillator(h, d) = exciter(gFreq * h + d) * enxciterEnv : fi.fb_fcomb(44100,ma.SR/(gFreq * h + d),ingain,0.999 - energyLoss/10), 1 - energyLoss/2 : * : fi.lowpass(1, freq * treble) : fi.fb_fcomb(44100,ma.SR/(gFreq * h + d),ingain,-0.999 + energyLoss/10), 1 - energyLoss/2 : * : fi.highpass(1, freq / bass); keyOscillator = os.osc(gFreq * keyFreq) * gain : fi.fb_fcomb(44100,ma.SR/(gFreq * keyFreq),1.0,0.9) * keyLevel * (1 + (no.lfnoise0(1) * keyRand - 0.5)); voice = (oscillator(1, 0) + keyOscillator) * gain * gate <: fi.resonbp(gFreq * (1 + filt * 6), filt * 20 + 1, 1.0), _ : select2(filt == 0); process = voice * volume * 4 <: _,_ ;
abc862bf0ca6030702b103ddf590279fbff1a5a1a9499a0a85dade2e36cdeba7
FineArtMaths/FaustExperiments
DelayModulation.dsp
import("stdfaust.lib"); junkGroup(x) = tgroup("Junk",x); // I don't think tab groups are working properly, or I didn't do this right; either way this just hides the junk, which works for me. gain = junkGroup(nentry("gain", 1, 0, 1, 0.01)) * en.adsr(0.0, 0.1, 0.7, 1.0, gate); freq = junkGroup(hslider("freq", 440, 50, 1000, 0.01))* pitchwheel; gate = junkGroup(button("gate") : en.adsr(0.01, 0.01, 0.9, 0.1)); pitchwheel = junkGroup(hslider("bend [midi:pitchwheel]",1,0.9,1.1,0.001)); /* Delay Modulation */ modFreqFine = hslider("DM Fine", 0.01, 0.0, 1, 0.001); modFreqCoarse = hslider("DM Course", 0, 0, 20, 1); modAmpCoarse = hslider("DM Amp Coarse", 0, 0, 5000, 100); modAmpFine = hslider("DM Amp Fine", 0, 0, 100, 1); modAmp = modAmpCoarse + modAmpFine; modWave = hslider("DM Wave", 0, 0, 2, 1); lpc = hslider("LPF Cutoff", 10000, -10000, 10000, 10); hpc = hslider("HPF Cutoff", 0, -10000, 10000, 10); volume = hslider("Overall volume", 1, 0, 1, 0.01); ampModFreqFine = hslider("Amp Mod Freq Fine", 0, 0, 1, 0.001); ampModFreqCoarse = hslider("Amp Mod Freq Coarse", 0, 0, 50, 1); ampModFreq = ampModFreqFine + ampModFreqCoarse; ampModWidth = hslider("Amp Mod Width", 0, 0, 500, 1); ampFreqMult = 1, freq/128: select2(checkbox("Follow Pitch")); dmOsc(f) = modWave, os.triangle(f), os.osc(f), os.sawtooth(f) : select3; dmFreqCalc = freq * (modFreqCoarse + modFreqFine); modAmplitude = min(3000, max(0, modAmp + os.osc(ampModFreq) * ampModWidth)); modAmpCalc = modAmplitude * ampFreqMult; process = os.osc(freq) * gate * gain : @(min(10000, max(0, dmOsc(dmFreqCalc) * modAmpCalc))) : fi.lowpass(6, min(20000, freq + lpc)) : fi.highpass(6, max(1, freq + hpc)) * volume <: _,_; effect = dm.freeverb_demo;
https://raw.githubusercontent.com/FineArtMaths/FaustExperiments/5b39401ea9cc16c56a06d0174b26763f8f5653e3/DelayModulation.dsp
faust
I don't think tab groups are working properly, or I didn't do this right; either way this just hides the junk, which works for me. Delay Modulation
import("stdfaust.lib"); gain = junkGroup(nentry("gain", 1, 0, 1, 0.01)) * en.adsr(0.0, 0.1, 0.7, 1.0, gate); freq = junkGroup(hslider("freq", 440, 50, 1000, 0.01))* pitchwheel; gate = junkGroup(button("gate") : en.adsr(0.01, 0.01, 0.9, 0.1)); pitchwheel = junkGroup(hslider("bend [midi:pitchwheel]",1,0.9,1.1,0.001)); modFreqFine = hslider("DM Fine", 0.01, 0.0, 1, 0.001); modFreqCoarse = hslider("DM Course", 0, 0, 20, 1); modAmpCoarse = hslider("DM Amp Coarse", 0, 0, 5000, 100); modAmpFine = hslider("DM Amp Fine", 0, 0, 100, 1); modAmp = modAmpCoarse + modAmpFine; modWave = hslider("DM Wave", 0, 0, 2, 1); lpc = hslider("LPF Cutoff", 10000, -10000, 10000, 10); hpc = hslider("HPF Cutoff", 0, -10000, 10000, 10); volume = hslider("Overall volume", 1, 0, 1, 0.01); ampModFreqFine = hslider("Amp Mod Freq Fine", 0, 0, 1, 0.001); ampModFreqCoarse = hslider("Amp Mod Freq Coarse", 0, 0, 50, 1); ampModFreq = ampModFreqFine + ampModFreqCoarse; ampModWidth = hslider("Amp Mod Width", 0, 0, 500, 1); ampFreqMult = 1, freq/128: select2(checkbox("Follow Pitch")); dmOsc(f) = modWave, os.triangle(f), os.osc(f), os.sawtooth(f) : select3; dmFreqCalc = freq * (modFreqCoarse + modFreqFine); modAmplitude = min(3000, max(0, modAmp + os.osc(ampModFreq) * ampModWidth)); modAmpCalc = modAmplitude * ampFreqMult; process = os.osc(freq) * gate * gain : @(min(10000, max(0, dmOsc(dmFreqCalc) * modAmpCalc))) : fi.lowpass(6, min(20000, freq + lpc)) : fi.highpass(6, max(1, freq + hpc)) * volume <: _,_; effect = dm.freeverb_demo;
d7cd5e99196a609ba67106100de4f46d3d3e6c46cf4c10dc2ae55cd601ab27d2
FineArtMaths/FaustExperiments
FMOrgan.dsp
import("stdfaust.lib"); /* This is a playable synth whose oscillators are used as exciters for comb filters. TO DO: * Add a noise oscillator or two * Maybe global noise oscillator on the amplitude just to create a bit of analogue variation * Include a detuning envelope per harmonic * Try to capture pitch wheel, mod wheel and key release (to add a key release noise) * Save and load a preset * Microtuning */ junkGroup(x) = tgroup("Junk",x); // I don't think tab groups are working properly, or I didn't do this right; either way this just hides the junk, which works for me. gain = junkGroup(nentry("gain", 1, 0, 1, 0.01)) * en.adsr(0.0, 0.1, 0.7, 1.0, gate); freq = junkGroup(hslider("freq", 440, 50, 1000, 0.01))* pitchwheel; gate = junkGroup(button("gate") : en.adsr(0.01, 0.01, 0.9, 0.1)); pitchwheel = junkGroup(hslider("bend [midi:pitchwheel]",1,0.9,1.1,0.001)); generalGroup(x) = hgroup("1. General",x); baseLevel = generalGroup(hslider("Volume", 0.3, 0.0, 1.0, 0.001)); // Default values for setting up sliders to make them easier to change minA = 0.0; maxA = 2.0; maxDr = 100.0; baseFeedback = 0.999; minfeed = 0.0; maxfeed = 1.0; fmMaxRate = 5000; h1Group(x) = vgroup("2. First Harmonic",x); h1OscGroup(x) = h1Group(hgroup("Oscillator",x)); h1FMGroup(x) = h1Group(hgroup("FM",x)); h1Group(x) = vgroup("Harmonic 1",x); h1OscGroup(x) = h1Group(hgroup("Oscillator",x)); h1FMGroup(x) = h1Group(hgroup("FM",x)); h1Harm = h1OscGroup(hslider("Harmonic", 1, 1, 20, 1)); h1Tuning = h1OscGroup(hslider("Tuning", 1, 0.75, 1.5, 0.001)); h1Drive = h1OscGroup(hslider("Drive", 6.0, 0.0, maxDr, 0.01)); h1Attack = h1OscGroup(hslider("Attack", 0.1, minA, maxA, 0.01)); h1Decay = h1OscGroup(hslider("Decay", 0.1, 0.01, 2.0, 0.01)); h1Feedback = h1OscGroup(hslider("Feedback", baseFeedback, minfeed, maxfeed, 0.01)); h1Sustain = h1OscGroup(checkbox("Sustain")); h1env = en.adsr(ba.if(h1Perc == 0, h1Attack, h1Attack / 100), ba.if(h1Perc == 0, h1Decay, h1Decay / 100), ba.if(h1Sustain == 0, 0.0, 1.0), h1Decay, gate); h1Perc = h1OscGroup(checkbox("Percussive")); h1FMAmount = h1FMGroup(hslider("FM Amt", 1.0, 0.0, 1.0, 0.01)) * 5; h1FMFreqOct = h1FMGroup(hslider("FM Octave", 1, 0, 10, 1)); h1FMFreqFine = h1FMGroup(hslider("FM Fine", 0.0, 0.0, 1.0, 0.001)); h1FMFreq = h1FMFreqOct + h1FMFreqFine; h1FMFeed = h1FMGroup(hslider("FM feed", 0.0, 0.0, 0.999, 0.001)); h1FMOnset = h1FMGroup(hslider("Vibrato Onset", 0.0, 0.0, maxA, 0.01)); h1FMenv = en.adsr(h1FMOnset, 0.0, 1.0, h1FMOnset, gate); h1FMOscRate = h1FMGroup(hslider("FM Osc Rate", 0.1, 0.01, 50.0, 0.01)); h1FMOscAmt = h1FMGroup(hslider("FM Osc Amt", 0.0, 0.0, 200, 1)); h1FMFBOscRate = h1FMGroup(hslider("FM FB Osc Rate", 0.1, 0.01, 50.0, 0.01)); h1FMFBOscAmt = h1FMGroup(hslider("FM FB Osc Amt", 0.0, 0.0, 200, 1)); h2Group(x) = vgroup("3. Second Harmonic",x); h2OscGroup(x) = h2Group(hgroup("Oscillator",x)); h2FMGroup(x) = h2Group(hgroup("FM",x)); h2Harm = h2OscGroup(hslider("Harmonic", 1, 1, 20, 1)); h2Tuning = h2OscGroup(hslider("Tuning", 1, 0.75, 1.5, 0.001)); h2Drive = h2OscGroup(hslider("Drive", 0.1, 0.0, maxDr, 0.01)); h2Attack = h2OscGroup(hslider("Attack", 0.1, minA, maxA, 0.01)); h2Decay = h2OscGroup(hslider("Decay", 0.1, 0.01, 2.0, 0.01)); h2Feedback = h2OscGroup(hslider("Feedback", baseFeedback, minfeed, maxfeed, 0.01)); h2Sustain = h2OscGroup(checkbox("Sustain")); h2env = en.adsr(ba.if(h2Perc == 0, h2Attack, h2Attack / 100), ba.if(h2Perc == 0, h2Decay, h2Decay / 100), ba.if(h2Sustain == 0, 0.0, 1.0), h2Decay, gate); h2Perc = h2OscGroup(checkbox("Percussive")); h2FMAmount = h2FMGroup(hslider("FM Amt", 0.0, 0.0, 1.0, 0.01)) * 5; h2FMFreqOct = h2FMGroup(hslider("FM Octave", 0, -5, 5, 1)); h2FMFreqFine = h2FMGroup(hslider("FM Fine", 0.0, 0.0, 1.0, 0.001)); h2FMFreq = h2FMFreqOct + h2FMFreqFine; h2FMFeed = h2FMGroup(hslider("FM feed", 0.0, 0.0, 0.999, 0.001)); h2FMOnset = h2FMGroup(hslider("Vibrato Onset", 0.0, 0.0, maxA, 0.01)); h2FMenv = en.adsr(h2FMOnset, 0.0, 1.0, h2FMOnset, gate); h2FMOscRate = h2FMGroup(hslider("FM Osc Rate", 0.1, 0.01, 200.0, 0.01)); h2FMOscAmt = h2FMGroup(hslider("FM Osc Amt", 0.0, 0.0, 200, 1)); h2FMFBOscRate = h2FMGroup(hslider("FM FB Osc Rate", 0.1, 0.01, 200.0, 0.01)); h2FMFBOscAmt = h2FMGroup(hslider("FM FB Osc Amt", 0.0, 0.0, 200, 1)); /**************************** RESONATOR *****************************/ bodyGroup(x) = hgroup("4. Body",x); rezu4 = bodyGroup(vslider("U04", 0, 0, 0.5, 0.01)); rezu3 = bodyGroup(vslider("U03", 0, 0, 0.5, 0.01)); rezu2 = bodyGroup(vslider("U02", 0, 0, 0.5, 0.01)); rezu1 = bodyGroup(vslider("U01", 0, 0, 0.5, 0.01)); rez0 = bodyGroup(vslider("H00", 0, 0, 0.5, 0.01)); rez1 = bodyGroup(vslider("H01", 0, 0, 0.5, 0.01)); rez2 = bodyGroup(vslider("H02", 0, 0, 0.5, 0.01)); rez3 = bodyGroup(vslider("H03", 0, 0, 0.5, 0.01)); rez4 = bodyGroup(vslider("H04", 0, 0, 0.5, 0.01)); rez5 = bodyGroup(vslider("H05", 0, 0, 0.5, 0.01)); rez6 = bodyGroup(vslider("H06", 0, 0, 0.5, 0.01)); rez7 = bodyGroup(vslider("H07", 0, 0, 0.5, 0.01)); rez8 = bodyGroup(vslider("H08", 0, 0, 0.5, 0.01)); rez9 = bodyGroup(vslider("H09", 0, 0, 0.5, 0.01)); rez10 = bodyGroup(vslider("H10", 0, 0, 0.5, 0.01)); rez11 = bodyGroup(vslider("H11", 0, 0, 0.5, 0.01)); rezBloom = bodyGroup(vslider("Bloom", 0, 0, 2, 0.01)); rezA = bodyGroup(vslider("Amount", 30, 15, 100, 1)); rezAmt = rezA * en.adsr(rezBloom, 0.0, 1.0, 1.0, gate); gFreq = freq; resonator = _ , fi.resonlp(2 * gFreq / 5,rezAmt,rezu3 * 2.5), fi.resonlp(gFreq / 4,rezAmt,rezu2 * 2), fi.resonlp(2 * gFreq / 3,rezAmt,rezu1 * 1.5), fi.resonlp(gFreq / 2,rezAmt,rez0), fi.resonlp(gFreq * 1,rezAmt,rez1), fi.resonlp(gFreq * 2,rezAmt,rez2), fi.resonlp(gFreq * 3,rezAmt,rez3), fi.resonlp(gFreq * 4,rezAmt,rez4), fi.resonlp(gFreq * 5,rezAmt,rez5), fi.resonlp(gFreq * 6,rezAmt,rez6), fi.resonlp(gFreq * 7,rezAmt,rez7), fi.resonlp(gFreq * 8,rezAmt,rez8), fi.resonlp(gFreq * 9,rezAmt,rez9), fi.resonlp(gFreq * 10,rezAmt,rez10), fi.resonlp(gFreq * 12,rezAmt,rez11) :> _ / (rez1 + rez2 + rez3 + rez4 + rez5 + rez6 + rez7 + rez8 + rez9 + rez10 + rez11 + 1 + rez0 + rezu1 * 1.5 + rezu2 * 2 + rezu3 * 2.5); driveDamper(t) = ba.if( t == 1, 0.1, ba.if( abs(t - 1) < 0.1, max(0.1, abs(t - 1) * 10), 1.0 )) ; fmFreqCalc (f, fmFreq, fmoscA, fmoscR) = max(0, f* fmFreq + os.osc(fmoscR) * fmoscA); fmVal(f, harm, fmFreq, fmAmt, fmFeed, fmoscA, fmoscR, fmfboscA, fmfboscR) = ((((_ + fmFreqCalc(f, fmFreq, fmoscA, fmoscR)) ) : os.square) * fmAmt) ~ (* (fmFeed * f + os.osc(fmfboscR) * fmfboscA)); // (* (fmFeed * (f - 1) + os.osc(fmfboscR) * fmfboscA)); //os.osc(f * fmFreq + os.osc(fmOscRate) * fmOscAmt) * fmAmt * 5; oVal(f, harm, level, feed, drive, fmFreq, fmAmt, fmFeed, fmoscA, fmoscR, fmfboscA, fmfboscR) = os.osc(f + fmVal(f, harm, fmFreq, fmAmt, fmFeed, fmoscA, fmoscR, fmfboscA, fmfboscR)) * level * drive : fi.fb_fcomb( 44100, harm * ma.SR/(f) + fmVal(f, harm, fmFreq, fmAmt, fmFeed, fmoscA, fmoscR, fmfboscA, fmfboscR), 0.99, -1 * feed ); voice(f, detune) = oVal((f + f*detune) * h1Harm, h1Harm * h1Tuning, baseLevel * h1env, h1Feedback, h1Drive * driveDamper(h1Tuning), h1FMFreq, h1FMenv * h1FMAmount, h1FMFeed, h1FMOscAmt, h1FMOscRate, h1FMFBOscAmt, h1FMFBOscRate) + oVal((f + f*detune) * h2Harm, h2Harm * h2Tuning, baseLevel * h2env, h2Feedback, h2Drive * driveDamper(h2Tuning), h2FMFreq, h2FMenv * h2FMAmount, h2FMFeed, h2FMOscAmt, h2FMOscRate, h2FMFBOscAmt, h2FMFBOscRate); timbre(f) = voice(f, 0); process = gate * timbre(freq) * gain/20 <: resonator <: _, _; effect = dm.freeverb_demo;
https://raw.githubusercontent.com/FineArtMaths/FaustExperiments/5b39401ea9cc16c56a06d0174b26763f8f5653e3/FMOrgan.dsp
faust
This is a playable synth whose oscillators are used as exciters for comb filters. TO DO: * Add a noise oscillator or two * Maybe global noise oscillator on the amplitude just to create a bit of analogue variation * Include a detuning envelope per harmonic * Try to capture pitch wheel, mod wheel and key release (to add a key release noise) * Save and load a preset * Microtuning I don't think tab groups are working properly, or I didn't do this right; either way this just hides the junk, which works for me. Default values for setting up sliders to make them easier to change *************************** RESONATOR **************************** (* (fmFeed * (f - 1) + os.osc(fmfboscR) * fmfboscA)); os.osc(f * fmFreq + os.osc(fmOscRate) * fmOscAmt) * fmAmt * 5;
import("stdfaust.lib"); gain = junkGroup(nentry("gain", 1, 0, 1, 0.01)) * en.adsr(0.0, 0.1, 0.7, 1.0, gate); freq = junkGroup(hslider("freq", 440, 50, 1000, 0.01))* pitchwheel; gate = junkGroup(button("gate") : en.adsr(0.01, 0.01, 0.9, 0.1)); pitchwheel = junkGroup(hslider("bend [midi:pitchwheel]",1,0.9,1.1,0.001)); generalGroup(x) = hgroup("1. General",x); baseLevel = generalGroup(hslider("Volume", 0.3, 0.0, 1.0, 0.001)); minA = 0.0; maxA = 2.0; maxDr = 100.0; baseFeedback = 0.999; minfeed = 0.0; maxfeed = 1.0; fmMaxRate = 5000; h1Group(x) = vgroup("2. First Harmonic",x); h1OscGroup(x) = h1Group(hgroup("Oscillator",x)); h1FMGroup(x) = h1Group(hgroup("FM",x)); h1Group(x) = vgroup("Harmonic 1",x); h1OscGroup(x) = h1Group(hgroup("Oscillator",x)); h1FMGroup(x) = h1Group(hgroup("FM",x)); h1Harm = h1OscGroup(hslider("Harmonic", 1, 1, 20, 1)); h1Tuning = h1OscGroup(hslider("Tuning", 1, 0.75, 1.5, 0.001)); h1Drive = h1OscGroup(hslider("Drive", 6.0, 0.0, maxDr, 0.01)); h1Attack = h1OscGroup(hslider("Attack", 0.1, minA, maxA, 0.01)); h1Decay = h1OscGroup(hslider("Decay", 0.1, 0.01, 2.0, 0.01)); h1Feedback = h1OscGroup(hslider("Feedback", baseFeedback, minfeed, maxfeed, 0.01)); h1Sustain = h1OscGroup(checkbox("Sustain")); h1env = en.adsr(ba.if(h1Perc == 0, h1Attack, h1Attack / 100), ba.if(h1Perc == 0, h1Decay, h1Decay / 100), ba.if(h1Sustain == 0, 0.0, 1.0), h1Decay, gate); h1Perc = h1OscGroup(checkbox("Percussive")); h1FMAmount = h1FMGroup(hslider("FM Amt", 1.0, 0.0, 1.0, 0.01)) * 5; h1FMFreqOct = h1FMGroup(hslider("FM Octave", 1, 0, 10, 1)); h1FMFreqFine = h1FMGroup(hslider("FM Fine", 0.0, 0.0, 1.0, 0.001)); h1FMFreq = h1FMFreqOct + h1FMFreqFine; h1FMFeed = h1FMGroup(hslider("FM feed", 0.0, 0.0, 0.999, 0.001)); h1FMOnset = h1FMGroup(hslider("Vibrato Onset", 0.0, 0.0, maxA, 0.01)); h1FMenv = en.adsr(h1FMOnset, 0.0, 1.0, h1FMOnset, gate); h1FMOscRate = h1FMGroup(hslider("FM Osc Rate", 0.1, 0.01, 50.0, 0.01)); h1FMOscAmt = h1FMGroup(hslider("FM Osc Amt", 0.0, 0.0, 200, 1)); h1FMFBOscRate = h1FMGroup(hslider("FM FB Osc Rate", 0.1, 0.01, 50.0, 0.01)); h1FMFBOscAmt = h1FMGroup(hslider("FM FB Osc Amt", 0.0, 0.0, 200, 1)); h2Group(x) = vgroup("3. Second Harmonic",x); h2OscGroup(x) = h2Group(hgroup("Oscillator",x)); h2FMGroup(x) = h2Group(hgroup("FM",x)); h2Harm = h2OscGroup(hslider("Harmonic", 1, 1, 20, 1)); h2Tuning = h2OscGroup(hslider("Tuning", 1, 0.75, 1.5, 0.001)); h2Drive = h2OscGroup(hslider("Drive", 0.1, 0.0, maxDr, 0.01)); h2Attack = h2OscGroup(hslider("Attack", 0.1, minA, maxA, 0.01)); h2Decay = h2OscGroup(hslider("Decay", 0.1, 0.01, 2.0, 0.01)); h2Feedback = h2OscGroup(hslider("Feedback", baseFeedback, minfeed, maxfeed, 0.01)); h2Sustain = h2OscGroup(checkbox("Sustain")); h2env = en.adsr(ba.if(h2Perc == 0, h2Attack, h2Attack / 100), ba.if(h2Perc == 0, h2Decay, h2Decay / 100), ba.if(h2Sustain == 0, 0.0, 1.0), h2Decay, gate); h2Perc = h2OscGroup(checkbox("Percussive")); h2FMAmount = h2FMGroup(hslider("FM Amt", 0.0, 0.0, 1.0, 0.01)) * 5; h2FMFreqOct = h2FMGroup(hslider("FM Octave", 0, -5, 5, 1)); h2FMFreqFine = h2FMGroup(hslider("FM Fine", 0.0, 0.0, 1.0, 0.001)); h2FMFreq = h2FMFreqOct + h2FMFreqFine; h2FMFeed = h2FMGroup(hslider("FM feed", 0.0, 0.0, 0.999, 0.001)); h2FMOnset = h2FMGroup(hslider("Vibrato Onset", 0.0, 0.0, maxA, 0.01)); h2FMenv = en.adsr(h2FMOnset, 0.0, 1.0, h2FMOnset, gate); h2FMOscRate = h2FMGroup(hslider("FM Osc Rate", 0.1, 0.01, 200.0, 0.01)); h2FMOscAmt = h2FMGroup(hslider("FM Osc Amt", 0.0, 0.0, 200, 1)); h2FMFBOscRate = h2FMGroup(hslider("FM FB Osc Rate", 0.1, 0.01, 200.0, 0.01)); h2FMFBOscAmt = h2FMGroup(hslider("FM FB Osc Amt", 0.0, 0.0, 200, 1)); bodyGroup(x) = hgroup("4. Body",x); rezu4 = bodyGroup(vslider("U04", 0, 0, 0.5, 0.01)); rezu3 = bodyGroup(vslider("U03", 0, 0, 0.5, 0.01)); rezu2 = bodyGroup(vslider("U02", 0, 0, 0.5, 0.01)); rezu1 = bodyGroup(vslider("U01", 0, 0, 0.5, 0.01)); rez0 = bodyGroup(vslider("H00", 0, 0, 0.5, 0.01)); rez1 = bodyGroup(vslider("H01", 0, 0, 0.5, 0.01)); rez2 = bodyGroup(vslider("H02", 0, 0, 0.5, 0.01)); rez3 = bodyGroup(vslider("H03", 0, 0, 0.5, 0.01)); rez4 = bodyGroup(vslider("H04", 0, 0, 0.5, 0.01)); rez5 = bodyGroup(vslider("H05", 0, 0, 0.5, 0.01)); rez6 = bodyGroup(vslider("H06", 0, 0, 0.5, 0.01)); rez7 = bodyGroup(vslider("H07", 0, 0, 0.5, 0.01)); rez8 = bodyGroup(vslider("H08", 0, 0, 0.5, 0.01)); rez9 = bodyGroup(vslider("H09", 0, 0, 0.5, 0.01)); rez10 = bodyGroup(vslider("H10", 0, 0, 0.5, 0.01)); rez11 = bodyGroup(vslider("H11", 0, 0, 0.5, 0.01)); rezBloom = bodyGroup(vslider("Bloom", 0, 0, 2, 0.01)); rezA = bodyGroup(vslider("Amount", 30, 15, 100, 1)); rezAmt = rezA * en.adsr(rezBloom, 0.0, 1.0, 1.0, gate); gFreq = freq; resonator = _ , fi.resonlp(2 * gFreq / 5,rezAmt,rezu3 * 2.5), fi.resonlp(gFreq / 4,rezAmt,rezu2 * 2), fi.resonlp(2 * gFreq / 3,rezAmt,rezu1 * 1.5), fi.resonlp(gFreq / 2,rezAmt,rez0), fi.resonlp(gFreq * 1,rezAmt,rez1), fi.resonlp(gFreq * 2,rezAmt,rez2), fi.resonlp(gFreq * 3,rezAmt,rez3), fi.resonlp(gFreq * 4,rezAmt,rez4), fi.resonlp(gFreq * 5,rezAmt,rez5), fi.resonlp(gFreq * 6,rezAmt,rez6), fi.resonlp(gFreq * 7,rezAmt,rez7), fi.resonlp(gFreq * 8,rezAmt,rez8), fi.resonlp(gFreq * 9,rezAmt,rez9), fi.resonlp(gFreq * 10,rezAmt,rez10), fi.resonlp(gFreq * 12,rezAmt,rez11) :> _ / (rez1 + rez2 + rez3 + rez4 + rez5 + rez6 + rez7 + rez8 + rez9 + rez10 + rez11 + 1 + rez0 + rezu1 * 1.5 + rezu2 * 2 + rezu3 * 2.5); driveDamper(t) = ba.if( t == 1, 0.1, ba.if( abs(t - 1) < 0.1, max(0.1, abs(t - 1) * 10), 1.0 )) ; fmFreqCalc (f, fmFreq, fmoscA, fmoscR) = max(0, f* fmFreq + os.osc(fmoscR) * fmoscA); fmVal(f, harm, fmFreq, fmAmt, fmFeed, fmoscA, fmoscR, fmfboscA, fmfboscR) = ((((_ + fmFreqCalc(f, fmFreq, fmoscA, fmoscR)) ) : os.square) * fmAmt) ~ (* (fmFeed * f + os.osc(fmfboscR) * fmfboscA)); oVal(f, harm, level, feed, drive, fmFreq, fmAmt, fmFeed, fmoscA, fmoscR, fmfboscA, fmfboscR) = os.osc(f + fmVal(f, harm, fmFreq, fmAmt, fmFeed, fmoscA, fmoscR, fmfboscA, fmfboscR)) * level * drive : fi.fb_fcomb( 44100, harm * ma.SR/(f) + fmVal(f, harm, fmFreq, fmAmt, fmFeed, fmoscA, fmoscR, fmfboscA, fmfboscR), 0.99, -1 * feed ); voice(f, detune) = oVal((f + f*detune) * h1Harm, h1Harm * h1Tuning, baseLevel * h1env, h1Feedback, h1Drive * driveDamper(h1Tuning), h1FMFreq, h1FMenv * h1FMAmount, h1FMFeed, h1FMOscAmt, h1FMOscRate, h1FMFBOscAmt, h1FMFBOscRate) + oVal((f + f*detune) * h2Harm, h2Harm * h2Tuning, baseLevel * h2env, h2Feedback, h2Drive * driveDamper(h2Tuning), h2FMFreq, h2FMenv * h2FMAmount, h2FMFeed, h2FMOscAmt, h2FMOscRate, h2FMFBOscAmt, h2FMFBOscRate); timbre(f) = voice(f, 0); process = gate * timbre(freq) * gain/20 <: resonator <: _, _; effect = dm.freeverb_demo;
2fa3eb7bf71c2267d6b694942f69f708f025270e7078d97cbe4960fedae41e44
FineArtMaths/FaustExperiments
ScheerbartOrgan.dsp
import("stdfaust.lib"); /* Written by Rich Cochrane: https://cochranemusic.com A simple vehicle for exploring Scheerbart tunings. These are 12EDO with one or more notes adjusted up or down to match their nearest 10EDO neighbour. Made available under CC BY-NC: https://creativecommons.org/licenses/by-nc/4.0/ (In sort, you can do what you like with this code as long as you don't use it in a commercial product and you give me credit. Additionally, you may use this, or derivatives of it, on recorded music that's released for sale if you credit me and link back to cochranemusic.com.) */ junkGroup(x) = tgroup("Junk",x); // This hides controls we don't need. gain = junkGroup(nentry("gain", 1, 0, 1, 0.01)) * en.adsr(envA, envD, envS, envR, gate); freq = junkGroup(hslider("freq", 440, 50, 1000, 0.01)); gate = junkGroup(button("gate") : en.adsr(0.01, 0.01, 0.9, 0.1)); pitchwheel = junkGroup(hslider("bend [midi:pitchwheel]",1,0.9,1.1,0.001)); ////////////////////////////////////// // General controls // (applied to the final sound) ////////////////////////////////////// generalGroup(x) = hgroup("1. General",x); generalLevel1(x) = generalGroup(vgroup("A. Level & Filter", x)); baseLevel = generalLevel1(hslider("Volume", 1.0, 0.0, 10.0, 0.01)); filtRez = generalLevel1(hslider("Resonance", 0.1, 0.1, 2.0, 0.001)); filtFreq = generalLevel1(hslider("Cutoff [midi: ctrl 1]", 2000.0, 10.0, 2000.0, 1)); generalLevel2(x) = generalGroup(vgroup("B. Envelope", x)); envA = generalLevel2(hslider("1. A", 0.0, 0.0, 3.0, 0.01)); envD = generalLevel2(hslider("2. D", 0.2, 0.0, 3.0, 0.01)); envS = generalLevel2(hslider("3. S", 0.8, 0.0, 1.0, 0.01)); envR = generalLevel2(hslider("4. R", 0.4, 0.0, 3.0, 0.01)); ////////////////////////////////////// // Tuning controls ////////////////////////////////////// // Note: When using a MIDI controller, you get retuning in steps of 1 cent. // When you drag the control on the GUI it snaps to the "correct" values. tuningGroup(x) = hgroup("2. Tuning",x); tunings = ( 0, tuningGroup(vslider("01. C#[midi:ctrl 14]", 100, 100, 120, 20)), tuningGroup(vslider("02. D[midi:ctrl 3]", 200, 120, 240, 40)), tuningGroup(vslider("03. D#[midi:ctrl 4]", 300, 240, 360, 60)), tuningGroup(vslider("04. E[midi:ctrl 5]", 400, 360, 480, 40)), tuningGroup(vslider("05. F[midi:ctrl 6]", 500, 480, 500, 20)), 600, tuningGroup(vslider("07. G[midi:ctrl 7]", 700, 700, 720, 20)), tuningGroup(vslider("08. G#[midi:ctrl 8]", 800, 720, 840, 40)), tuningGroup(vslider("09. A[midi:ctrl 9]", 900, 840, 960, 60)), tuningGroup(vslider("10. A#[midi:ctrl 10]", 1000, 960, 1080, 40)), tuningGroup(vslider("11. B[midi:ctrl 11]", 1100, 1080, 1200, 20)) ); ////////////////////////////////////// // Tuning algorithm ////////////////////////////////////// zeroNote = 8.1758; centRatio = 1.00057778951; // 2^(1/1200), i.e. one hundredth of a semitone tunePitch(f) = zeroNote * pow(2, floor(ba.hz2midikey(f) / 12)) * pow(centRatio, (tunings : ba.selectn(12, (ba.hz2midikey(f) % 12)))); gFreq = tunePitch(freq) * pitchwheel; ////////////////////////////////////// // Timbre ////////////////////////////////////// numPartials = 10; partialsGroup(x) = hgroup("3. Timbre", x); partials = par(z,numPartials, partialsGroup(vslider("%z",(numPartials - z)/numPartials, 0, 1, 0.01)) ); timbre(f) = par(z,numPartials, os.osc( tunePitch(freq * (z + 1)) * pitchwheel) * (partials: ba.selectn(numPartials, z)) ):> _ / numPartials; process = gate * timbre(freq) * gain * baseLevel : fi.resonlp(filtFreq,filtRez,0.5) <: _, _; effect = dm.freeverb_demo;
https://raw.githubusercontent.com/FineArtMaths/FaustExperiments/5b39401ea9cc16c56a06d0174b26763f8f5653e3/ScheerbartOrgan.dsp
faust
Written by Rich Cochrane: https://cochranemusic.com A simple vehicle for exploring Scheerbart tunings. These are 12EDO with one or more notes adjusted up or down to match their nearest 10EDO neighbour. Made available under CC BY-NC: https://creativecommons.org/licenses/by-nc/4.0/ (In sort, you can do what you like with this code as long as you don't use it in a commercial product and you give me credit. Additionally, you may use this, or derivatives of it, on recorded music that's released for sale if you credit me and link back to cochranemusic.com.) This hides controls we don't need. //////////////////////////////////// General controls (applied to the final sound) //////////////////////////////////// //////////////////////////////////// Tuning controls //////////////////////////////////// Note: When using a MIDI controller, you get retuning in steps of 1 cent. When you drag the control on the GUI it snaps to the "correct" values. //////////////////////////////////// Tuning algorithm //////////////////////////////////// 2^(1/1200), i.e. one hundredth of a semitone //////////////////////////////////// Timbre ////////////////////////////////////
import("stdfaust.lib"); gain = junkGroup(nentry("gain", 1, 0, 1, 0.01)) * en.adsr(envA, envD, envS, envR, gate); freq = junkGroup(hslider("freq", 440, 50, 1000, 0.01)); gate = junkGroup(button("gate") : en.adsr(0.01, 0.01, 0.9, 0.1)); pitchwheel = junkGroup(hslider("bend [midi:pitchwheel]",1,0.9,1.1,0.001)); generalGroup(x) = hgroup("1. General",x); generalLevel1(x) = generalGroup(vgroup("A. Level & Filter", x)); baseLevel = generalLevel1(hslider("Volume", 1.0, 0.0, 10.0, 0.01)); filtRez = generalLevel1(hslider("Resonance", 0.1, 0.1, 2.0, 0.001)); filtFreq = generalLevel1(hslider("Cutoff [midi: ctrl 1]", 2000.0, 10.0, 2000.0, 1)); generalLevel2(x) = generalGroup(vgroup("B. Envelope", x)); envA = generalLevel2(hslider("1. A", 0.0, 0.0, 3.0, 0.01)); envD = generalLevel2(hslider("2. D", 0.2, 0.0, 3.0, 0.01)); envS = generalLevel2(hslider("3. S", 0.8, 0.0, 1.0, 0.01)); envR = generalLevel2(hslider("4. R", 0.4, 0.0, 3.0, 0.01)); tuningGroup(x) = hgroup("2. Tuning",x); tunings = ( 0, tuningGroup(vslider("01. C#[midi:ctrl 14]", 100, 100, 120, 20)), tuningGroup(vslider("02. D[midi:ctrl 3]", 200, 120, 240, 40)), tuningGroup(vslider("03. D#[midi:ctrl 4]", 300, 240, 360, 60)), tuningGroup(vslider("04. E[midi:ctrl 5]", 400, 360, 480, 40)), tuningGroup(vslider("05. F[midi:ctrl 6]", 500, 480, 500, 20)), 600, tuningGroup(vslider("07. G[midi:ctrl 7]", 700, 700, 720, 20)), tuningGroup(vslider("08. G#[midi:ctrl 8]", 800, 720, 840, 40)), tuningGroup(vslider("09. A[midi:ctrl 9]", 900, 840, 960, 60)), tuningGroup(vslider("10. A#[midi:ctrl 10]", 1000, 960, 1080, 40)), tuningGroup(vslider("11. B[midi:ctrl 11]", 1100, 1080, 1200, 20)) ); zeroNote = 8.1758; tunePitch(f) = zeroNote * pow(2, floor(ba.hz2midikey(f) / 12)) * pow(centRatio, (tunings : ba.selectn(12, (ba.hz2midikey(f) % 12)))); gFreq = tunePitch(freq) * pitchwheel; numPartials = 10; partialsGroup(x) = hgroup("3. Timbre", x); partials = par(z,numPartials, partialsGroup(vslider("%z",(numPartials - z)/numPartials, 0, 1, 0.01)) ); timbre(f) = par(z,numPartials, os.osc( tunePitch(freq * (z + 1)) * pitchwheel) * (partials: ba.selectn(numPartials, z)) ):> _ / numPartials; process = gate * timbre(freq) * gain * baseLevel : fi.resonlp(filtFreq,filtRez,0.5) <: _, _; effect = dm.freeverb_demo;
90e0738b06801a3ba30bbc08b8cfcb08ff1deff84500ad1055b5ec47609239cb
FineArtMaths/FaustExperiments
noisyExperiment.dsp
import("stdfaust.lib"); junkGroup(x) = tgroup("Junk",x); // I don't think tab groups are working properly, or I didn't do this right; either way this just hides the junk, which works for me. gain = junkGroup(hslider("gain", 0.5, 0, 1, 0.01)); freq = junkGroup(hslider("freq", 440, 50, 1000, 0.01)); gate = junkGroup(button("gate") : en.adsr(0.01, 0.01, 0.9, 0.1)); feedback = checkbox("comb"); //hslider("feed", 1.0, 0.9, 1.0, 0.0001); sustain = hslider("sustain", 0.01, 0.0, 0.1, 0.0001); noise = hslider("noise vs tone", 0.5, 0.0, 1.0, 0.0001); noiseDensity = hslider("noise density", 10000, 10, 10000, 1); excEnv = en.adsr(0.1, 0.1, 1.0, 0.0, gate); filterCutoff = hslider("lowpass", 2.0, 1.0, 10.0, 0.1); filterQ = hslider("lowpass Q", 100.0, 5.0, 100.0, 0.1); modulationDepth = hslider("Modulation depth", 0.0, 0.0, 0.05, 0.001); modulationSpeed = hslider("Modulation rate", 0.01, 0.0, 20, 0.01); overallEnv = en.adsr(0.1, 0.0, 1.0, 1.0, gate); overallVolume = hslider("volume", 1.0, 0.0, 1.0, 0.0001); // pitchwheel pitchwheel = hslider("bend [midi:pitchwheel]",1,0.9,1.1,0.001); gFreq = freq * pitchwheel; // Global gain is set to 1 for now gGain = 1.0; comb(f, feed) = fi.fb_fcomb(44100, ma.SR/(f), 1.0, -1 * feed); exciterOsc(h) = (no.lfnoise0(noiseDensity) * noise + (os.osc(gFreq * h)) * (1 - noise)); exciter(h) = exciterOsc(h) * gate * gGain * excEnv * sustain; harmonic(h) = exciter(h) <: comb(gFreq * h, -1 * feedback) * 0.5 + comb(gFreq * h * (1 + modulationDepth * (os.lf_triangle(1/modulationSpeed)) - 0.5), -1 * feedback) * 0.5 <: _ + fi.resonlp(gFreq * filterCutoff, filterQ, 1.0) + fi.resonlp(gFreq * filterCutoff * 2, filterQ, 1.0) + fi.resonlp(gFreq * filterCutoff * 3, filterQ, 1.0) ; timbre = harmonic(1) + 0.5 * harmonic(2) + 0.3 * harmonic(3); process = timbre * overallEnv * overallVolume <:_,_; //effect = dm.phaser2_demo;
https://raw.githubusercontent.com/FineArtMaths/FaustExperiments/5b39401ea9cc16c56a06d0174b26763f8f5653e3/noisyExperiment.dsp
faust
I don't think tab groups are working properly, or I didn't do this right; either way this just hides the junk, which works for me. hslider("feed", 1.0, 0.9, 1.0, 0.0001); pitchwheel Global gain is set to 1 for now effect = dm.phaser2_demo;
import("stdfaust.lib"); gain = junkGroup(hslider("gain", 0.5, 0, 1, 0.01)); freq = junkGroup(hslider("freq", 440, 50, 1000, 0.01)); gate = junkGroup(button("gate") : en.adsr(0.01, 0.01, 0.9, 0.1)); sustain = hslider("sustain", 0.01, 0.0, 0.1, 0.0001); noise = hslider("noise vs tone", 0.5, 0.0, 1.0, 0.0001); noiseDensity = hslider("noise density", 10000, 10, 10000, 1); excEnv = en.adsr(0.1, 0.1, 1.0, 0.0, gate); filterCutoff = hslider("lowpass", 2.0, 1.0, 10.0, 0.1); filterQ = hslider("lowpass Q", 100.0, 5.0, 100.0, 0.1); modulationDepth = hslider("Modulation depth", 0.0, 0.0, 0.05, 0.001); modulationSpeed = hslider("Modulation rate", 0.01, 0.0, 20, 0.01); overallEnv = en.adsr(0.1, 0.0, 1.0, 1.0, gate); overallVolume = hslider("volume", 1.0, 0.0, 1.0, 0.0001); pitchwheel = hslider("bend [midi:pitchwheel]",1,0.9,1.1,0.001); gFreq = freq * pitchwheel; gGain = 1.0; comb(f, feed) = fi.fb_fcomb(44100, ma.SR/(f), 1.0, -1 * feed); exciterOsc(h) = (no.lfnoise0(noiseDensity) * noise + (os.osc(gFreq * h)) * (1 - noise)); exciter(h) = exciterOsc(h) * gate * gGain * excEnv * sustain; harmonic(h) = exciter(h) <: comb(gFreq * h, -1 * feedback) * 0.5 + comb(gFreq * h * (1 + modulationDepth * (os.lf_triangle(1/modulationSpeed)) - 0.5), -1 * feedback) * 0.5 <: _ + fi.resonlp(gFreq * filterCutoff, filterQ, 1.0) + fi.resonlp(gFreq * filterCutoff * 2, filterQ, 1.0) + fi.resonlp(gFreq * filterCutoff * 3, filterQ, 1.0) ; timbre = harmonic(1) + 0.5 * harmonic(2) + 0.3 * harmonic(3); process = timbre * overallEnv * overallVolume <:_,_;
2f814e87c290893b612eae13c11f2f707963e4c95b54100b7fae66a1c26e362b
bjornmossa/echolot
echolot.dsp
declare name "Echolot"; declare author "Bjornmossa"; declare version "1.0"; declare license "GNU GPL 3"; import("filters.lib"); import("delays.lib"); import("math.lib"); feedback = vslider("[4]feedback[style:knob]", 0.01, 0.01, 0.999, 0.01); filter = resonlp(fc,Q,1) with { fc = hslider("[0]freq[style:knob]", 1000, 60, 8000, 0.01); Q = hslider("[1]Q[style:knob]", 0.25, 0.01, 1, 0.01); }; delayed = delay(SR, d) with { d = vslider("[3]delay[style:knob]", 0.01, 0, 0.2, 0.001) * SR; }; process = +~(hgroup("Echolot", (delayed : filter) * feedback));
https://raw.githubusercontent.com/bjornmossa/echolot/2e2c18c39f8c3b5def3f1c1e4d3181f29938424e/echolot.dsp
faust
declare name "Echolot"; declare author "Bjornmossa"; declare version "1.0"; declare license "GNU GPL 3"; import("filters.lib"); import("delays.lib"); import("math.lib"); feedback = vslider("[4]feedback[style:knob]", 0.01, 0.01, 0.999, 0.01); filter = resonlp(fc,Q,1) with { fc = hslider("[0]freq[style:knob]", 1000, 60, 8000, 0.01); Q = hslider("[1]Q[style:knob]", 0.25, 0.01, 1, 0.01); }; delayed = delay(SR, d) with { d = vslider("[3]delay[style:knob]", 0.01, 0, 0.2, 0.001) * SR; }; process = +~(hgroup("Echolot", (delayed : filter) * feedback));
04a6e61d5188289e33981bce941300b9a71a36f9d82014d78896a901a6429fad
johannphilippe/grame_cnsmd_2023
base.dsp
// Chaque expression finit avec ; process = 0; // Chaque programme a une fonction process : c'est notre fonction audio. // Commentaires : // pour une ligne, /* pour plusieurs lignes */ // Syntaxe traditionnelle process = 1 + 0.5; // Composition séquentielle : l'opérateur + prend deux entrées et a une sortie process = 1, 0.5 : +; //3 Signaux parallèles process = 1, 2, 3; // Idem process = par(n, 3, n+1);
https://raw.githubusercontent.com/johannphilippe/grame_cnsmd_2023/cf7a34a36c456eef87963c584384296c8c441a27/syntax/base.dsp
faust
Chaque expression finit avec ; Chaque programme a une fonction process : c'est notre fonction audio. Commentaires : // pour une ligne, pour plusieurs lignes Syntaxe traditionnelle Composition séquentielle : l'opérateur + prend deux entrées et a une sortie 3 Signaux parallèles Idem
process = 0; process = 1 + 0.5; process = 1, 0.5 : +; process = 1, 2, 3; process = par(n, 3, n+1);
e0c256b9f704f46f6c732a0f525dccb8cd176af63c6015e55b079d2cd7016194
johannphilippe/grame_cnsmd_2023
input_output.dsp
// Inputs and outputs -> peuvent être représentées par le underscore. // Ici, le underscore est dans la boucle parallèle, il y a donc 8 entrées // On merge en deux sorties process = par(n, 8, _) :> _,_;
https://raw.githubusercontent.com/johannphilippe/grame_cnsmd_2023/88f460fdbaa76a35825d87614d0b664ad6a30f9c/input_output/input_output.dsp
faust
Inputs and outputs -> peuvent être représentées par le underscore. Ici, le underscore est dans la boucle parallèle, il y a donc 8 entrées On merge en deux sorties
process = par(n, 8, _) :> _,_;
5df68d97ada88a4355fb2d74cbf51b63a287ad4997b7b45ada752e42f3f25e41
johannphilippe/grame_cnsmd_2023
grain.dsp
/////////////////////////////////////////////////////////////////////////////////////////////////// // // Grain Generator. // Another granular synthesis example. // This one is not finished, but ready for more features and improvements... // /////////////////////////////////////////////////////////////////////////////////////////////////// // // ANALOG IN: // ANALOG 0 : Population: 0=almost nothing. 1=Full grain // ANALOG 1 : Depth of each grin, in ms. // ANALOG 2 : Position in the table = delay // ANALOG 3 : Speed = pitch change of the grains // ANALOG 4 : Feedback // /////////////////////////////////////////////////////////////////////////////////////////////////// import("all.lib"); // FOR 4 grains - MONO // UI ////////////////////////////////////////// popul = 1 - hslider("population[BELA: ANALOG_0]", 1, 0, 1, 0.001); // Coef 1= maximum; 0 = almost nothing (0.95) taille = hslider("taille[BELA: ANALOG_1]", 100, 4, 200, 0.001 ); // Size in millisecondes decal = 1 - hslider("decal[BELA: ANALOG_2]",0,0,1,0.001); // read position compared to table srite position speed = hslider("speed[BELA: ANALOG_3]", 1, 0.125, 4, 0.001); feedback = hslider("feedback[BELA: ANALOG_4]",0,0,2,0.001); freq = 1000/taille; tmpTaille = taille*ma.SR/ 1000; clocSize = int(tmpTaille + (tmpTaille*popul*10)); // duration between 2 clicks // CLK GENERAL ///////////////////////////////// // 4 clicks vers 4 generateurs de grains. // (idem clk freq/4 et un compteur...) detect1(x) = select2 (x < 10, 0, 1); detect2(x) = select2 (x > clocSize*1/3, 0, 1) : select2 (x < (clocSize*1/3)+10, 0, _); detect3(x) = select2 (x > clocSize*2/3, 0, 1) : select2 (x < (clocSize*2/3)+10, 0, _); detect4(x) = select2 (x > clocSize-10, 0, 1); cloc = (%(_,clocSize))~(+(1)) <: (detect1: trig),(detect2: trig),(detect3: trig),(detect4: trig); // SIGNAUX Ctrls Player //////////////////////// trig = _<:_,mem: >; envelop = *(2*PI):+(PI):cos:*(0.5):+(0.5); rampe(f, t) = delta : (+ : select2(t,_,delta<0) : max(0)) ~ _ : raz with { raz(x) = select2 (x > 1, x, 0); delta = sh(f,t)/ma.SR; sh(x,t) = ba.sAndH(t,x); }; rampe2(speed, t) = delta : (+ : select2(t,_,delta<0) : max(0)) ~ _ with { delta = sh(speed,t); sh(x,t) = ba.sAndH(t,x); }; // RWTable ////////////////////////////////////// unGrain(input, clk) = (linrwtable( wf , rindex) : *(0.2 * EnvGrain)) with { SR = 44100; buffer_sec = 1; size = int(SR * buffer_sec); init = 0.; EnvGrain = clk : (rampe(freq) : envelop); windex = (%(_,size) ) ~ ( +(1) ); posTabl = int(ba.sAndH(clk, windex)); rindex = %(int(rampe2(speed, clk)) + posTabl + int(size * decal), size); wf = size, init, int(windex), input; }; // LINEAR_INTERPOLATION_RWTABLE ////////////////////////////////// // read rwtable with linear interpolation // wf : waveform to read ( wf is defined by (size_buffer,init, windex, input )) // x : position to read (0 <= x < size(wf)) and float // nota: rwtable(size, init, windex, input, rindex) linrwtable(wf,x) = linterpolation(y0,y1,d) with { x0 = int(x); // x1 = int(x+1); // d = x-x0; y0 = rwtable(wf,x0); // y1 = rwtable(wf,x1); // linterpolation(v0,v1,c) = v0*(1-c)+v1*c; }; // FINALISATION ///////////////////////////////////////////////////////////////////////////////////// routeur (a, b, c, d, e) = a, b, a, c, a, d, a, e; processus = _ , cloc : routeur : (unGrain, unGrain, unGrain, unGrain) :> fi.dcblockerat(20); s1 = os.sawtooth(abs(no.noise)*500+30); s2 = os.osc(os.phasor(1, 0.1)); process = _,_: ((+(_,_) :processus) ~(*(feedback))),((+(_,_) :processus) ~(*(feedback)));
https://raw.githubusercontent.com/johannphilippe/grame_cnsmd_2023/ccfd6e9a5c1537097546520317c8c5beea06006f/granulator/grain.dsp
faust
///////////////////////////////////////////////////////////////////////////////////////////////// Grain Generator. Another granular synthesis example. This one is not finished, but ready for more features and improvements... ///////////////////////////////////////////////////////////////////////////////////////////////// ANALOG IN: ANALOG 0 : Population: 0=almost nothing. 1=Full grain ANALOG 1 : Depth of each grin, in ms. ANALOG 2 : Position in the table = delay ANALOG 3 : Speed = pitch change of the grains ANALOG 4 : Feedback ///////////////////////////////////////////////////////////////////////////////////////////////// FOR 4 grains - MONO UI ////////////////////////////////////////// Coef 1= maximum; 0 = almost nothing (0.95) Size in millisecondes read position compared to table srite position duration between 2 clicks CLK GENERAL ///////////////////////////////// 4 clicks vers 4 generateurs de grains. (idem clk freq/4 et un compteur...) SIGNAUX Ctrls Player //////////////////////// RWTable ////////////////////////////////////// LINEAR_INTERPOLATION_RWTABLE ////////////////////////////////// read rwtable with linear interpolation wf : waveform to read ( wf is defined by (size_buffer,init, windex, input )) x : position to read (0 <= x < size(wf)) and float nota: rwtable(size, init, windex, input, rindex) FINALISATION /////////////////////////////////////////////////////////////////////////////////////
import("all.lib"); speed = hslider("speed[BELA: ANALOG_3]", 1, 0.125, 4, 0.001); feedback = hslider("feedback[BELA: ANALOG_4]",0,0,2,0.001); freq = 1000/taille; tmpTaille = taille*ma.SR/ 1000; detect1(x) = select2 (x < 10, 0, 1); detect2(x) = select2 (x > clocSize*1/3, 0, 1) : select2 (x < (clocSize*1/3)+10, 0, _); detect3(x) = select2 (x > clocSize*2/3, 0, 1) : select2 (x < (clocSize*2/3)+10, 0, _); detect4(x) = select2 (x > clocSize-10, 0, 1); cloc = (%(_,clocSize))~(+(1)) <: (detect1: trig),(detect2: trig),(detect3: trig),(detect4: trig); trig = _<:_,mem: >; envelop = *(2*PI):+(PI):cos:*(0.5):+(0.5); rampe(f, t) = delta : (+ : select2(t,_,delta<0) : max(0)) ~ _ : raz with { raz(x) = select2 (x > 1, x, 0); delta = sh(f,t)/ma.SR; sh(x,t) = ba.sAndH(t,x); }; rampe2(speed, t) = delta : (+ : select2(t,_,delta<0) : max(0)) ~ _ with { delta = sh(speed,t); sh(x,t) = ba.sAndH(t,x); }; unGrain(input, clk) = (linrwtable( wf , rindex) : *(0.2 * EnvGrain)) with { SR = 44100; buffer_sec = 1; size = int(SR * buffer_sec); init = 0.; EnvGrain = clk : (rampe(freq) : envelop); windex = (%(_,size) ) ~ ( +(1) ); posTabl = int(ba.sAndH(clk, windex)); rindex = %(int(rampe2(speed, clk)) + posTabl + int(size * decal), size); wf = size, init, int(windex), input; }; linrwtable(wf,x) = linterpolation(y0,y1,d) with { d = x-x0; linterpolation(v0,v1,c) = v0*(1-c)+v1*c; }; routeur (a, b, c, d, e) = a, b, a, c, a, d, a, e; processus = _ , cloc : routeur : (unGrain, unGrain, unGrain, unGrain) :> fi.dcblockerat(20); s1 = os.sawtooth(abs(no.noise)*500+30); s2 = os.osc(os.phasor(1, 0.1)); process = _,_: ((+(_,_) :processus) ~(*(feedback))),((+(_,_) :processus) ~(*(feedback)));
4a05873b0fa21f3390b4e93233967d195195b5203b2cac08f9e11c3d5db3c24b
johannphilippe/grame_cnsmd_2023
time.dsp
simple_metro(fq) = (_, ma.SR/fq : fmod) ~+(1.0) : <=(1.0); // Better implementation metro_impl(fq, phase) = incr<=1.0 with { offset = (1.0-phase) * smps; incr = _~+(1.0) : +(offset) : _,smps : fmod; smps = ma.SR/fq; }; metro(fq) = metro_impl(fq, 0); metro_swing(fq, swing) = metro_impl(fq,0) | metro_impl(fq, swing); drunk_metro(fq, noise_amount) = metro(freq) with { trig = metro(fq)|(fq!=fq')|os.impulse; freq = fq + (no.noise*noise_amount) : ba.sAndH(trig); }; accent(modulo, beat) = _~+( is ) : %(modulo) : ==(0) : &(is) with { is = beat > beat'; }; // Same with accent drunk_metro_acc(fq, noise_amt) = bt, acc with { trig = metro(fq)|(fq!=fq')|os.impulse; frq = fq + (no.noise * noise_amt) : ba.sAndH(trig); bt = metro(frq); acc_mod = int(abs(no.noise*noise_amt))+1; acc = accent(acc_mod, bt); }; /* PHASOR */ phasor_impl(fq, phase) = incr/smps with { incr = _~+(1.0) : +(offset) : _, smps : fmod; offset = (1.0 - phase) * smps; smps = ma.SR/fq; }; phasor(fq) = phasor_impl(fq, 0); phasor_ph(fq, phase) = phasor_impl(fq, phase); /* EUCLIDIAN RHYTHM */ euclidian(onset, div, pulses, rotation, phasor) = (euclid' != euclid) & (phase' != phase) with { phase = ((phasor + rotation) * div), 1.0 : fmod : *(pulses) : int; euclid = int((onset/pulses) * phase); }; /* LOOPER - Can be used as a beat looper - or as an audio looper */ looper(SIZE, record, read_speed) = looper : *(read_cond) with { looper = rwtable(SIZE, 0.0, recindex, _, readindex); recindex = (+(1) : %(SIZE)) ~ *(record); read_cond = read_speed>0; readindex = read_speed/float(ma.SR) : (+ : ma.frac) ~ _ : *(float(SIZE)) : int : *(read_cond); }; /* SEQUENCERS */ sequencer(t, freq) = (res > 0) * (ph != ph'), res with { sz = t : _,!; ph = int(os.phasor(sz, freq)); res = t, ph : rdtable; }; ctl_sequencer = steps : sum(n, SIZE, res(_,n)) with { steps = hgroup("steps", par(n, SIZE, checkbox("%n"))); beat = ba.beat(speed*60); incr = _~+(beat), SIZE : %; res(sig, n) = sig : *(incr==n) : *(beat); }; swing_sequencer(t,tswing, size, freq) = ((res > 0) * (ph != ph')) | swing, res with { ph = int(os.phasor(size, freq / size)); sw = tswing, ph : rdtable; phstep = os.hs_phasor(1, freq, sw != sw'); swing = 0, 1 : select2(cond) : ba.impulsify with { cond = (phstep >= sw) & (phstep' <= sw); }; res = t, ph : rdtable; };
https://raw.githubusercontent.com/johannphilippe/grame_cnsmd_2023/ccfd6e9a5c1537097546520317c8c5beea06006f/time.dsp
faust
Better implementation Same with accent PHASOR EUCLIDIAN RHYTHM LOOPER - Can be used as a beat looper - or as an audio looper SEQUENCERS
simple_metro(fq) = (_, ma.SR/fq : fmod) ~+(1.0) : <=(1.0); metro_impl(fq, phase) = incr<=1.0 with { offset = (1.0-phase) * smps; incr = _~+(1.0) : +(offset) : _,smps : fmod; smps = ma.SR/fq; }; metro(fq) = metro_impl(fq, 0); metro_swing(fq, swing) = metro_impl(fq,0) | metro_impl(fq, swing); drunk_metro(fq, noise_amount) = metro(freq) with { trig = metro(fq)|(fq!=fq')|os.impulse; freq = fq + (no.noise*noise_amount) : ba.sAndH(trig); }; accent(modulo, beat) = _~+( is ) : %(modulo) : ==(0) : &(is) with { is = beat > beat'; }; drunk_metro_acc(fq, noise_amt) = bt, acc with { trig = metro(fq)|(fq!=fq')|os.impulse; frq = fq + (no.noise * noise_amt) : ba.sAndH(trig); bt = metro(frq); acc_mod = int(abs(no.noise*noise_amt))+1; acc = accent(acc_mod, bt); }; phasor_impl(fq, phase) = incr/smps with { incr = _~+(1.0) : +(offset) : _, smps : fmod; offset = (1.0 - phase) * smps; smps = ma.SR/fq; }; phasor(fq) = phasor_impl(fq, 0); phasor_ph(fq, phase) = phasor_impl(fq, phase); euclidian(onset, div, pulses, rotation, phasor) = (euclid' != euclid) & (phase' != phase) with { phase = ((phasor + rotation) * div), 1.0 : fmod : *(pulses) : int; euclid = int((onset/pulses) * phase); }; looper(SIZE, record, read_speed) = looper : *(read_cond) with { looper = rwtable(SIZE, 0.0, recindex, _, readindex); recindex = (+(1) : %(SIZE)) ~ *(record); read_cond = read_speed>0; readindex = read_speed/float(ma.SR) : (+ : ma.frac) ~ _ : *(float(SIZE)) : int : *(read_cond); }; sequencer(t, freq) = (res > 0) * (ph != ph'), res with { sz = t : _,!; ph = int(os.phasor(sz, freq)); res = t, ph : rdtable; }; ctl_sequencer = steps : sum(n, SIZE, res(_,n)) with { steps = hgroup("steps", par(n, SIZE, checkbox("%n"))); beat = ba.beat(speed*60); incr = _~+(beat), SIZE : %; res(sig, n) = sig : *(incr==n) : *(beat); }; swing_sequencer(t,tswing, size, freq) = ((res > 0) * (ph != ph')) | swing, res with { ph = int(os.phasor(size, freq / size)); sw = tswing, ph : rdtable; phstep = os.hs_phasor(1, freq, sw != sw'); swing = 0, 1 : select2(cond) : ba.impulsify with { cond = (phstep >= sw) & (phstep' <= sw); }; res = t, ph : rdtable; };
148bb827ad4dc9e9ddd210b4398208256a23a014c16692a6b432b028b85f5f36
theyoogle/Faust-DSP
01 Composition Operations.dsp
// Composition Operations // Sequencial (priority 2) process = A : B; // |-----| |-----| // | 1----->1 | // | A | | B | // | 2----->2 | // |-----| |-----| //============================================= // Parallel (priority 3) process = A, B; // _____ // | | // ->1 1-> // | A | // ->2 2-> // |_____| // _____ // | | // ->3 B 3-> // |_____| //============================================= // Split (priority 1) // Number of inputs of B = n * Number of outputs of A process = A <: B; // |-----| |-----| // | | +--->1 | // | A 1----| | B | // | | +--->2 | // |-----| |-----| // |-----| |-----| // | | +----->1 | // | 1--| | | // | | | +--->2 | // | A | | | | B | // | | +-|--->3 | // | 2----| | | // | | +--->4 | // |-----| |-----| //============================================= // Merge (priority 1) // Number of outputs of A = n * Number of inputs of B process = A :> B; // |-----| |-----| // | 1----+ | | // | A | |--->1 B | // | 2----+ | | // |-----| |-----| // |-----| |-----| // | 1---+ | | // | | |---->1 | // | 2---|-+ | | // | A | | | | B | // | 3---+ | | | // | | |-->2 | // | 4-----+ | | // |-----| |-----| //============================================= // Recursive (priority 4) // Number of inputs of B <= Number of outputs of A // Number of outputs of B <= Number of inputs of A process = A ~ B; // |-.-----| // ->1 1-> // | | |-.-----| // ->2 2-> ->1 1-> // | A | | B | // ->3 3-> ->2 2-> // | | |-------| // ->4 4-> // |-------| // STEP I - Rotate B and Put it on top of A // |-------| // <-2 2<- // | B | // <-1 1<- // |-----.-| // // // |-.-----| // ->1 1-> // | | // ->2 2-> // | A | // ->3 3-> // | | // ->4 4-> // |-------| // STEP II - Connect output of A with 1-sample delay to inputs of B // - Connect output of B to inputs of A // |-------| // +------2 2<-----+ // | | B | | // | +--1 1<-+ | // | | |-----.-| | | // | | | | // | | | | // | | |-.-----| | | // | +->1 1-|^|--|---> // | | | | // +----->2 2-----|^|--> // | A | // --------->3 3----------> // | | // --------->4 4----------> // |-------| //============================================= // Some valid recursive connections //============================================= // |-------| // +------2 2<-----+ // | | B | | // | +--1 1<-+ | // | | |-----.-| | | // | | | | // | | | | // | | |-.-----| | | // | +->1 1-|^|--|---> // | | A | | // +----->2 2-----|^|--> // |-------| //============================================= // Some valid recursive connections //============================================= // |-------| // +---1 B 1<--+ // | |-----.-| | // | | // | | // | |-.-----| | // +-->1 1--|^|-----> // | A | // --------->2 2----------> // |-------| //============================================= (No) _ ~ + (Yes) + ~ _ (No) 1 ~ _ (Yes) + ~ (_,2:*) (Yes) (1,_:+) ~ (_,2:*) (Yes) + ~ (_,2 <: *,+)
https://raw.githubusercontent.com/theyoogle/Faust-DSP/446a6824cf06e47de7209829002d3019d169f3d4/session%2002/05%20Composition/01%20Composition%20Operations.dsp
faust
Composition Operations Sequencial (priority 2) |-----| |-----| | 1----->1 | | A | | B | | 2----->2 | |-----| |-----| ============================================= Parallel (priority 3) _____ | | ->1 1-> | A | ->2 2-> |_____| _____ | | ->3 B 3-> |_____| ============================================= Split (priority 1) Number of inputs of B = n * Number of outputs of A |-----| |-----| | | +--->1 | | A 1----| | B | | | +--->2 | |-----| |-----| |-----| |-----| | | +----->1 | | 1--| | | | | | +--->2 | | A | | | | B | | | +-|--->3 | | 2----| | | | | +--->4 | |-----| |-----| ============================================= Merge (priority 1) Number of outputs of A = n * Number of inputs of B |-----| |-----| | 1----+ | | | A | |--->1 B | | 2----+ | | |-----| |-----| |-----| |-----| | 1---+ | | | | |---->1 | | 2---|-+ | | | A | | | | B | | 3---+ | | | | | |-->2 | | 4-----+ | | |-----| |-----| ============================================= Recursive (priority 4) Number of inputs of B <= Number of outputs of A Number of outputs of B <= Number of inputs of A |-.-----| ->1 1-> | | |-.-----| ->2 2-> ->1 1-> | A | | B | ->3 3-> ->2 2-> | | |-------| ->4 4-> |-------| STEP I - Rotate B and Put it on top of A |-------| <-2 2<- | B | <-1 1<- |-----.-| |-.-----| ->1 1-> | | ->2 2-> | A | ->3 3-> | | ->4 4-> |-------| STEP II - Connect output of A with 1-sample delay to inputs of B - Connect output of B to inputs of A |-------| +------2 2<-----+ | | B | | | +--1 1<-+ | | | |-----.-| | | | | | | | | | | | | |-.-----| | | | +->1 1-|^|--|---> | | | | +----->2 2-----|^|--> | A | --------->3 3----------> | | --------->4 4----------> |-------| ============================================= Some valid recursive connections ============================================= |-------| +------2 2<-----+ | | B | | | +--1 1<-+ | | | |-----.-| | | | | | | | | | | | | |-.-----| | | | +->1 1-|^|--|---> | | A | | +----->2 2-----|^|--> |-------| ============================================= Some valid recursive connections ============================================= |-------| +---1 B 1<--+ | |-----.-| | | | | | | |-.-----| | +-->1 1--|^|-----> | A | --------->2 2----------> |-------| =============================================
process = A : B; process = A, B; process = A <: B; process = A :> B; process = A ~ B; (No) _ ~ + (Yes) + ~ _ (No) 1 ~ _ (Yes) + ~ (_,2:*) (Yes) (1,_:+) ~ (_,2:*) (Yes) + ~ (_,2 <: *,+)
5425a2ffe2351c4ade8d67717213a0d7bf187303074b5092f21e9a12aac45abd
theyoogle/Faust-DSP
02 White Noise Generator.dsp
random = +(12345) ~ *(1103515245); noise = random / 2147483647.0; process = noise * vslider("volume", 0, 0, 1, 0.01) <: _,_;
https://raw.githubusercontent.com/theyoogle/Faust-DSP/446a6824cf06e47de7209829002d3019d169f3d4/session%2002/05%20Composition/02%20White%20Noise%20Generator.dsp
faust
random = +(12345) ~ *(1103515245); noise = random / 2147483647.0; process = noise * vslider("volume", 0, 0, 1, 0.01) <: _,_;
8b1d197c17e86e3818102168981b566052785e5f9a2986310dd121cc3f842138
theyoogle/Faust-DSP
06 Read Write Table.dsp
// Read write table x0,x1,x2,x3,x4 : rwtable : y; // x0(t) -> |---------| // | | // x1(t) -> | | // | | // x2(t) -> | rwtable | -> y(t) // | | // x3(t) -> | | // | | // x4(t) -> |---------| x0(t) - size of table (constant signal) x1(t) - initial content of table x2(t) - write index of table x3(t) - signal to write x4(t) - read index of table
https://raw.githubusercontent.com/theyoogle/Faust-DSP/54e3514141a66aff7c6e9304f5a37a6617e42962/session%2002/03%20Delays%20and%20Tables/06%20Read%20Write%20Table.dsp
faust
Read write table x0(t) -> |---------| | | x1(t) -> | | | | x2(t) -> | rwtable | -> y(t) | | x3(t) -> | | | | x4(t) -> |---------|
x0,x1,x2,x3,x4 : rwtable : y; x0(t) - size of table (constant signal) x1(t) - initial content of table x2(t) - write index of table x3(t) - signal to write x4(t) - read index of table
8154f8a807b00c6c410e9d3874cce227168811140e43d9e4ee821d1271afe0a5
theyoogle/Faust-DSP
01 UI Widgets.dsp
// UI Widgets // 0 or 1 // (name) button("gate") checkbox("gate") // (name, init, min, max, step) nentry("level", 0, 0, 1, 0.01) hslider("level", 0, 0, 1, 0.01) vslider("level", 0, 0, 1, 0.01) vslider("level[style:knob]", 0, 0, 1, 0.01) // display instantanious value of incoming signal // clip between min and max values // (name, min, max) hbargraph("level", 0, 1) vbargraph("level", 0, 1) // attach to signal other than incoming signal attach(x, y) // layout hgroup("name", ...) vgroup("name", ...) tgroup("name", ...)
https://raw.githubusercontent.com/theyoogle/Faust-DSP/54e3514141a66aff7c6e9304f5a37a6617e42962/session%2002/04%20UI%20Primitives/01%20UI%20Widgets.dsp
faust
UI Widgets 0 or 1 (name) (name, init, min, max, step) display instantanious value of incoming signal clip between min and max values (name, min, max) attach to signal other than incoming signal layout
button("gate") checkbox("gate") nentry("level", 0, 0, 1, 0.01) hslider("level", 0, 0, 1, 0.01) vslider("level", 0, 0, 1, 0.01) vslider("level[style:knob]", 0, 0, 1, 0.01) hbargraph("level", 0, 1) vbargraph("level", 0, 1) attach(x, y) hgroup("name", ...) vgroup("name", ...) tgroup("name", ...)
d628b0ac992d0feec58d1815214f53fde5a6581d2aa17d16c2a255381a6915a8
theyoogle/Faust-DSP
04 Comparison Operators.dsp
// Comparison Operators // Greater than process = >; // x0(t) -> |-----| // | > | -> y(t) // x1(t) -> |-----| // Semantics // y(t) = 1 if x0(t) > x1(t) else 0 //============================================= // Greater or equal process = >=; // x0(t) -> |-----| // | >= | -> y(t) // x1(t) -> |-----| // Semantics // y(t) = 1 if x0(t) >= x1(t) else 0 //============================================= // Less than process = <; // x0(t) -> |-----| // | < | -> y(t) // x1(t) -> |-----| // Semantics // y(t) = 1 if x0(t) < x1(t) else 0 //============================================= // Less or equal process = <=; // x0(t) -> |-----| // | <= | -> y(t) // x1(t) -> |-----| // Semantics // y(t) = 1 if x0(t) <= x1(t) else 0 //============================================= // Equal process = '=='; // x0(t) -> |-----| // | == | -> y(t) // x1(t) -> |-----| // Semantics // y(t) = 1 if x0(t) == x1(t) else 0 //============================================= // Different process = '!='; // x0(t) -> |-----| // | != | -> y(t) // x1(t) -> |-----| // Semantics // y(t) = 1 if x0(t) != x1(t) else 0
https://raw.githubusercontent.com/theyoogle/Faust-DSP/373f0b309ad84906043b0b53e02129cd9ce45d59/session%2002/02%20Additional%20Primitives/04%20Comparison%20Operators.dsp
faust
Comparison Operators Greater than x0(t) -> |-----| | > | -> y(t) x1(t) -> |-----| Semantics y(t) = 1 if x0(t) > x1(t) else 0 ============================================= Greater or equal x0(t) -> |-----| | >= | -> y(t) x1(t) -> |-----| Semantics y(t) = 1 if x0(t) >= x1(t) else 0 ============================================= Less than x0(t) -> |-----| | < | -> y(t) x1(t) -> |-----| Semantics y(t) = 1 if x0(t) < x1(t) else 0 ============================================= Less or equal x0(t) -> |-----| | <= | -> y(t) x1(t) -> |-----| Semantics y(t) = 1 if x0(t) <= x1(t) else 0 ============================================= Equal x0(t) -> |-----| | == | -> y(t) x1(t) -> |-----| Semantics y(t) = 1 if x0(t) == x1(t) else 0 ============================================= Different x0(t) -> |-----| | != | -> y(t) x1(t) -> |-----| Semantics y(t) = 1 if x0(t) != x1(t) else 0
process = >; process = >=; process = <; process = <=; process = '=='; process = '!=';
671429f573d8db588f41839db5a2ab46d468b8f9883502c19c03e3aa194a5f50
theyoogle/Faust-DSP
01 Arithmatic Operators.dsp
// Arithmetic Operators // Addition process = +; // x0(t) -> |-----| // | + | -> y(t) // x1(t) -> |-----| // Semantics // y(t) = x0(t) + x1(t) //============================================= // Subtraction process = -; // x0(t) -> |-----| // | - | -> y(t) // x1(t) -> |-----| // Semantics // y(t) = x0(t) - x1(t) //============================================= // Multiplication process = *; // x0(t) -> |-----| // | * | -> y(t) // x1(t) -> |-----| // Semantics // y(t) = x0(t) * x1(t) //============================================= // Division process = /; // x0(t) -> |-----| // | / | -> y(t) // x1(t) -> |-----| // Semantics // y(t) = x0(t) / x1(t) //============================================= // Modulo process = %; // x0(t) -> |-----| // | % | -> y(t) // x1(t) -> |-----| // Semantics // y(t) = x0(t) % x1(t) //============================================= // Power process = ^; // x0(t) -> |-----| // | ^ | -> y(t) // x1(t) -> |-----| // Semantics // y(t) = x0(t) ^ x1(t)
https://raw.githubusercontent.com/theyoogle/Faust-DSP/373f0b309ad84906043b0b53e02129cd9ce45d59/session%2002/02%20Additional%20Primitives/01%20Arithmatic%20Operators.dsp
faust
Arithmetic Operators Addition x0(t) -> |-----| | + | -> y(t) x1(t) -> |-----| Semantics y(t) = x0(t) + x1(t) ============================================= Subtraction x0(t) -> |-----| | - | -> y(t) x1(t) -> |-----| Semantics y(t) = x0(t) - x1(t) ============================================= Multiplication x0(t) -> |-----| | * | -> y(t) x1(t) -> |-----| Semantics y(t) = x0(t) * x1(t) ============================================= Division x0(t) -> |-----| | / | -> y(t) x1(t) -> |-----| Semantics y(t) = x0(t) / x1(t) ============================================= Modulo x0(t) -> |-----| | % | -> y(t) x1(t) -> |-----| Semantics y(t) = x0(t) % x1(t) ============================================= Power x0(t) -> |-----| | ^ | -> y(t) x1(t) -> |-----| Semantics y(t) = x0(t) ^ x1(t)
process = +; process = -; process = *; process = /; process = %; process = ^;
18bfe87b4c518137b5dbd29649d2f03d77552f187dfb098ca759b3dd7560b21f
theyoogle/Faust-DSP
09 Log and Exponential Functions.dsp
// Log and Exponential Functions Base-e Exponential exp y(t) = exp(x(t)) Base-e Logarithm log y(t) = log(x(t)) Base-10 Logarithm log10 y(t) = log10(x(t)) Power pow y(t) = pow(x0(t), x1(t)) Square Root sqrt y(t) = sqrt(x(t))
https://raw.githubusercontent.com/theyoogle/Faust-DSP/373f0b309ad84906043b0b53e02129cd9ce45d59/session%2002/02%20Additional%20Primitives/09%20Log%20and%20Exponential%20Functions.dsp
faust
Log and Exponential Functions
Base-e Exponential exp y(t) = exp(x(t)) Base-e Logarithm log y(t) = log(x(t)) Base-10 Logarithm log10 y(t) = log10(x(t)) Power pow y(t) = pow(x0(t), x1(t)) Square Root sqrt y(t) = sqrt(x(t))
5e5fa263de66026b57f292c00b0197075f318423c31b619269dea1bd48e6bef0
theyoogle/Faust-DSP
05 Parallel Composition.dsp
// Parallel Composition Premitive process = _,_; // _____ // | | // x0(t) -> |-----| -> y0(t) // |_____| // _____ // | | // x1(t) -> |-----| -> y1(t) // |_____| // Semantics // y0(t) = x0(t) // y1(t) = x1(t) //============================================= // Quadraphonic Cable process = _,_,_,_; // _____ // | | // x0(t) -> |-----| -> y0(t) // |_____| // _____ // | | // x1(t) -> |-----| -> y1(t) // |_____| // _____ // | | // x2(t) -> |-----| -> y2(t) // |_____| // _____ // | | // x3(t) -> |-----| -> y3(t) // |_____| // Semantics // y0(t) = x0(t) // y1(t) = x1(t) // y2(t) = x2(t) // y3(t) = x3(t)
https://raw.githubusercontent.com/theyoogle/Faust-DSP/373f0b309ad84906043b0b53e02129cd9ce45d59/session%2002/01%20Basic%20Primitives/05%20Parallel%20Composition.dsp
faust
Parallel Composition Premitive _____ | | x0(t) -> |-----| -> y0(t) |_____| _____ | | x1(t) -> |-----| -> y1(t) |_____| Semantics y0(t) = x0(t) y1(t) = x1(t) ============================================= Quadraphonic Cable _____ | | x0(t) -> |-----| -> y0(t) |_____| _____ | | x1(t) -> |-----| -> y1(t) |_____| _____ | | x2(t) -> |-----| -> y2(t) |_____| _____ | | x3(t) -> |-----| -> y3(t) |_____| Semantics y0(t) = x0(t) y1(t) = x1(t) y2(t) = x2(t) y3(t) = x3(t)
process = _,_; process = _,_,_,_;
c6dae6b0774d5fd04522f33b9fd34fe9c558622cb261068210ccde11b203924a
theyoogle/Faust-DSP
02 Signal.dsp
// signal - a value that changes over time // _ _ _ // _| |_| |_| |_ // // signal - (in faust) a function transforming a time input into a value output (SAMPLE) // |---------------| // | _ _ _ | // time -> | _| |_| |_| |_ | -> value (SAMPLE) // | | // |---------------|
https://raw.githubusercontent.com/theyoogle/Faust-DSP/373f0b309ad84906043b0b53e02129cd9ce45d59/session%2002/01%20Basic%20Primitives/02%20Signal.dsp
faust
signal - a value that changes over time _ _ _ _| |_| |_| |_ signal - (in faust) a function transforming a time input into a value output (SAMPLE) |---------------| | _ _ _ | time -> | _| |_| |_| |_ | -> value (SAMPLE) | | |---------------|
f53e4540d3f9c8ce8b0f47d11f153345a9caaafcd4e63e54a46d815d1f777843
theyoogle/Faust-DSP
03 Notations.dsp
// Notations // core notation // A, B: * => A, B: * process = _, 0.5 : *; // infix notation // A * B => A, B: * process = _ * 0.5; // prefix notation // *(A, B) => A, B: * process = *(_, 0.5); // partial application // *(B) => _, B: * process = *(0.5);
https://raw.githubusercontent.com/theyoogle/Faust-DSP/373f0b309ad84906043b0b53e02129cd9ce45d59/session%2002/02%20Additional%20Primitives/03%20Notations.dsp
faust
Notations core notation A, B: * => A, B: * infix notation A * B => A, B: * prefix notation *(A, B) => A, B: * partial application *(B) => _, B: *
process = _, 0.5 : *; process = _ * 0.5; process = *(_, 0.5); process = *(0.5);
12a741d3026b4cbe71fcb810a88c0d10c78b6e557da09f404d64e37ad63fb5ae
theyoogle/Faust-DSP
10 Other Math Functions.dsp
// Other math functions Absolute Value abs y(t) = |x(t)| Minimum Value min y(t) = min(x0(t), x1(t)) Maximum Value max y(t) = max(x0(t), x1(t)) Floating Point Module fmod y(t) = fmod(x0(t), x1(t)) Floating Point Remainder remainder y(t) = remainder(x0(t), x1(t)) Previous Integer floor y(t) = min(x(t)) Next Integer ceil y(t) = ceil(x(t)) Closest Integer rint y(t) = rint(x(t))
https://raw.githubusercontent.com/theyoogle/Faust-DSP/373f0b309ad84906043b0b53e02129cd9ce45d59/session%2002/02%20Additional%20Primitives/10%20Other%20Math%20Functions.dsp
faust
Other math functions
Absolute Value abs y(t) = |x(t)| Minimum Value min y(t) = min(x0(t), x1(t)) Maximum Value max y(t) = max(x0(t), x1(t)) Floating Point Module fmod y(t) = fmod(x0(t), x1(t)) Floating Point Remainder remainder y(t) = remainder(x0(t), x1(t)) Previous Integer floor y(t) = min(x(t)) Next Integer ceil y(t) = ceil(x(t)) Closest Integer rint y(t) = rint(x(t))
a9bc011c03c10e705678074191a62be03e012f07549995973cc2c9ebb98bec24
theyoogle/Faust-DSP
07 Signal Generators.dsp
// Signal Generators (No inputs) // Numbers process = 1; // |-----| // | 1 | -> y(t) // |-----| // Semantics // y(t) = 1 when (t >= 0) // Sliders process = vslider(name, inital_value, minimum_value, maximum_value, step_value); process = vslider("level", 0.1, 0, 1, 0.01); process = hslider("level", 0.1, 0, 1, 0.01); // Buttons // Checkboxes
https://raw.githubusercontent.com/theyoogle/Faust-DSP/373f0b309ad84906043b0b53e02129cd9ce45d59/session%2002/01%20Basic%20Primitives/07%20Signal%20Generators.dsp
faust
Signal Generators (No inputs) Numbers |-----| | 1 | -> y(t) |-----| Semantics y(t) = 1 when (t >= 0) Sliders Buttons Checkboxes
process = 1; process = vslider(name, inital_value, minimum_value, maximum_value, step_value); process = vslider("level", 0.1, 0, 1, 0.01); process = hslider("level", 0.1, 0, 1, 0.01);
14c1e352c13142e43537479ccd42f0d906338b2eb89d9cc5e1ef5c606d83850b
theyoogle/Faust-DSP
12 Selectors.dsp
// Selectors select2 Switch between two signals y(t) = x1(t) if x0(t) == 0 y(t) = x2(t) if x0(t) == 1 select3 Switch between three signals y(t) = x1(t) if x0(t) == 0 y(t) = x2(t) if x0(t) == 1 y(t) = x3(t) if x0(t) == 2
https://raw.githubusercontent.com/theyoogle/Faust-DSP/373f0b309ad84906043b0b53e02129cd9ce45d59/session%2002/02%20Additional%20Primitives/12%20Selectors.dsp
faust
Selectors
select2 Switch between two signals y(t) = x1(t) if x0(t) == 0 y(t) = x2(t) if x0(t) == 1 select3 Switch between three signals y(t) = x1(t) if x0(t) == 0 y(t) = x2(t) if x0(t) == 1 y(t) = x3(t) if x0(t) == 2