Last active
March 31, 2024 03:04
-
-
Save mryndzionek/eb61cac8b7293c2cef75741791f356d9 to your computer and use it in GitHub Desktop.
Faust (https://faust.grame.fr/) patches
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import("stdfaust.lib"); | |
pulse(ms, d) = ba.pulsen((ma.SR * d) / 1000.0, (ma.SR * ms) / 1000.0); | |
metro(ms) = ba.pulse((ma.SR * ms) / 1000); | |
phs(f) = +(1)~_ :%(44100/f): /(44100/f): -(0.5); | |
bpm = 60; | |
fourth_time = ba.tempo(bpm); | |
fourth_note = ba.pulse(1 * fourth_time); | |
half_note = ba.pulse(2 * fourth_time); | |
eight_note = ba.pulse(fourth_time / 2); | |
sixth_note = ba.pulse(fourth_time / 4); | |
whole_note = ba.pulse(4 * fourth_time); | |
chord = 0, 1: select2(whole_note: ba.counter: %(2)); | |
bass = 130.81, 87.31: select2(chord): phs: fi.lowpass(1, 100); | |
rnd_sel(rng) = (((rng + 1.0) / 2.0) * 8.0): ba.sAndH(half_note): int; | |
chords_scales(rng) = (60, 62, 64, 65, 67, 69, 71, 72): ba.selectn(8, rnd_sel(rng)): ba.midikey2hz; | |
melody = phs(s) + phs(1.01 * s): fi.lowpass(1, 100): *(0.5): *(e) | |
with { | |
s = chords_scales(no.noise); | |
e = en.asr(0.5, 1.0, 0.5, ba.pulsen(500*ma.SR/1000, fourth_time)); | |
}; | |
connect(a1, a2, b1, b2) = a1 + b1, a2 + b2; | |
process = (par(i, 2, melody): re.greyhole(0.1, 0.1, 2.0, 0.8, 0.5, 0.5, 8), (par(i, 2, bass))): connect; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import("stdfaust.lib"); | |
osc(n) = os.sawtooth(ba.midikey2hz(n)) : | |
fi.resonlp(6000, 1, 1); | |
ms_to_spl(ms) = ma.SR * ms / 1000; | |
loop(ll, nl) = ba.pulsen(ms_to_spl(nl), ms_to_spl(ll)); | |
chan(ll, nl, note) = loop(ll, nl) : en.asr(0.5, 1.0, 0.5) * osc(note); | |
rnd_ll(n) = hgroup("Loop length \[ms\]", par(i, n, hslider("Loop: %i", 5000, 5000, 25000, 1))); | |
rnd_nl(n) = hgroup("Note length \[ms\]", par(i, n, hslider("Note: %i", 1000, 1000, 6000, 1))); | |
process = data : par(i, N, chan) : sum(i, N, _) <: | |
re.greyhole(0.1, 0.1, 2.0, 0.8, 0.5, 0.5, 8) :> | |
*(0.1) : ef.echo(2, 1, 0.1) | |
with { | |
N = 6; | |
data = (rnd_ll(N), | |
rnd_nl(N), | |
(60, 63, 68, 55, 36, 70)) : ro.interleave(N, 3); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import("stdfaust.lib"); | |
stretch(ms) = ba.countdown(ma.SR * ms / 1000): >(0); | |
base_f = hslider("base_f", 600, 200, 1000, 1); | |
bell(f) = ((factors: sum(i, n, *(f): (1 / (1+i)) * os.osc * en.asr(0.01, 1.0, (i + 1) * 0.3, gate: stretch(((n + 1) * 3) - (i + 1) * 3)))): /(n)): fi.resonlp(2 * f, 2, 2) | |
with { | |
factors = (4.07, 3.76, 3.0, 2.74, 2.0, 1.71, 1.19, 0.92, 0.56); | |
n = ba.count(factors); | |
gate = ba.pulse(ma.SR * 1000 / 1000); | |
}; | |
process = bell(base_f) + bell(base_f * 1.01); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import("stdfaust.lib"); | |
trig = no.sparse_noise(0.5) : abs : >(0); | |
rnd_to_note_freq(i) = abs : *(88) : +(21) : int : hbargraph("h:Params/v:Notes/note %i", 21, 109) : ba.midikey2hz; | |
rnd_to_range(a, b) = abs : *(b - a) : +(a); | |
rnd_data(t) = no.multinoise(7) : par(i, 7, ba.sAndH(t)) : | |
((rnd_to_range(0.05, 0.5) : hbargraph("h:Params/v:Envelope/attack", 0.0, 0.5)), | |
(rnd_to_range(0.5, 3.0) : hbargraph("h:Params/v:Envelope/release", 0.0, 3.0)), | |
rnd_to_note_freq(0), | |
rnd_to_note_freq(1), | |
rnd_to_note_freq(2), | |
(abs : hbargraph("h:Params/v:Spatializer/rotation", 0.0, 1.0)), | |
(abs : hbargraph("h:Params/v:Spatializer/distance", 0.0, 1.0))); | |
synth(a, b) = a <: (_, *(os.osc(b))) : (+) : os.osc : *(0.5); | |
process = rnd_data(trig) : play | |
with { | |
play(a, r, n0, n1, n2, sr, sd) = | |
trig : en.ar(a, r) : | |
*(synth(n0, n1)) : | |
fi.resonbp(n2, 3, 1) : | |
ef.echo(0.5, 0.2, 0.8) : sp.spat(2, sr, sd); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import("stdfaust.lib"); | |
sparse_selector(n, f) = (selector, channels) : | |
ro.interleave(n, 2) : | |
par(i, n, ba.sAndH : si.smooth(0.99995)) | |
with { | |
trig = no.sparse_noise(f) : abs : >(0); | |
trigs = par(i, n, ba.sAndH(trig) : si.smoo); | |
rnd = no.multinoise(n + 1) : par(i, n + 1, abs); | |
channels = rnd : (si.bus(n), si.block(1)); | |
trig_sel = rnd :(si.block(n), _) : ba.sAndH(trig) : *(n) : int; | |
selector = trig : ba.selectoutn(n, trig_sel); | |
}; | |
process = ((((fs : par(i, N, osc)), w_selectors) : | |
ro.interleave(N, 2) : par(i, N, (*))), feedback, noise) : | |
sum(i, N + 2, _) : +(bias_selector) : activation : *(0.2) : | |
fi.resonbp(filter_selector, 3, 1) | |
with { | |
N = ba.count(freqs); | |
freqs = (50, 110, 116, 330, 336, 550, 556); | |
fs = freqs : par(i, N, hbargraph("h:Params/v:Frequencies/frequency %i", 0, 600)); | |
osc = os.sawtooth; | |
controls = sparse_selector(N + 4, 0.5); | |
w_selectors = controls : (si.bus(N), si.block(4)) : par(i, N, hbargraph("h:Params/v:Weights/weight %i", 0, 1)); | |
bias_selector = controls : ba.selectn(N + 4, N) : -(0.5) : hbargraph("h:Params/v:Other/bias", -0.5, 0.5); | |
feedback = controls : ba.selectn(N + 4, N + 1) : *(2) : -(1.0) : hbargraph("h:Params/v:Other/feedback", -1, 1); | |
filter_selector = controls : ba.selectn(N + 4, N + 2): *(1000) : +(100) : hbargraph("h:Params/v:Other/filter", 100, 1100); | |
noise = controls : ba.selectn(N + 4, N + 3) : hbargraph("h:Params/v:Other/noise", 0, 1) : *(no.noise); | |
wrap(s) = s - int(s); | |
activation = wrap; | |
}; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import("stdfaust.lib"); | |
pitch = hslider("pitch mult", 800, 100, 3000, 1); | |
freq = hslider("freq", 500, 100, 3000, 1); | |
rnd_sel(n, trig, rng) = (((rng + 1.0) / 2.0) * n): ba.sAndH(trig): int; | |
scream(fr) = no.noise : +(1.0) : *(fr) : +(jumps) <: os.sawtooth <: tract :> *(0.8 + (no.lfnoise(15) / 5)) : *(0.4) | |
with { | |
tract = (fi.resonbp(2200, 0.1, 0.5), | |
fi.resonbp(1800, 20, 1), | |
fi.resonbp(1200, 20, 1), | |
fi.resonbp(1100, 8, 1), | |
fi.resonbp(700, 10, 1), | |
fi.resonbp(330, 10, 0.5)); | |
jumps = (trig * pitch * ((os.osc(0.5) / 5) + 0.8)) * (rnd_sel(2, ba.pulse(ma.SR/650), no.noise)); | |
}; | |
sticky(s) = (s, (s : 0.3 + si.smooth(0.99992) : /(1.3))) : (*) ; | |
trig = button("scream") : sticky; | |
process = trig : *(freq) : scream : *(0.8) <: (_, _); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import("stdfaust.lib"); | |
trig = button("on") : en.asre(0.1, 1, 4); | |
vibrato = os.osc(2) /(10) : +(0.9); | |
process = (os.osc(2100), os.osc(1400), | |
(no.noise : ve.moog_vcf_2bn(0.8, 1500) : *(8 * trig * trig)), | |
(os.phasor(1500, 30) : +(1000) : os.square : *(vibrato) )) : | |
sum(i, 4, _) : fi.resonlp(1000, 1, 1) : *(trig) : *(0.3); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import("stdfaust.lib"); | |
tone(f, t) = (tn, 0) : select2(f < 0) | |
with { | |
tn = (os.osc(f) * (2 * ma.PI) + (0.5 * ma.PI * t) ) : cos; | |
}; | |
pulses(ts) = (_, 0) : seq(i, N, block(ts : ba.selectn(N, i))) : select2(1) | |
with { | |
N = outputs(ts); | |
delay(ms, t) = t, (t : ba.countdown(ma.SR * ms / 1000) : >(0) <: (mem, _) : (-) : >(0)) : | |
select2(ms > 0); | |
block(ms, t, a) = delay(ms, t) <: (_, +(a)); | |
}; | |
npulse(n, ms) = ((_, _) :> _) ~ (switch(n) : delay(ms)) | |
with { | |
switch(n, t) = (t, 0) : select2(t : ba.pulse_countup_loop(n - 1, 1) : >=(n)); | |
delay(ms, t) = t, (t : ba.countdown(ma.SR * ms / 1000) : >(0) <: (mem, _) : (-) : >(0)) : | |
select2(ms > 0); | |
}; | |
tune(freqs, spd, tim, tr) = fc : tn : *(trig : mem : *(fc > 0) : env(spd * 0.38)) | |
with { | |
fs = 0, freqs; | |
N = outputs(fs); | |
ps = 0, par(i, N - 1, spd); | |
sq = trig : ba.pulse_countup_loop(N - 1, 1); | |
fc = fs : ba.selectn(N, sq); | |
trig = tr : pulses(ps); | |
tn(f) = tone(f, tim); | |
env(ms) = ba.countdown(ma.SR * ms / 1000): >(0) : en.adsr(0.01, 0.01, 1, 0.03); | |
}; | |
tune_ui = tune(freqs, spd, tim, trig) : *(0.5) : fi.resonhp(50, 3, 1) : | |
ef.echo(0.2, 0.1, echo) <: attach(_, monitor) | |
with { | |
s_notes = (6, 6.25, 6, 6.25); | |
N = outputs(s_notes); | |
monitor = abs : ba.linear2db : hbargraph("output[unit:dB]", -80, 0); | |
freqs = par(i, N, vslider("h:Params/h:[0]MIDI notes/note %2i", s_notes : ba.selectn(N, i), -1, 12, 0.25) : proc); | |
midi_dif(n) = ba.midikey2hz(n + 1) - ba.midikey2hz(n); | |
proc(n) = (0, ((n - int(n)) * midi_dif(oct + (n))) + ba.midikey2hz(oct + int(n))) : select2(n >= 0); | |
oct = vslider("h:Params/h:[0]MIDI notes/start", 60, 30, 100, 1); | |
tim = vslider("h:Params/v:[1]Control/timbre[style:knob]", 0.5, 0, 1, 0.01); | |
echo = vslider("h:Params/v:[1]Control/echo[style:knob]", 0.5, 0, 1, 0.01); | |
rep = vslider("h:Params/v:[2]Timing/repeat[style:knob]", 2, 1, 5, 1); | |
spd = 250 - (vslider("h:Params/v:[2]Timing/speed[style:knob]", 0.5, 0, 1, 0.01) : *(200)); | |
trig = button("play") : ba.impulsify : npulse(rep, spd + (spd * N)); | |
}; | |
process = tune_ui <: _, _; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment