diff options
author | Vee9ahd1 <> | 2021-05-11 15:29:40 -0400 |
---|---|---|
committer | Vee9ahd1 <> | 2021-05-11 15:29:40 -0400 |
commit | 194676e190b827c6b12318213261d4e47ec7e6aa (patch) | |
tree | 37802291ed88fcc79f5e0946d7a283ca345afb12 |
initial commit
-rw-r--r-- | .gitignore | 4 | ||||
-rw-r--r-- | Makefile | 9 | ||||
-rw-r--r-- | Makefile.sccompile | 30 | ||||
-rw-r--r-- | loquelic_pm.dsp | 36 | ||||
-rw-r--r-- | loquelic_ss.dsp | 28 | ||||
-rw-r--r-- | loquelic_ss_cv.dsp | 29 | ||||
-rw-r--r-- | loquelic_vo.dsp | 30 | ||||
-rw-r--r-- | src/util.dsp | 26 |
8 files changed, 192 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ad31c67 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +.DS_Store +*.log +tmp/ +build/ diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..356b110 --- /dev/null +++ b/Makefile @@ -0,0 +1,9 @@ +## +# loquelic iteritas + +BUILD_DIR := ./build +#SC_EXTENSION_DIR := $(BUILD_DIR)/loquelic/Supercollider/Extensions/ +#INT_DIR := $(BUILD_DIR)/loquelic/src/ + +supercollider: + $(MAKE) BUILD_DIR=$(BUILD_DIR) -f Makefile.sccompile diff --git a/Makefile.sccompile b/Makefile.sccompile new file mode 100644 index 0000000..9357afb --- /dev/null +++ b/Makefile.sccompile @@ -0,0 +1,30 @@ +BUILD_DIR ?= ./build + +CXXFLAGS := $(CXXFLAGS) +LFLAGS := -fPIC -shared $(LFLAGS) + +scbuilddir := $(BUILD_DIR)/Supercollider +extdir := $(scbuilddir)/Extensions + +dspsrc := $(wildcard *.dsp) +scfiles := $(addprefix $(extdir)/, $(dspsrc:.dsp=.sc)) +sofiles := $(addprefix $(extdir)/, $(dspsrc:.dsp=.so)) + +archfile := /usr/share/faust/supercollider.cpp +scincludes := -I/usr/include/SuperCollider/plugin_interface -I/usr/include/SuperCollider/common + +all: $(sofiles) $(scfiles) + +%.cpp: %.dsp + faust -a $(archfile) $< -o $@ + +$(extdir)/%.so: %.cpp + mkdir -p $(extdir) + $(CXX) $(CXXFLAGS) $(scincludes) $(OPTFLAGS) $(LFLAGS) $< -o $@ + +$(extdir)/%.sc: %.dsp.xml + mkdir -p $(extdir) + faust2sc --prefix="" $< --output=$@ + +%.dsp.xml: %.dsp + faust --xml -o /dev/null $< diff --git a/loquelic_pm.dsp b/loquelic_pm.dsp new file mode 100644 index 0000000..fc1536e --- /dev/null +++ b/loquelic_pm.dsp @@ -0,0 +1,36 @@ +import("stdfaust.lib"); +import("src/util.dsp"); + +UIGroupOscA(x) = vgroup("Oscillator A", x); +UIFreqA = UIGroupOscA(hslider("Frequency", 440.0, 20.0, 10000.0, 1)); +UIMorphA = UIGroupOscA(hslider("Morph", 0.5, 0.0, 1.0, 0.001)); + +UIGroupOscB(x) = vgroup("Oscillator B", x); +UIFreqB = UIGroupOscB(hslider("Frequency", 440.0, 20.0, 10000.0, 1)); +UIMorphB = UIGroupOscB(hslider("Morph", 0.5, 0.0, 1.0, 0.001)); + +UIFoldGain = hslider("Fold", 1.0, 0.0, 5.0, 0.01); +UIMix = hslider("Mix", -1.0, -1.0, 1.0, 0.001); +UIMod = hslider("Modulation", 0.0, 0.0, 1.0, 0.001); + +process = + pmoscillators ~ (scaletwo(UIMod) : crossconnect) + : \(a, b).(a, a*b, b) + : blendthree(UIMix) + : *(UIFoldGain) + : fold +with { + pmsinemorph(morph, freq, pmod) = + freq + : phase + pmod + : fmod(_, 1.0) + : knee(morph) + : sin(_*2.0*ma.PI); + + pmoscillators = + pmsinemorph(UIMorphA, UIFreqA) + , pmsinemorph(UIMorphB, UIFreqB); + + scaletwo(s) = par(i, 2, *(s)); + crossconnect = route(2,2,1,2,2,1); +}; diff --git a/loquelic_ss.dsp b/loquelic_ss.dsp new file mode 100644 index 0000000..5e13b4e --- /dev/null +++ b/loquelic_ss.dsp @@ -0,0 +1,28 @@ +import("stdfaust.lib"); +import("src/util.dsp"); + +UIGroupOscA(x) = vgroup("Oscillator A", x); +UIFreqA = UIGroupOscA(hslider("Frequency", 440.0, 20.0, 10000.0, 1)); +UIMorphA = UIGroupOscA(hslider("Morph", 0.5, 0.0, 1.0, 0.001)); + +UIGroupOscB(x) = vgroup("Oscillator B", x); +UIFreqB = UIGroupOscB(hslider("Frequency", 440.0, 20.0, 10000.0, 1)); +UIMorphB = UIGroupOscB(hslider("Morph", 0.5, 0.0, 1.0, 0.001)); + +UIFoldGain = hslider("Fold", 1.0, 0.0, 5.0, 0.01); +UIMod = hslider("Modulation", 0.0, 0.0, 1.0, 0.001); +UIDamp = hslider("Damp", 0.0, 0.0, 1.0, 0.001); + +process = (oscA - a*oscC)/(1.0 + a^2 - 2*a*oscB) : *(UIFoldGain) : fold +with { + a = UIDamp; + sinemorph(morph) = knee(morph) : sin(_*2.0*ma.PI); + + tA = UIFreqA : phase + oscB*UIMod : fmod(_, 1.0); + tB = UIFreqB : phase + 0.25 : fmod(_, 1.0); + tC = tB - tA : fmod(_, 1.0); + + oscA = tA : sinemorph(UIMorphA); + oscB = tB : sinemorph(UIMorphB); + oscC = tA - tB : sin(_*2.0+ma.PI); +}; diff --git a/loquelic_ss_cv.dsp b/loquelic_ss_cv.dsp new file mode 100644 index 0000000..772b321 --- /dev/null +++ b/loquelic_ss_cv.dsp @@ -0,0 +1,29 @@ +import("stdfaust.lib"); +import("src/util.dsp"); + +UIGroupOscA(x) = vgroup("Oscillator A", x); +UIFreqA = UIGroupOscA(hslider("Frequency", 440.0, 20.0, 10000.0, 1)); +UIMorphA = UIGroupOscA(hslider("Morph", 0.5, 0.0, 1.0, 0.001)); + +UIGroupOscB(x) = vgroup("Oscillator B", x); +UIFreqB = UIGroupOscB(hslider("Frequency", 440.0, 20.0, 10000.0, 1)); +UIMorphB = UIGroupOscB(hslider("Morph", 0.5, 0.0, 1.0, 0.001)); + +UIFoldGain = hslider("Fold", 1.0, 0.0, 5.0, 0.01); +UIMod = hslider("Modulation", 0.0, 0.0, 1.0, 0.001); +UIDamp = hslider("Damp", 0.0, 0.0, 1.0, 0.001); + +process(pitchA, pitchB, morphA, morphB, foldgain, mod, damp) = + (oscA - a*oscC)/(1.0 + a^2 - 2*a*oscB) : *(UIFoldGain + foldgain) : fold +with { + a = UIDamp; + sinemorph(morph) = knee(morph) : sin(_*2.0*ma.PI); + + tA = pitchA : phase + oscB*(UIMod + mod) : fmod(_, 1.0); + tB = pitchB : phase + 0.25 : fmod(_, 1.0); + tC = tB - tA : fmod(_, 1.0); + + oscA = tA : sinemorph(morphA + UIMorphA); + oscB = tB : sinemorph(morphB + UIMorphB); + oscC = tA - tB : sin(_*2.0+ma.PI); +}; diff --git a/loquelic_vo.dsp b/loquelic_vo.dsp new file mode 100644 index 0000000..7687932 --- /dev/null +++ b/loquelic_vo.dsp @@ -0,0 +1,30 @@ +import("stdfaust.lib"); +import("src/util.dsp"); + +UIGroupOscA(x) = hgroup("Oscillator A", x); +UIFreqA = UIGroupOscA(vslider("Frequency", 440.0, 20.0, 10000.0, 1)); +UIFoldGain = UIGroupOscA(vslider("Fold", 1.0, 0.0, 5.0, 0.01)); +UIMorph = UIGroupOscA(vslider("Morph", 0.5, 0.0, 1.0, 0.001)); + +UIGroupOscB(x) = hgroup("Oscillator B", x); +UIFreqB = UIGroupOscB(vslider("Frequency", 440.0, 20.0, 10000.0, 1)); +UIDecay = UIGroupOscB(vslider("Decay", 0.0, 0.0, 1.0, 0.01)); + +UIMod = vslider("Modulation", 0.0, 0.0, 1.0, 0.001); + +process = oscA * oscB +with { + oscB = UIFreqA + : phase + : *(-UIDecay*10.0) + : exp; + + oscA = UIFreqB + : phase + : +(oscB*UIMod) + : fmod(_,1.0) + : knee(UIMorph) + : sin(_*2.0*ma.PI) + : *(UIFoldGain) + : fold; +}; diff --git a/src/util.dsp b/src/util.dsp new file mode 100644 index 0000000..72902d3 --- /dev/null +++ b/src/util.dsp @@ -0,0 +1,26 @@ +import("stdfaust.lib"); + +/* phasor: 0.0 to 1.0 at freq Hz */ +phase(freq) = (+(freq/ma.SR) : _,1.0 : fmod) ~ _; + +/* knee is a piecewise linear mapping + * [0,m) -> [0,0.5) + * and [m,1] -> [0.5,1] */ +knee(c, in) = 0.5*(min(x, m)/m + max(x - m, 0.0)/(1.0 - m)) +with { + x = clamp(0.0, 1.0, in); + m = clamp(0.001, 0.999, c); +}; + +/* simple wave folding */ +fold(x) = 4*(abs(0.25*x + 0.25 - int(0.25*x + 0.25)) - 0.25); + +clamp(m, M) = _ : min(M) : max(m); + +blendthree(value, inA, inB, inC) = + max(-clamped_value, 0.0)*inA + + max(clamped_value, 0.0)*inC + + max(1.0 - abs(clamped_value), 0.0)*inC +with { + clamped_value = value : clamp(-1.0, 1.0); +}; |