_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
|
---|---|---|---|---|---|---|---|
20eaf4cbf556c79ae03d735937e8e4dc6070cdd1f17368fceb53cbaa222000ee | tonal-glyph/faustus | multiSynth.dsp | //################################### multiSynth.dsp ######################################
// Faust instrument specifically designed for `faust2smartkeyb` where 4 keyboards
// are used to control 4 independent synths.
//
// ## `SmartKeyboard` Use Strategy
//
// The `SmartKeyboard` configuration is relatively simple for this example and
// only consists in four polyphonic keyboards in parallel. The `keyboard` standard
// parameter is used to activate specific elements of the synthesizer.
//
// ## Compilation Instructions
//
// This Faust code will compile fine with any of the standard Faust targets. However
// it was specifically designed to be used with `faust2smartkeyb`. For best results,
// we recommend to use the following parameters to compile it:
//
// ```
// faust2smartkeyb [-ios/-android] -effect reverb.dsp multiSynth.dsp
// ```
//
// ## Version/Licence
//
// Version 0.0, Feb. 2017
// Copyright Romain Michon CCRMA (Stanford University)/GRAME 2017
// MIT Licence: https://opensource.org/licenses/MIT
//########################################################################################
// Interface with 4 polyphnic keyboards of 13 keys with the same config
declare interface "SmartKeyboard{
'Number of Keyboards':'4',
'Rounding Mode':'2',
'Inter-Keyboard Slide':'0',
'Keyboard 0 - Number of Keys':'13',
'Keyboard 1 - Number of Keys':'13',
'Keyboard 2 - Number of Keys':'13',
'Keyboard 3 - Number of Keys':'13',
'Keyboard 0 - Lowest Key':'60',
'Keyboard 1 - Lowest Key':'60',
'Keyboard 2 - Lowest Key':'60',
'Keyboard 3 - Lowest Key':'60',
'Keyboard 0 - Send Y':'1',
'Keyboard 1 - Send Y':'1',
'Keyboard 2 - Send Y':'1',
'Keyboard 3 - Send Y':'1'
}";
import("stdfaust.lib");
// standard parameters
f = hslider("freq",300,50,2000,0.01);
bend = hslider("bend[midi:pitchwheel]",1,0,10,0.01) : si.polySmooth(gate,0.999,1);
gain = hslider("gain",1,0,1,0.01);
s = hslider("sustain[midi:ctrl 64]",0,0,1,1); // for sustain pedal
t = button("gate");
y = hslider("y[midi:ctrl 1]",1,0,1,0.001) : si.smoo;
keyboard = hslider("keyboard",0,0,3,1) : int;
// fomating parameters
gate = t+s : min(1);
freq = f*bend;
cutoff = y*4000+50;
// oscillators
oscilators(0) = os.sawtooth(freq);
oscilators(1) = os.triangle(freq);
oscilators(2) = os.square(freq);
oscilators(3) = os.osc(freq);
// oscs are selected in function of the current keyboard
synths = par(i,4,select2(keyboard == i,0,oscilators(i))) :> fi.lowpass(3,cutoff) : *(envelope)
with{
envelope = gate*gain : si.smoo;
};
process = synths <: _,_;
| https://raw.githubusercontent.com/tonal-glyph/faustus/cc887b115aceaee202edbdb37ee0e4087bfb5a33/examples/smartKeyboard/multiSynth.dsp | faust | ################################### multiSynth.dsp ######################################
Faust instrument specifically designed for `faust2smartkeyb` where 4 keyboards
are used to control 4 independent synths.
## `SmartKeyboard` Use Strategy
The `SmartKeyboard` configuration is relatively simple for this example and
only consists in four polyphonic keyboards in parallel. The `keyboard` standard
parameter is used to activate specific elements of the synthesizer.
## Compilation Instructions
This Faust code will compile fine with any of the standard Faust targets. However
it was specifically designed to be used with `faust2smartkeyb`. For best results,
we recommend to use the following parameters to compile it:
```
faust2smartkeyb [-ios/-android] -effect reverb.dsp multiSynth.dsp
```
## Version/Licence
Version 0.0, Feb. 2017
Copyright Romain Michon CCRMA (Stanford University)/GRAME 2017
MIT Licence: https://opensource.org/licenses/MIT
########################################################################################
Interface with 4 polyphnic keyboards of 13 keys with the same config
standard parameters
for sustain pedal
fomating parameters
oscillators
oscs are selected in function of the current keyboard |
declare interface "SmartKeyboard{
'Number of Keyboards':'4',
'Rounding Mode':'2',
'Inter-Keyboard Slide':'0',
'Keyboard 0 - Number of Keys':'13',
'Keyboard 1 - Number of Keys':'13',
'Keyboard 2 - Number of Keys':'13',
'Keyboard 3 - Number of Keys':'13',
'Keyboard 0 - Lowest Key':'60',
'Keyboard 1 - Lowest Key':'60',
'Keyboard 2 - Lowest Key':'60',
'Keyboard 3 - Lowest Key':'60',
'Keyboard 0 - Send Y':'1',
'Keyboard 1 - Send Y':'1',
'Keyboard 2 - Send Y':'1',
'Keyboard 3 - Send Y':'1'
}";
import("stdfaust.lib");
f = hslider("freq",300,50,2000,0.01);
bend = hslider("bend[midi:pitchwheel]",1,0,10,0.01) : si.polySmooth(gate,0.999,1);
gain = hslider("gain",1,0,1,0.01);
t = button("gate");
y = hslider("y[midi:ctrl 1]",1,0,1,0.001) : si.smoo;
keyboard = hslider("keyboard",0,0,3,1) : int;
gate = t+s : min(1);
freq = f*bend;
cutoff = y*4000+50;
oscilators(0) = os.sawtooth(freq);
oscilators(1) = os.triangle(freq);
oscilators(2) = os.square(freq);
oscilators(3) = os.osc(freq);
synths = par(i,4,select2(keyboard == i,0,oscilators(i))) :> fi.lowpass(3,cutoff) : *(envelope)
with{
envelope = gate*gain : si.smoo;
};
process = synths <: _,_;
|
3c5a1e87e5c3eaf850407df4e2e38f12d41e38f62e9c54ee23387848fef7e4a3 | tonal-glyph/faustus | midiOnly.dsp | //################################### midiOnly.dsp ######################################
// Faust instrument specifically designed for `faust2smartkeyb` implementing a MIDI
// controllable app where the mobile device's touch screen is used to control
// specific parameters of the synth continuously using two separate X/Y control surfaces.
//
// ## `SmartKeyboard` Use Strategy
//
// The `SmartKeyboard` configuration for this instrument consists in a single keyboard
// with two keys. Each key implements a control surface. `Piano Keyboard` mode is
// disabled so that key names are not displayed and that keys don't change color when
// touched. Finally, `Send Freq` is set to 0 so that new voices are not allocated by
// the touch screen and that the `freq` and `bend` parameters are not computed.
//
// ## Compilation Instructions
//
// This Faust code will compile fine with any of the standard Faust targets. However
// it was specifically designed to be used with `faust2smartkeyb`. For best results,
// we recommend to use the following parameters to compile it:
//
// ```
// faust2smartkeyb [-ios/-android] -effect reverb.dsp midiOnly.dsp
// ```
//
// ## Version/Licence
//
// Version 0.0, Feb. 2017
// Copyright Romain Michon CCRMA (Stanford University)/GRAME 2017
// MIT Licence: https://opensource.org/licenses/MIT
//########################################################################################
// Interface with 4 polyphnic keyboards of 13 keys with the same config
declare interface "SmartKeyboard{
'Number of Keyboards':'1',
'Keyboard 0 - Number of Keys':'2',
'Keyboard 0 - Send Freq':'0',
'Keyboard 0 - Piano Keyboard':'0',
'Keyboard 0 - Static Mode':'1',
'Keyboard 0 - Send Key X':'1',
'Keyboard 0 - Key 0 - Label':'Mod Index',
'Keyboard 0 - Key 1 - Label':'Mod Freq'
}";
import("stdfaust.lib");
f = hslider("freq",300,50,2000,0.01);
bend = hslider("bend[midi:pitchwheel]",1,0,10,0.01) : si.polySmooth(gate,0.999,1);
gain = hslider("gain",1,0,1,0.01);
key = hslider("key",0,0,1,1) : int;
kb0k0x = hslider("kb0k0x[midi:ctrl 1]",0.5,0,1,0.01) : si.smoo;
kb0k1x = hslider("kb0k1x[midi:ctrl 1]",0.5,0,1,0.01) : si.smoo;
s = hslider("sustain[midi:ctrl 64]",0,0,1,1);
t = button("gate");
// fomating parameters
gate = t+s : min(1);
freq = f*bend;
index = kb0k0x*1000;
modFreqRatio = kb0k1x;
envelope = gain*gate : si.smoo;
process = sy.fm((freq,freq + freq*modFreqRatio),index*envelope)*envelope <: _,_;
| https://raw.githubusercontent.com/tonal-glyph/faustus/cc887b115aceaee202edbdb37ee0e4087bfb5a33/examples/smartKeyboard/midiOnly.dsp | faust | ################################### midiOnly.dsp ######################################
Faust instrument specifically designed for `faust2smartkeyb` implementing a MIDI
controllable app where the mobile device's touch screen is used to control
specific parameters of the synth continuously using two separate X/Y control surfaces.
## `SmartKeyboard` Use Strategy
The `SmartKeyboard` configuration for this instrument consists in a single keyboard
with two keys. Each key implements a control surface. `Piano Keyboard` mode is
disabled so that key names are not displayed and that keys don't change color when
touched. Finally, `Send Freq` is set to 0 so that new voices are not allocated by
the touch screen and that the `freq` and `bend` parameters are not computed.
## Compilation Instructions
This Faust code will compile fine with any of the standard Faust targets. However
it was specifically designed to be used with `faust2smartkeyb`. For best results,
we recommend to use the following parameters to compile it:
```
faust2smartkeyb [-ios/-android] -effect reverb.dsp midiOnly.dsp
```
## Version/Licence
Version 0.0, Feb. 2017
Copyright Romain Michon CCRMA (Stanford University)/GRAME 2017
MIT Licence: https://opensource.org/licenses/MIT
########################################################################################
Interface with 4 polyphnic keyboards of 13 keys with the same config
fomating parameters |
declare interface "SmartKeyboard{
'Number of Keyboards':'1',
'Keyboard 0 - Number of Keys':'2',
'Keyboard 0 - Send Freq':'0',
'Keyboard 0 - Piano Keyboard':'0',
'Keyboard 0 - Static Mode':'1',
'Keyboard 0 - Send Key X':'1',
'Keyboard 0 - Key 0 - Label':'Mod Index',
'Keyboard 0 - Key 1 - Label':'Mod Freq'
}";
import("stdfaust.lib");
f = hslider("freq",300,50,2000,0.01);
bend = hslider("bend[midi:pitchwheel]",1,0,10,0.01) : si.polySmooth(gate,0.999,1);
gain = hslider("gain",1,0,1,0.01);
key = hslider("key",0,0,1,1) : int;
kb0k0x = hslider("kb0k0x[midi:ctrl 1]",0.5,0,1,0.01) : si.smoo;
kb0k1x = hslider("kb0k1x[midi:ctrl 1]",0.5,0,1,0.01) : si.smoo;
s = hslider("sustain[midi:ctrl 64]",0,0,1,1);
t = button("gate");
gate = t+s : min(1);
freq = f*bend;
index = kb0k0x*1000;
modFreqRatio = kb0k1x;
envelope = gain*gate : si.smoo;
process = sy.fm((freq,freq + freq*modFreqRatio),index*envelope)*envelope <: _,_;
|
a5c6a6e0e433d5d0613b61a1cd52ab6f771b92d87dbea1f9587a9e6064c8552c | tonal-glyph/faustus | drums.dsp | //##################################### drums.dsp ########################################
// Faust instrument specifically designed for `faust2smartkeyb` where 3 drums can
// be controlled using pads. The X/Y postion of fingers is detected on each key
// and use to control the strike postion on the virtual membrane.
//
// ## `SmartKeyboard` Use Strategy
//
// The drum physical model used here is implemented to be generic so that its
// fundamental frequency can be changed for each voice. `SmartKeyboard` is used
// in polyphonic mode so each new strike on the interface corresponds to a new
// new voice.
//
// ## Compilation Instructions
//
// This Faust code will compile fine with any of the standard Faust targets. However
// it was specifically designed to be used with `faust2smartkeyb`. For best results,
// we recommend to use the following parameters to compile it:
//
// ```
// faust2smartkeyb [-ios/-android] -effect reverb.dsp drums.dsp
// ```
//
// ## Version/Licence
//
// Version 0.0, Feb. 2017
// Copyright Romain Michon CCRMA (Stanford University)/GRAME 2017
// MIT Licence: https://opensource.org/licenses/MIT
//########################################################################################
// Interface with 2 keyboards of 2 and 1 keys (3 pads)
// Static mode is used so that keys don't change color when touched
// Note labels are hidden
// Piano Keyboard mode is deactivated so all the keys look the same
declare interface "SmartKeyboard{
'Number of Keyboards':'2',
'Keyboard 0 - Number of Keys':'2',
'Keyboard 1 - Number of Keys':'1',
'Keyboard 0 - Static Mode':'1',
'Keyboard 1 - Static Mode':'1',
'Keyboard 0 - Send X':'1',
'Keyboard 0 - Send Y':'1',
'Keyboard 1 - Send X':'1',
'Keyboard 1 - Send Y':'1',
'Keyboard 0 - Piano Keyboard':'0',
'Keyboard 1 - Piano Keyboard':'0',
'Keyboard 0 - Key 0 - Label':'High',
'Keyboard 0 - Key 1 - Label':'Mid',
'Keyboard 1 - Key 0 - Label':'Low'
}";
import("stdfaust.lib");
// standard parameters
gate = button("gate");
x = hslider("x",1,0,1,0.001);
y = hslider("y",1,0,1,0.001);
keyboard = hslider("keyboard",0,0,1,1) : int;
key = hslider("key",0,0,1,1) : int;
drumModel = pm.djembe(rootFreq,exPos,strikeSharpness,gain,gate)
with{
// frequency of the lowest drum
bFreq = 60;
// retrieving pad ID (0-2)
padID = 2-(keyboard*2+key);
// drum root freq is computed in function of pad number
rootFreq = bFreq*(padID+1);
// excitation position
exPos = min((x*2-1 : abs),(y*2-1 : abs));
strikeSharpness = 0.5;
gain = 2;
};
process = drumModel <: _,_;
| https://raw.githubusercontent.com/tonal-glyph/faustus/cc887b115aceaee202edbdb37ee0e4087bfb5a33/examples/smartKeyboard/drums.dsp | faust | ##################################### drums.dsp ########################################
Faust instrument specifically designed for `faust2smartkeyb` where 3 drums can
be controlled using pads. The X/Y postion of fingers is detected on each key
and use to control the strike postion on the virtual membrane.
## `SmartKeyboard` Use Strategy
The drum physical model used here is implemented to be generic so that its
fundamental frequency can be changed for each voice. `SmartKeyboard` is used
in polyphonic mode so each new strike on the interface corresponds to a new
new voice.
## Compilation Instructions
This Faust code will compile fine with any of the standard Faust targets. However
it was specifically designed to be used with `faust2smartkeyb`. For best results,
we recommend to use the following parameters to compile it:
```
faust2smartkeyb [-ios/-android] -effect reverb.dsp drums.dsp
```
## Version/Licence
Version 0.0, Feb. 2017
Copyright Romain Michon CCRMA (Stanford University)/GRAME 2017
MIT Licence: https://opensource.org/licenses/MIT
########################################################################################
Interface with 2 keyboards of 2 and 1 keys (3 pads)
Static mode is used so that keys don't change color when touched
Note labels are hidden
Piano Keyboard mode is deactivated so all the keys look the same
standard parameters
frequency of the lowest drum
retrieving pad ID (0-2)
drum root freq is computed in function of pad number
excitation position |
declare interface "SmartKeyboard{
'Number of Keyboards':'2',
'Keyboard 0 - Number of Keys':'2',
'Keyboard 1 - Number of Keys':'1',
'Keyboard 0 - Static Mode':'1',
'Keyboard 1 - Static Mode':'1',
'Keyboard 0 - Send X':'1',
'Keyboard 0 - Send Y':'1',
'Keyboard 1 - Send X':'1',
'Keyboard 1 - Send Y':'1',
'Keyboard 0 - Piano Keyboard':'0',
'Keyboard 1 - Piano Keyboard':'0',
'Keyboard 0 - Key 0 - Label':'High',
'Keyboard 0 - Key 1 - Label':'Mid',
'Keyboard 1 - Key 0 - Label':'Low'
}";
import("stdfaust.lib");
gate = button("gate");
x = hslider("x",1,0,1,0.001);
y = hslider("y",1,0,1,0.001);
keyboard = hslider("keyboard",0,0,1,1) : int;
key = hslider("key",0,0,1,1) : int;
drumModel = pm.djembe(rootFreq,exPos,strikeSharpness,gain,gate)
with{
bFreq = 60;
padID = 2-(keyboard*2+key);
rootFreq = bFreq*(padID+1);
exPos = min((x*2-1 : abs),(y*2-1 : abs));
strikeSharpness = 0.5;
gain = 2;
};
process = drumModel <: _,_;
|
22094aa3c7a218806c006c397d61f81c73aa42472a562d569333b4ff75f625a6 | tonal-glyph/faustus | simpleSynth_Analog.dsp | import("stdfaust.lib");
///////////////////////////////////////////////////////////////////////////////////////////////////
//
// A very simple subtractive synthesizer with 1 VCO 1 VCF.
// The VCO Waveform is variable between Saw and Square
// The frequency is modulated by an LFO
// The envelope control volum and filter frequency
//
///////////////////////////////////////////////////////////////////////////////////////////////////
// ANALOG IMPLEMENTATION:
//
// ANALOG_0 : waveform (Saw to square)
// ANALOG_1 : Filter Cutoff frequency
// ANALOG_2 : Filter resonance (Q)
// ANALOG_3 : Filter Envelope Modulation
//
// MIDI:
// CC 79 : Filter keyboard tracking (0 to X2, default 1)
//
// Envelope
// CC 73 : Attack
// CC 76 : Decay
// CC 77 : Sustain
// CC 72 : Release
//
// CC 78 : LFO frequency (0.001Hz to 10Hz)
// CC 1 : LFO Amplitude (Modulation)
//
///////////////////////////////////////////////////////////////////////////////////////////////////
//
// HUI //////////////////////////////////////////////////
// Keyboard
midigate = button ("gate");
midifreq = nentry("freq[unit:Hz]", 440, 20, 20000, 1);
midigain = nentry("gain", 0.5, 0, 0.5, 0.01);// MIDI KEYBOARD
// pitchwheel
pitchwheel = hslider("bend [midi:pitchwheel]",1,0.001,10,0.01);
// VCO
wfFade = hslider("waveform[BELA: ANALOG_0]",0.5,0,1,0.001):si.smoo;
// VCF
res = hslider("resonnance[BELA: ANALOG_2]",0.5,0,1,0.001):si.smoo;
fr = hslider("fc[BELA: ANALOG_1]", 10, 15, 12000, 0.001):si.smoo;
track = hslider("tracking[midi:ctrl 79]", 1, 0, 2, 0.001);
envMod = hslider("envMod[BELA: ANALOG_3]",50,0,100,0.01):si.smoo;
// ENV
att = 0.01 * (hslider ("attack[midi:ctrl 73]",0.1,0.1,400,0.001));
dec = 0.01 * (hslider ("decay[midi:ctrl 76]",60,0.1,400,0.001));
sust = hslider ("sustain[midi:ctrl 77]",0.2,0,1,0.001);
rel = 0.01 * (hslider ("release[midi:ctrl 72]",100,0.1,400,0.001));
// LFO
lfoFreq = hslider ("lfoFreq[midi:ctrl 78]",6,0.001,10,0.001):si.smoo;
modwheel = hslider ("modwheel[midi:ctrl 1]",0,0,0.5,0.001):si.smoo;
// PROCESS /////////////////////////////////////////////
allfreq = (midifreq * pitchwheel) + LFO;
// VCF
cutoff = ((allfreq * track) + fr + (envMod * midigain * env)) : min(ma.SR/8);
// VCO
oscillo(f) = (os.sawtooth(f)*(1-wfFade))+(os.square(f)*wfFade);
// VCA
volume = midigain * env;
// Enveloppe
env = en.adsre(att,dec,sust,rel,midigate);
// LFO
LFO = os.lf_triangle(lfoFreq)*modwheel*10;
// SYNTH ////////////////////////////////////////////////
synth = (oscillo(allfreq) :ve.moog_vcf(res,cutoff)) * volume;
// PROCESS /////////////////////////////////////////////
process = synth;
| https://raw.githubusercontent.com/tonal-glyph/faustus/cc887b115aceaee202edbdb37ee0e4087bfb5a33/examples/bela/simpleSynth_Analog.dsp | faust | /////////////////////////////////////////////////////////////////////////////////////////////////
A very simple subtractive synthesizer with 1 VCO 1 VCF.
The VCO Waveform is variable between Saw and Square
The frequency is modulated by an LFO
The envelope control volum and filter frequency
/////////////////////////////////////////////////////////////////////////////////////////////////
ANALOG IMPLEMENTATION:
ANALOG_0 : waveform (Saw to square)
ANALOG_1 : Filter Cutoff frequency
ANALOG_2 : Filter resonance (Q)
ANALOG_3 : Filter Envelope Modulation
MIDI:
CC 79 : Filter keyboard tracking (0 to X2, default 1)
Envelope
CC 73 : Attack
CC 76 : Decay
CC 77 : Sustain
CC 72 : Release
CC 78 : LFO frequency (0.001Hz to 10Hz)
CC 1 : LFO Amplitude (Modulation)
/////////////////////////////////////////////////////////////////////////////////////////////////
HUI //////////////////////////////////////////////////
Keyboard
MIDI KEYBOARD
pitchwheel
VCO
VCF
ENV
LFO
PROCESS /////////////////////////////////////////////
VCF
VCO
VCA
Enveloppe
LFO
SYNTH ////////////////////////////////////////////////
PROCESS ///////////////////////////////////////////// | import("stdfaust.lib");
midigate = button ("gate");
midifreq = nentry("freq[unit:Hz]", 440, 20, 20000, 1);
pitchwheel = hslider("bend [midi:pitchwheel]",1,0.001,10,0.01);
wfFade = hslider("waveform[BELA: ANALOG_0]",0.5,0,1,0.001):si.smoo;
res = hslider("resonnance[BELA: ANALOG_2]",0.5,0,1,0.001):si.smoo;
fr = hslider("fc[BELA: ANALOG_1]", 10, 15, 12000, 0.001):si.smoo;
track = hslider("tracking[midi:ctrl 79]", 1, 0, 2, 0.001);
envMod = hslider("envMod[BELA: ANALOG_3]",50,0,100,0.01):si.smoo;
att = 0.01 * (hslider ("attack[midi:ctrl 73]",0.1,0.1,400,0.001));
dec = 0.01 * (hslider ("decay[midi:ctrl 76]",60,0.1,400,0.001));
sust = hslider ("sustain[midi:ctrl 77]",0.2,0,1,0.001);
rel = 0.01 * (hslider ("release[midi:ctrl 72]",100,0.1,400,0.001));
lfoFreq = hslider ("lfoFreq[midi:ctrl 78]",6,0.001,10,0.001):si.smoo;
modwheel = hslider ("modwheel[midi:ctrl 1]",0,0,0.5,0.001):si.smoo;
allfreq = (midifreq * pitchwheel) + LFO;
cutoff = ((allfreq * track) + fr + (envMod * midigain * env)) : min(ma.SR/8);
oscillo(f) = (os.sawtooth(f)*(1-wfFade))+(os.square(f)*wfFade);
volume = midigain * env;
env = en.adsre(att,dec,sust,rel,midigate);
LFO = os.lf_triangle(lfoFreq)*modwheel*10;
synth = (oscillo(allfreq) :ve.moog_vcf(res,cutoff)) * volume;
process = synth;
|
f7598f02e7756f7dc5f4dd3fd0785497313c12fa24abf370adbb9953b56c54f1 | tonal-glyph/faustus | simpleSynth.dsp | import("stdfaust.lib");
///////////////////////////////////////////////////////////////////////////////////////////////////
//
// A very simple subtractive synthesizer with 1 VCO 1 VCF.
// The VCO Waveform is variable between Saw and Square
// The frequency is modulated by an LFO
// The envelope control volum and filter frequency
//
///////////////////////////////////////////////////////////////////////////////////////////////////
// MIDI IMPLEMENTATION:
//
// CC 70 : waveform (Saw to square)
// CC 71 : Filter resonance (Q)
// CC 74 : Filter Cutoff frequency
// CC 79 : Filter keyboard tracking (0 to X2, default 1)
// CC 75 : Filter Envelope Modulation
//
// Envelope
// CC 73 : Attack
// CC 76 : Decay
// CC 77 : Sustain
// CC 72 : Release
//
// CC 78 : LFO frequency (0.001Hz to 10Hz)
// CC 1 : LFO Amplitude (Modulation)
//
///////////////////////////////////////////////////////////////////////////////////////////////////
//
// HUI //////////////////////////////////////////////////
// Keyboard
midigate = button ("gate");
midifreq = nentry("freq[unit:Hz]", 440, 20, 20000, 1);
midigain = nentry("gain", 0.5, 0, 0.5, 0.01);// MIDI KEYBOARD
// pitchwheel
pitchwheel = hslider("bend [midi:pitchwheel]",1,0.001,10,0.01);
// VCO
wfFade= hslider("waveform[midi:ctrl 70]",0.5,0,1,0.001):si.smoo;
// VCF
res = hslider("resonnance[midi:ctrl 71]",0.5,0,1,0.001):si.smoo;
fr = hslider("fc[midi:ctrl 74]", 10, 15, 12000, 0.001):si.smoo;
track = hslider("tracking[midi:ctrl 79]", 1, 0, 2, 0.001);
envMod = hslider("envMod[midi:ctrl 75]",50,0,100,0.01):si.smoo;
// ENV
att = 0.01 * (hslider ("attack[midi:ctrl 73]",0.1,0.1,400,0.001));
dec = 0.01 * (hslider ("decay[midi:ctrl 76]",60,0.1,400,0.001));
sust = hslider ("sustain[midi:ctrl 77]",0.1,0,1,0.001);
rel = 0.01 * (hslider ("release[midi:ctrl 72]",100,0.1,400,0.001));
// LFO
lfoFreq = hslider("lfoFreq[midi:ctrl 78]",6,0.001,10,0.001):si.smoo;
modwheel = hslider("modwheel[midi:ctrl 1]",0,0,0.5,0.001):si.smoo;
// PROCESS /////////////////////////////////////////////
allfreq = (midifreq * pitchwheel) + LFO;
// VCF
cutoff = ((allfreq * track) + fr + (envMod * midigain * env)) : min(ma.SR/8);
// VCO
oscillo(f) = (os.sawtooth(f)*(1-wfFade))+(os.square(f)*wfFade);
// VCA
volume = midigain * env;
// Enveloppe
env = en.adsre(att,dec,sust,rel,midigate);
// LFO
LFO = os.lf_triangle(lfoFreq)*modwheel*10;
// SYNTH ////////////////////////////////////////////////
synth = (oscillo(allfreq) :ve.moog_vcf(res,cutoff)) * volume;
// PROCESS /////////////////////////////////////////////
process = synth;
| https://raw.githubusercontent.com/tonal-glyph/faustus/cc887b115aceaee202edbdb37ee0e4087bfb5a33/examples/bela/simpleSynth.dsp | faust | /////////////////////////////////////////////////////////////////////////////////////////////////
A very simple subtractive synthesizer with 1 VCO 1 VCF.
The VCO Waveform is variable between Saw and Square
The frequency is modulated by an LFO
The envelope control volum and filter frequency
/////////////////////////////////////////////////////////////////////////////////////////////////
MIDI IMPLEMENTATION:
CC 70 : waveform (Saw to square)
CC 71 : Filter resonance (Q)
CC 74 : Filter Cutoff frequency
CC 79 : Filter keyboard tracking (0 to X2, default 1)
CC 75 : Filter Envelope Modulation
Envelope
CC 73 : Attack
CC 76 : Decay
CC 77 : Sustain
CC 72 : Release
CC 78 : LFO frequency (0.001Hz to 10Hz)
CC 1 : LFO Amplitude (Modulation)
/////////////////////////////////////////////////////////////////////////////////////////////////
HUI //////////////////////////////////////////////////
Keyboard
MIDI KEYBOARD
pitchwheel
VCO
VCF
ENV
LFO
PROCESS /////////////////////////////////////////////
VCF
VCO
VCA
Enveloppe
LFO
SYNTH ////////////////////////////////////////////////
PROCESS ///////////////////////////////////////////// | import("stdfaust.lib");
midigate = button ("gate");
midifreq = nentry("freq[unit:Hz]", 440, 20, 20000, 1);
pitchwheel = hslider("bend [midi:pitchwheel]",1,0.001,10,0.01);
wfFade= hslider("waveform[midi:ctrl 70]",0.5,0,1,0.001):si.smoo;
res = hslider("resonnance[midi:ctrl 71]",0.5,0,1,0.001):si.smoo;
fr = hslider("fc[midi:ctrl 74]", 10, 15, 12000, 0.001):si.smoo;
track = hslider("tracking[midi:ctrl 79]", 1, 0, 2, 0.001);
envMod = hslider("envMod[midi:ctrl 75]",50,0,100,0.01):si.smoo;
att = 0.01 * (hslider ("attack[midi:ctrl 73]",0.1,0.1,400,0.001));
dec = 0.01 * (hslider ("decay[midi:ctrl 76]",60,0.1,400,0.001));
sust = hslider ("sustain[midi:ctrl 77]",0.1,0,1,0.001);
rel = 0.01 * (hslider ("release[midi:ctrl 72]",100,0.1,400,0.001));
lfoFreq = hslider("lfoFreq[midi:ctrl 78]",6,0.001,10,0.001):si.smoo;
modwheel = hslider("modwheel[midi:ctrl 1]",0,0,0.5,0.001):si.smoo;
allfreq = (midifreq * pitchwheel) + LFO;
cutoff = ((allfreq * track) + fr + (envMod * midigain * env)) : min(ma.SR/8);
oscillo(f) = (os.sawtooth(f)*(1-wfFade))+(os.square(f)*wfFade);
volume = midigain * env;
env = en.adsre(att,dec,sust,rel,midigate);
LFO = os.lf_triangle(lfoFreq)*modwheel*10;
synth = (oscillo(allfreq) :ve.moog_vcf(res,cutoff)) * volume;
process = synth;
|
8beaac2b5339f7ffafec5199efc5b01936eb51a8a5e7412f7d9c045d5cdd1e57 | tonal-glyph/faustus | brass.dsp | //############################### brass.dsp ###################################
// Faust instrument specifically designed for `faust2smartkeyb` where a
// trumpet physical model is controlled using some of the built-in sensors of
// the device and the touchscreen. Some of these elements could be replaced by
// external controllers (e.g., breath/mouth piece controller).
//
// ## `SmartKeyboard` Use Strategy
//
// 1 keyboard is used to implement the pistons of the trumpet (3 keys) and the
// other allows to control the lips tension.
//
// ## Compilation Instructions
//
// This Faust code will compile fine with any of the standard Faust targets.
// However it was specifically designed to be used with `faust2smartkeyb`. For
// best results, we recommend to use the following parameters to compile it:
//
// ```
// faust2smartkeyb [-ios/-android] -effect reverb.dsp brass.dsp
// ```
//
// ## Version/Licence
//
// Version 0.0, Aug. 2017
// Copyright Romain Michon CCRMA (Stanford University)/GRAME 2017
// MIT Licence: https://opensource.org/licenses/MIT
//##############################################################################
declare interface "SmartKeyboard{
'Number of Keyboards':'2',
'Max Keyboard Polyphony':'0',
'Keyboard 0 - Number of Keys':'1',
'Keyboard 1 - Number of Keys':'3',
'Keyboard 0 - Send Freq':'0',
'Keyboard 1 - Send Freq':'0',
'Keyboard 0 - Piano Keyboard':'0',
'Keyboard 1 - Piano Keyboard':'0',
'Keyboard 0 - Send Key X':'1',
'Keyboard 1 - Send Key Status':'1',
'Keyboard 0 - Static Mode':'1',
'Keyboard 0 - Key 0 - Label':'Lips Tension',
'Keyboard 1 - Key 0 - Label':'P1',
'Keyboard 1 - Key 1 - Label':'P2',
'Keyboard 1 - Key 2 - Label':'P3'
}";
import("stdfaust.lib");
// SMARTKEYBOARD PARAMS
kb0k0x = hslider("kb0k0x",0,0,1,1);
kb1k0status = hslider("kb1k0status",0,0,1,1) : min(1) : int;
kb1k1status = hslider("kb1k1status",0,0,1,1) : min(1) : int;
kb1k2status = hslider("kb1k2status",0,0,1,1) : min(1) : int;
// MODEL PARAMETERS
// pressure is controlled by accelerometer
pressure = hslider("pressure[acc: 1 1 -10 0 10]",0,0,1,0.01) : si.smoo;
breathGain = 0.005; breathCutoff = 2000;
vibratoFreq = 5; vibratoGain = 0;
//pitch when no pistons are pushed
basePitch = 48; // C4
// calculate pitch shift in function of piston combination
pitchShift =
((kb1k0status == 0) & (kb1k1status == 1) & (kb1k2status == 0))*(1) +
((kb1k0status == 1) & (kb1k1status == 0) & (kb1k2status == 0))*(2) +
((kb1k0status == 1) & (kb1k1status == 1) & (kb1k2status == 0))*(3) +
((kb1k0status == 0) & (kb1k1status == 1) & (kb1k2status == 1))*(4) +
((kb1k0status == 1) & (kb1k1status == 0) & (kb1k2status == 1))*(5) +
((kb1k0status == 1) & (kb1k1status == 1) & (kb1k2status == 1))*(6);
// tube length is calculated based on piston combination
tubeLength = basePitch-pitchShift : ba.midikey2hz : pm.f2l : si.smoo;
// lips tension is controlled using pad on screen
lipsTension = kb0k0x : si.smoo;
// default mute value
mute = 0.5;
// ASSEMBLING MODEL
model =
pm.blower(pressure,breathGain,breathCutoff,vibratoFreq,vibratoGain) :
pm.brassModel(tubeLength,lipsTension,mute);
process = model <: _,_;
| https://raw.githubusercontent.com/tonal-glyph/faustus/cc887b115aceaee202edbdb37ee0e4087bfb5a33/examples/smartKeyboard/brass.dsp | faust | ############################### brass.dsp ###################################
Faust instrument specifically designed for `faust2smartkeyb` where a
trumpet physical model is controlled using some of the built-in sensors of
the device and the touchscreen. Some of these elements could be replaced by
external controllers (e.g., breath/mouth piece controller).
## `SmartKeyboard` Use Strategy
1 keyboard is used to implement the pistons of the trumpet (3 keys) and the
other allows to control the lips tension.
## Compilation Instructions
This Faust code will compile fine with any of the standard Faust targets.
However it was specifically designed to be used with `faust2smartkeyb`. For
best results, we recommend to use the following parameters to compile it:
```
faust2smartkeyb [-ios/-android] -effect reverb.dsp brass.dsp
```
## Version/Licence
Version 0.0, Aug. 2017
Copyright Romain Michon CCRMA (Stanford University)/GRAME 2017
MIT Licence: https://opensource.org/licenses/MIT
##############################################################################
SMARTKEYBOARD PARAMS
MODEL PARAMETERS
pressure is controlled by accelerometer
pitch when no pistons are pushed
C4
calculate pitch shift in function of piston combination
tube length is calculated based on piston combination
lips tension is controlled using pad on screen
default mute value
ASSEMBLING MODEL |
declare interface "SmartKeyboard{
'Number of Keyboards':'2',
'Max Keyboard Polyphony':'0',
'Keyboard 0 - Number of Keys':'1',
'Keyboard 1 - Number of Keys':'3',
'Keyboard 0 - Send Freq':'0',
'Keyboard 1 - Send Freq':'0',
'Keyboard 0 - Piano Keyboard':'0',
'Keyboard 1 - Piano Keyboard':'0',
'Keyboard 0 - Send Key X':'1',
'Keyboard 1 - Send Key Status':'1',
'Keyboard 0 - Static Mode':'1',
'Keyboard 0 - Key 0 - Label':'Lips Tension',
'Keyboard 1 - Key 0 - Label':'P1',
'Keyboard 1 - Key 1 - Label':'P2',
'Keyboard 1 - Key 2 - Label':'P3'
}";
import("stdfaust.lib");
kb0k0x = hslider("kb0k0x",0,0,1,1);
kb1k0status = hslider("kb1k0status",0,0,1,1) : min(1) : int;
kb1k1status = hslider("kb1k1status",0,0,1,1) : min(1) : int;
kb1k2status = hslider("kb1k2status",0,0,1,1) : min(1) : int;
pressure = hslider("pressure[acc: 1 1 -10 0 10]",0,0,1,0.01) : si.smoo;
breathGain = 0.005; breathCutoff = 2000;
vibratoFreq = 5; vibratoGain = 0;
pitchShift =
((kb1k0status == 0) & (kb1k1status == 1) & (kb1k2status == 0))*(1) +
((kb1k0status == 1) & (kb1k1status == 0) & (kb1k2status == 0))*(2) +
((kb1k0status == 1) & (kb1k1status == 1) & (kb1k2status == 0))*(3) +
((kb1k0status == 0) & (kb1k1status == 1) & (kb1k2status == 1))*(4) +
((kb1k0status == 1) & (kb1k1status == 0) & (kb1k2status == 1))*(5) +
((kb1k0status == 1) & (kb1k1status == 1) & (kb1k2status == 1))*(6);
tubeLength = basePitch-pitchShift : ba.midikey2hz : pm.f2l : si.smoo;
lipsTension = kb0k0x : si.smoo;
mute = 0.5;
model =
pm.blower(pressure,breathGain,breathCutoff,vibratoFreq,vibratoGain) :
pm.brassModel(tubeLength,lipsTension,mute);
process = model <: _,_;
|
94962bf7278a24ff20cbed20b808771c89b2e89f1a79bd170561bd267dbd20aa | tonal-glyph/faustus | dubDub.dsp | //################################### dubDub.dsp #####################################
// A simple smartphone abstract instrument than can be controlled using the touch
// screen and the accelerometers of the device.
//
// ## `SmartKeyboard` Use Strategy
//
// The idea here is to use the `SmartKeyboard` interface as an X/Y control pad by just
// creating one keyboard with on key and by retrieving the X and Y position on that single
// key using the `x` and `y` standard parameters. Keyboard mode is deactivated so that
// the color of the pad doesn't change when it is pressed.
//
// ## Compilation Instructions
//
// This Faust code will compile fine with any of the standard Faust targets. However
// it was specifically designed to be used with `faust2smartkeyb`. For best results,
// we recommend to use the following parameters to compile it:
//
// ```
// faust2smartkeyb [-ios/-android] dubDub.dsp
// ```
//
// ## Version/Licence
//
// Version 0.0, Feb. 2017
// Copyright Romain Michon CCRMA (Stanford University)/GRAME 2017
// MIT Licence: https://opensource.org/licenses/MIT
//########################################################################################
declare name "dubDub";
import("stdfaust.lib");
//========================= Smart Keyboard Configuration =================================
// (1 keyboards with 1 key configured as a pad.
//========================================================================================
declare interface "SmartKeyboard{
'Number of Keyboards':'1',
'Keyboard 0 - Number of Keys':'1',
'Keyboard 0 - Piano Keyboard':'0',
'Keyboard 0 - Static Mode':'1',
'Keyboard 0 - Send X':'1',
'Keyboard 0 - Send Y':'1'
}";
//================================ Instrument Parameters =================================
// Creates the connection between the synth and the mobile device
//========================================================================================
// SmartKeyboard X parameter
x = hslider("x",0,0,1,0.01);
// SmartKeyboard Y parameter
y = hslider("y",0,0,1,0.01);
// SmartKeyboard gate parameter
gate = button("gate");
// modulation frequency is controlled with the x axis of the accelerometer
modFreq = hslider("modFeq[acc: 0 0 -10 0 10]",9,0.5,18,0.01);
// general gain is controlled with the y axis of the accelerometer
gain = hslider("gain[acc: 1 0 -10 0 10]",0.5,0,1,0.01);
//=================================== Parameters Mapping =================================
//========================================================================================
// sawtooth frequency
minFreq = 80;
maxFreq = 500;
freq = x*(maxFreq-minFreq) + minFreq : si.polySmooth(gate,0.999,1);
// filter q
q = 8;
// filter cutoff frequency is modulate with a triangle wave
minFilterCutoff = 50;
maxFilterCutoff = 5000;
filterModFreq = modFreq : si.smoo;
filterCutoff = (1-os.lf_trianglepos(modFreq)*(1-y))*(maxFilterCutoff-minFilterCutoff)+minFilterCutoff;
// general gain of the synth
generalGain = gain : ba.lin2LogGain : si.smoo;
//============================================ DSP =======================================
//========================================================================================
process = sy.dubDub(freq,filterCutoff,q,gate)*generalGain <: _,_;
| https://raw.githubusercontent.com/tonal-glyph/faustus/cc887b115aceaee202edbdb37ee0e4087bfb5a33/examples/smartKeyboard/dubDub.dsp | faust | ################################### dubDub.dsp #####################################
A simple smartphone abstract instrument than can be controlled using the touch
screen and the accelerometers of the device.
## `SmartKeyboard` Use Strategy
The idea here is to use the `SmartKeyboard` interface as an X/Y control pad by just
creating one keyboard with on key and by retrieving the X and Y position on that single
key using the `x` and `y` standard parameters. Keyboard mode is deactivated so that
the color of the pad doesn't change when it is pressed.
## Compilation Instructions
This Faust code will compile fine with any of the standard Faust targets. However
it was specifically designed to be used with `faust2smartkeyb`. For best results,
we recommend to use the following parameters to compile it:
```
faust2smartkeyb [-ios/-android] dubDub.dsp
```
## Version/Licence
Version 0.0, Feb. 2017
Copyright Romain Michon CCRMA (Stanford University)/GRAME 2017
MIT Licence: https://opensource.org/licenses/MIT
########################################################################################
========================= Smart Keyboard Configuration =================================
(1 keyboards with 1 key configured as a pad.
========================================================================================
================================ Instrument Parameters =================================
Creates the connection between the synth and the mobile device
========================================================================================
SmartKeyboard X parameter
SmartKeyboard Y parameter
SmartKeyboard gate parameter
modulation frequency is controlled with the x axis of the accelerometer
general gain is controlled with the y axis of the accelerometer
=================================== Parameters Mapping =================================
========================================================================================
sawtooth frequency
filter q
filter cutoff frequency is modulate with a triangle wave
general gain of the synth
============================================ DSP =======================================
======================================================================================== |
declare name "dubDub";
import("stdfaust.lib");
declare interface "SmartKeyboard{
'Number of Keyboards':'1',
'Keyboard 0 - Number of Keys':'1',
'Keyboard 0 - Piano Keyboard':'0',
'Keyboard 0 - Static Mode':'1',
'Keyboard 0 - Send X':'1',
'Keyboard 0 - Send Y':'1'
}";
x = hslider("x",0,0,1,0.01);
y = hslider("y",0,0,1,0.01);
gate = button("gate");
modFreq = hslider("modFeq[acc: 0 0 -10 0 10]",9,0.5,18,0.01);
gain = hslider("gain[acc: 1 0 -10 0 10]",0.5,0,1,0.01);
minFreq = 80;
maxFreq = 500;
freq = x*(maxFreq-minFreq) + minFreq : si.polySmooth(gate,0.999,1);
q = 8;
minFilterCutoff = 50;
maxFilterCutoff = 5000;
filterModFreq = modFreq : si.smoo;
filterCutoff = (1-os.lf_trianglepos(modFreq)*(1-y))*(maxFilterCutoff-minFilterCutoff)+minFilterCutoff;
generalGain = gain : ba.lin2LogGain : si.smoo;
process = sy.dubDub(freq,filterCutoff,q,gate)*generalGain <: _,_;
|
72e9f0846eb334a252d88f520eb85bfb76c985de9af15384f742e396aace28c0 | tonal-glyph/faustus | elecGuitar.dsp | //################################### elecGuitar.dsp #####################################
// Faust instruments specifically designed for `faust2smartkeyb` where an electric
// guitar physical model is controlled using an isomorphic keyboard. Rock on!
//
// ## `SmartKeyboard` Use Strategy
//
// we want to create an isomorphic keyboard where each keyboard is monophonic and
// implements a "string". Keyboards should be one fourth apart from each other
// (more or less like on a guitar). We want to be able to slide between keyboards
// (strum) to trigger a new note (voice) and we want new fingers on a keyboard to
// "steal" the pitch from the previous finger (sort of hammer on).
//
// ## Compilation Instructions
//
// This Faust code will compile fine with any of the standard Faust targets. However
// it was specifically designed to be used with `faust2smartkeyb`. For best results,
// we recommend to use the following parameters to compile it:
//
// ```
// faust2smartkeyb [-ios/-android] -effect elecGuitarEffecr.dsp elecGuitar.dsp
// ```
//
// ## Version/Licence
//
// Version 0.0, Feb. 2017
// Copyright Romain Michon CCRMA (Stanford University)/GRAME 2017:
// https://ccrma.stanford.edu/~rmichon
// MIT Licence: https://opensource.org/licenses/MIT
//########################################################################################
// Interface with 6 monophonic keyboards one fourth apart from each other
declare interface "SmartKeyboard{
'Number of Keyboards':'6',
'Max Keyboard Polyphony':'1',
'Keyboard 0 - Number of Keys':'13',
'Keyboard 1 - Number of Keys':'13',
'Keyboard 2 - Number of Keys':'13',
'Keyboard 3 - Number of Keys':'13',
'Keyboard 4 - Number of Keys':'13',
'Keyboard 5 - Number of Keys':'13',
'Keyboard 0 - Lowest Key':'72',
'Keyboard 1 - Lowest Key':'67',
'Keyboard 2 - Lowest Key':'62',
'Keyboard 3 - Lowest Key':'57',
'Keyboard 4 - Lowest Key':'52',
'Keyboard 5 - Lowest Key':'47',
'Rounding Mode':'2'
}";
import("stdfaust.lib");
// standard parameters
f = hslider("freq",300,50,2000,0.01);
bend = hslider("bend[midi:pitchwheel]",1,0,10,0.01) : si.polySmooth(gate,0.999,1);
gain = hslider("gain",1,0,1,0.01);
s = hslider("sustain[midi:ctrl 64]",0,0,1,1); // for sustain pedal
t = button("gate");
// mapping params
gate = t+s : min(1);
freq = f*bend : max(60); // min freq is 60 Hz
stringLength = freq : pm.f2l;
pluckPosition = 0.8;
mute = gate : si.polySmooth(gate,0.999,1);
process = pm.elecGuitar(stringLength,pluckPosition,mute,gain,gate) <: _,_;
| https://raw.githubusercontent.com/tonal-glyph/faustus/cc887b115aceaee202edbdb37ee0e4087bfb5a33/examples/smartKeyboard/elecGuitar.dsp | faust | ################################### elecGuitar.dsp #####################################
Faust instruments specifically designed for `faust2smartkeyb` where an electric
guitar physical model is controlled using an isomorphic keyboard. Rock on!
## `SmartKeyboard` Use Strategy
we want to create an isomorphic keyboard where each keyboard is monophonic and
implements a "string". Keyboards should be one fourth apart from each other
(more or less like on a guitar). We want to be able to slide between keyboards
(strum) to trigger a new note (voice) and we want new fingers on a keyboard to
"steal" the pitch from the previous finger (sort of hammer on).
## Compilation Instructions
This Faust code will compile fine with any of the standard Faust targets. However
it was specifically designed to be used with `faust2smartkeyb`. For best results,
we recommend to use the following parameters to compile it:
```
faust2smartkeyb [-ios/-android] -effect elecGuitarEffecr.dsp elecGuitar.dsp
```
## Version/Licence
Version 0.0, Feb. 2017
Copyright Romain Michon CCRMA (Stanford University)/GRAME 2017:
https://ccrma.stanford.edu/~rmichon
MIT Licence: https://opensource.org/licenses/MIT
########################################################################################
Interface with 6 monophonic keyboards one fourth apart from each other
standard parameters
for sustain pedal
mapping params
min freq is 60 Hz |
declare interface "SmartKeyboard{
'Number of Keyboards':'6',
'Max Keyboard Polyphony':'1',
'Keyboard 0 - Number of Keys':'13',
'Keyboard 1 - Number of Keys':'13',
'Keyboard 2 - Number of Keys':'13',
'Keyboard 3 - Number of Keys':'13',
'Keyboard 4 - Number of Keys':'13',
'Keyboard 5 - Number of Keys':'13',
'Keyboard 0 - Lowest Key':'72',
'Keyboard 1 - Lowest Key':'67',
'Keyboard 2 - Lowest Key':'62',
'Keyboard 3 - Lowest Key':'57',
'Keyboard 4 - Lowest Key':'52',
'Keyboard 5 - Lowest Key':'47',
'Rounding Mode':'2'
}";
import("stdfaust.lib");
f = hslider("freq",300,50,2000,0.01);
bend = hslider("bend[midi:pitchwheel]",1,0,10,0.01) : si.polySmooth(gate,0.999,1);
gain = hslider("gain",1,0,1,0.01);
t = button("gate");
gate = t+s : min(1);
stringLength = freq : pm.f2l;
pluckPosition = 0.8;
mute = gate : si.polySmooth(gate,0.999,1);
process = pm.elecGuitar(stringLength,pluckPosition,mute,gain,gate) <: _,_;
|
66300b88780f6e77eab7bded83c74a533f20ea44f605c6dad08eeb5d1eec6978 | tonal-glyph/faustus | violin2.dsp | //############################### violin2.dsp ##################################
// Faust instrument specifically designed for `faust2smartkeyb` where a
// complete violin physical model can be played using the touch sceen
// interface. Bowing is carried out by constantly moving a finger on the
// y axis of a key.
//
// ## `SmartKeyboard` Use Strategy
//
// 4 keyboards are used to control the pitch of the 4 bowed strings. Strings
// are connected to the virtual bow when they are touched.
//
// ## Compilation Instructions
//
// This Faust code will compile fine with any of the standard Faust targets.
// However it was specifically designed to be used with `faust2smartkeyb`. For
// best results, we recommend to use the following parameters to compile it:
//
// ```
// faust2smartkeyb [-ios/-android] -effect reverb.dsp violin.dsp
// ```
//
// ## Version/Licence
//
// Version 0.0, Aug. 2017
// Copyright Romain Michon CCRMA (Stanford University)/GRAME 2017
// MIT Licence: https://opensource.org/licenses/MIT
//##############################################################################
declare interface "SmartKeyboard{
'Number of Keyboards':'4',
'Max Keyboard Polyphony':'0',
'Rounding Mode':'2',
'Send Fingers Count':'1',
'Keyboard 0 - Number of Keys':'12',
'Keyboard 1 - Number of Keys':'12',
'Keyboard 2 - Number of Keys':'12',
'Keyboard 3 - Number of Keys':'12',
'Keyboard 0 - Lowest Key':'55',
'Keyboard 1 - Lowest Key':'62',
'Keyboard 2 - Lowest Key':'69',
'Keyboard 3 - Lowest Key':'76',
'Keyboard 0 - Send Keyboard Freq':'1',
'Keyboard 1 - Send Keyboard Freq':'1',
'Keyboard 2 - Send Keyboard Freq':'1',
'Keyboard 3 - Send Keyboard Freq':'1',
'Keyboard 0 - Send Y':'1',
'Keyboard 1 - Send Y':'1',
'Keyboard 2 - Send Y':'1',
'Keyboard 3 - Send Y':'1'
}";
import("stdfaust.lib");
// SMARTKEYBOARD PARAMS
kbfreq(0) = hslider("kb0freq",220,20,10000,0.01);
kbbend(0) = hslider("kb0bend",1,0,10,0.01);
kbfreq(1) = hslider("kb1freq",330,20,10000,0.01);
kbbend(1) = hslider("kb1bend",1,0,10,0.01);
kbfreq(2) = hslider("kb2freq",440,20,10000,0.01);
kbbend(2) = hslider("kb2bend",1,0,10,0.01);
kbfreq(3) = hslider("kb3freq",550,20,10000,0.01);
kbbend(3) = hslider("kb3bend",1,0,10,0.01);
kbfingers(0) = hslider("kb0fingers",0,0,10,1) : int;
kbfingers(1) = hslider("kb1fingers",0,0,10,1) : int;
kbfingers(2) = hslider("kb2fingers",0,0,10,1) : int;
kbfingers(3) = hslider("kb3fingers",0,0,10,1) : int;
y = hslider("y",0,0,1,1) : si.smoo;
// MODEL PARAMETERS
// strings lengths
sl(i) = kbfreq(i)*kbbend(i) : pm.f2l : si.smoo;
// string active only if fingers are touching the keyboard
as(i) = kbfingers(i)>0;
// retrieving finger displacement on screen (dirt simple)
bowVel = y-y' : abs : *(3000) : min(1) : si.smoo;
// bow position is constant but could be ontrolled by an external interface
bowPos = 0.7;
bowPress = 0.5;
// ASSEMBLING MODELS
// essentially 4 parallel violin strings
model = par(i,4,pm.violinModel(sl(i),bowPress,bowVel*as(i),bowPos)) :> _;
process = model <: _,_;
| https://raw.githubusercontent.com/tonal-glyph/faustus/cc887b115aceaee202edbdb37ee0e4087bfb5a33/examples/smartKeyboard/violin2.dsp | faust | ############################### violin2.dsp ##################################
Faust instrument specifically designed for `faust2smartkeyb` where a
complete violin physical model can be played using the touch sceen
interface. Bowing is carried out by constantly moving a finger on the
y axis of a key.
## `SmartKeyboard` Use Strategy
4 keyboards are used to control the pitch of the 4 bowed strings. Strings
are connected to the virtual bow when they are touched.
## Compilation Instructions
This Faust code will compile fine with any of the standard Faust targets.
However it was specifically designed to be used with `faust2smartkeyb`. For
best results, we recommend to use the following parameters to compile it:
```
faust2smartkeyb [-ios/-android] -effect reverb.dsp violin.dsp
```
## Version/Licence
Version 0.0, Aug. 2017
Copyright Romain Michon CCRMA (Stanford University)/GRAME 2017
MIT Licence: https://opensource.org/licenses/MIT
##############################################################################
SMARTKEYBOARD PARAMS
MODEL PARAMETERS
strings lengths
string active only if fingers are touching the keyboard
retrieving finger displacement on screen (dirt simple)
bow position is constant but could be ontrolled by an external interface
ASSEMBLING MODELS
essentially 4 parallel violin strings |
declare interface "SmartKeyboard{
'Number of Keyboards':'4',
'Max Keyboard Polyphony':'0',
'Rounding Mode':'2',
'Send Fingers Count':'1',
'Keyboard 0 - Number of Keys':'12',
'Keyboard 1 - Number of Keys':'12',
'Keyboard 2 - Number of Keys':'12',
'Keyboard 3 - Number of Keys':'12',
'Keyboard 0 - Lowest Key':'55',
'Keyboard 1 - Lowest Key':'62',
'Keyboard 2 - Lowest Key':'69',
'Keyboard 3 - Lowest Key':'76',
'Keyboard 0 - Send Keyboard Freq':'1',
'Keyboard 1 - Send Keyboard Freq':'1',
'Keyboard 2 - Send Keyboard Freq':'1',
'Keyboard 3 - Send Keyboard Freq':'1',
'Keyboard 0 - Send Y':'1',
'Keyboard 1 - Send Y':'1',
'Keyboard 2 - Send Y':'1',
'Keyboard 3 - Send Y':'1'
}";
import("stdfaust.lib");
kbfreq(0) = hslider("kb0freq",220,20,10000,0.01);
kbbend(0) = hslider("kb0bend",1,0,10,0.01);
kbfreq(1) = hslider("kb1freq",330,20,10000,0.01);
kbbend(1) = hslider("kb1bend",1,0,10,0.01);
kbfreq(2) = hslider("kb2freq",440,20,10000,0.01);
kbbend(2) = hslider("kb2bend",1,0,10,0.01);
kbfreq(3) = hslider("kb3freq",550,20,10000,0.01);
kbbend(3) = hslider("kb3bend",1,0,10,0.01);
kbfingers(0) = hslider("kb0fingers",0,0,10,1) : int;
kbfingers(1) = hslider("kb1fingers",0,0,10,1) : int;
kbfingers(2) = hslider("kb2fingers",0,0,10,1) : int;
kbfingers(3) = hslider("kb3fingers",0,0,10,1) : int;
y = hslider("y",0,0,1,1) : si.smoo;
sl(i) = kbfreq(i)*kbbend(i) : pm.f2l : si.smoo;
as(i) = kbfingers(i)>0;
bowVel = y-y' : abs : *(3000) : min(1) : si.smoo;
bowPos = 0.7;
bowPress = 0.5;
model = par(i,4,pm.violinModel(sl(i),bowPress,bowVel*as(i),bowPos)) :> _;
process = model <: _,_;
|
b6923d5bfddc8dc928540f9ff5c5ac84c22075894ee853a8ef387f428ddfdc1e | tonal-glyph/faustus | bells.dsp | //################################ bells.dsp ###################################
// Faust instrument specifically designed for `faust2smartkeyb` where the
// physical models of 4 different bells can be played using screen pads. The
// models are taken from `physmodels.lib`.
//
// ## `SmartKeyboard` Use Strategy
//
// The `SmartKeyboard` interface is used to implement percussion pads where
// the X/Y position of fingers is retrieved to control the strike position on
// the bells.
//
// ## Compilation Instructions
//
// This Faust code will compile fine with any of the standard Faust targets.
// However it was specifically designed to be used with `faust2smartkeyb`. For
// best results, we recommend to use the following parameters to compile it:
//
// ```
// faust2smartkeyb [-ios/-android] -effect reverb.dsp bells.dsp
// ```
//
// ## Version/Licence
//
// Version 0.0, Aug. 2017
// Copyright Romain Michon CCRMA (Stanford University)/GRAME 2017
// MIT Licence: https://opensource.org/licenses/MIT
//##############################################################################
declare interface "SmartKeyboard{
'Number of Keyboards':'2',
'Max Keyboard Polyphony':'0',
'Keyboard 0 - Number of Keys':'2',
'Keyboard 1 - Number of Keys':'2',
'Keyboard 0 - Send Freq':'0',
'Keyboard 1 - Send Freq':'0',
'Keyboard 0 - Piano Keyboard':'0',
'Keyboard 1 - Piano Keyboard':'0',
'Keyboard 0 - Send Key Status':'1',
'Keyboard 1 - Send Key Status':'1',
'Keyboard 0 - Send X':'1',
'Keyboard 0 - Send Y':'1',
'Keyboard 1 - Send X':'1',
'Keyboard 1 - Send Y':'1',
'Keyboard 0 - Key 0 - Label':'English Bell',
'Keyboard 0 - Key 1 - Label':'French Bell',
'Keyboard 1 - Key 0 - Label':'German Bell',
'Keyboard 1 - Key 1 - Label':'Russian Bell'
}";
import("stdfaust.lib");
// SMARTKEYBOARD PARAMS
kb0k0status = hslider("kb0k0status",0,0,1,1) : min(1) : int;
kb0k1status = hslider("kb0k1status",0,0,1,1) : min(1) : int;
kb1k0status = hslider("kb1k0status",0,0,1,1) : min(1) : int;
kb1k1status = hslider("kb1k1status",0,0,1,1) : min(1) : int;
x = hslider("x",1,0,1,0.001);
y = hslider("y",1,0,1,0.001);
// MODEL PARAMETERS
strikeCutoff = 6500;
strikeSharpness = 0.5;
strikeGain = 1;
// synthesize 10 modes out of 50
nModes = 10;
// resonance duration is 30s
t60 = 30;
// number of excitation pos (retrieved from model)
nExPos = 7;
// computing excitation position from X and Y
exPos = min((x*2-1 : abs),(y*2-1 : abs))*(nExPos-1) : int;
// ASSEMBLING MODELS
bells =
(kb0k0status : pm.strikeModel(10,strikeCutoff,strikeSharpness,strikeGain) : pm.englishBellModel(nModes,exPos,t60,1,3)) +
(kb0k1status : pm.strikeModel(10,strikeCutoff,strikeSharpness,strikeGain) : pm.frenchBellModel(nModes,exPos,t60,1,3)) +
(kb1k0status : pm.strikeModel(10,strikeCutoff,strikeSharpness,strikeGain) : pm.germanBellModel(nModes,exPos,t60,1,2.5)) +
(kb1k1status : pm.strikeModel(10,strikeCutoff,strikeSharpness,strikeGain) : pm.russianBellModel(nModes,exPos,t60,1,3)) :> *(0.2);
process = bells <: _,_;
| https://raw.githubusercontent.com/tonal-glyph/faustus/cc887b115aceaee202edbdb37ee0e4087bfb5a33/examples/smartKeyboard/bells.dsp | faust | ################################ bells.dsp ###################################
Faust instrument specifically designed for `faust2smartkeyb` where the
physical models of 4 different bells can be played using screen pads. The
models are taken from `physmodels.lib`.
## `SmartKeyboard` Use Strategy
The `SmartKeyboard` interface is used to implement percussion pads where
the X/Y position of fingers is retrieved to control the strike position on
the bells.
## Compilation Instructions
This Faust code will compile fine with any of the standard Faust targets.
However it was specifically designed to be used with `faust2smartkeyb`. For
best results, we recommend to use the following parameters to compile it:
```
faust2smartkeyb [-ios/-android] -effect reverb.dsp bells.dsp
```
## Version/Licence
Version 0.0, Aug. 2017
Copyright Romain Michon CCRMA (Stanford University)/GRAME 2017
MIT Licence: https://opensource.org/licenses/MIT
##############################################################################
SMARTKEYBOARD PARAMS
MODEL PARAMETERS
synthesize 10 modes out of 50
resonance duration is 30s
number of excitation pos (retrieved from model)
computing excitation position from X and Y
ASSEMBLING MODELS |
declare interface "SmartKeyboard{
'Number of Keyboards':'2',
'Max Keyboard Polyphony':'0',
'Keyboard 0 - Number of Keys':'2',
'Keyboard 1 - Number of Keys':'2',
'Keyboard 0 - Send Freq':'0',
'Keyboard 1 - Send Freq':'0',
'Keyboard 0 - Piano Keyboard':'0',
'Keyboard 1 - Piano Keyboard':'0',
'Keyboard 0 - Send Key Status':'1',
'Keyboard 1 - Send Key Status':'1',
'Keyboard 0 - Send X':'1',
'Keyboard 0 - Send Y':'1',
'Keyboard 1 - Send X':'1',
'Keyboard 1 - Send Y':'1',
'Keyboard 0 - Key 0 - Label':'English Bell',
'Keyboard 0 - Key 1 - Label':'French Bell',
'Keyboard 1 - Key 0 - Label':'German Bell',
'Keyboard 1 - Key 1 - Label':'Russian Bell'
}";
import("stdfaust.lib");
kb0k0status = hslider("kb0k0status",0,0,1,1) : min(1) : int;
kb0k1status = hslider("kb0k1status",0,0,1,1) : min(1) : int;
kb1k0status = hslider("kb1k0status",0,0,1,1) : min(1) : int;
kb1k1status = hslider("kb1k1status",0,0,1,1) : min(1) : int;
x = hslider("x",1,0,1,0.001);
y = hslider("y",1,0,1,0.001);
strikeCutoff = 6500;
strikeSharpness = 0.5;
strikeGain = 1;
nModes = 10;
t60 = 30;
nExPos = 7;
exPos = min((x*2-1 : abs),(y*2-1 : abs))*(nExPos-1) : int;
bells =
(kb0k0status : pm.strikeModel(10,strikeCutoff,strikeSharpness,strikeGain) : pm.englishBellModel(nModes,exPos,t60,1,3)) +
(kb0k1status : pm.strikeModel(10,strikeCutoff,strikeSharpness,strikeGain) : pm.frenchBellModel(nModes,exPos,t60,1,3)) +
(kb1k0status : pm.strikeModel(10,strikeCutoff,strikeSharpness,strikeGain) : pm.germanBellModel(nModes,exPos,t60,1,2.5)) +
(kb1k1status : pm.strikeModel(10,strikeCutoff,strikeSharpness,strikeGain) : pm.russianBellModel(nModes,exPos,t60,1,3)) :> *(0.2);
process = bells <: _,_;
|
744315e4bb41911813206516f4408e4d4bc69b9843301740e1b2df36f76b6429 | tonal-glyph/faustus | toy.dsp | //##################################### toy.dsp #######################################
// Faust sound toy specifically designed for `faust2smartkeyb` where a funny
// synth can be controlled using several fingers on the screen and the built-in
// accelerometer.
//
// ## `SmartKeyboard` Use Strategy
//
// We just want a blank screen where the position of the different fingers on
// the screen can be tracked and retrieved in the Faust object. For that, we
// create one keyboard with one key, that should fill the screen. We ask the
// interface to not compute the `freq` and `bend` parameters to save
// computation by setting `'Keyboard 0 - Send Freq':'0'`. We don't want the
// color of the key to change when it is touched so we deactivate the
// `Piano Keyboard` mode. Fingers should be numbered to be able to use the
// numbered `x` and `y` parameters (`x0`, `y0`, `x1`, etc.), so `Count Fingers`
// is enabled. Finally, by setting `Max Keyboard Polyphony` to 0, we deactivate
// the voice allocation system and we automatically start a voice when the app
// is launched. This means that fingers are no longer associated to specific voices.
//
// ## Compilation Instructions
//
// This Faust code will compile fine with any of the standard Faust targets. However
// it was specifically designed to be used with `faust2smartkeyb`. For best results,
// we recommend to use the following parameters to compile it:
//
// ```
// faust2smartkeyb [-ios/-android] toy.dsp
// ```
//
// ## Version/Licence
//
// Version 0.0, Feb. 2017
// Copyright Romain Michon CCRMA (Stanford University)/GRAME 2017:
// https://ccrma.stanford.edu/~rmichon
// MIT Licence: https://opensource.org/licenses/MIT
//########################################################################################
// X/Y interface: one keyboard with one key
// freq and bend are not computed
// fingers are counted
// voice is launched on startup
declare interface "SmartKeyboard{
'Number of Keyboards':'1',
'Max Keyboard Polyphony':'0',
'Keyboard 0 - Number of Keys':'1',
'Keyboard 0 - Send Freq':'0',
'Keyboard 0 - Static Mode':'1',
'Keyboard 0 - Piano Keyboard':'0',
'Keyboard 0 - Send Numbered X':'1',
'Keyboard 0 - Send Numbered Y':'1'
}";
import("stdfaust.lib");
// parameters
x0 = hslider("x0",0.5,0,1,0.01) : si.smoo;
y0 = hslider("y0",0.5,0,1,0.01) : si.smoo;
y1 = hslider("y1",0,0,1,0.01) : si.smoo;
q = hslider("q[acc: 0 0 -10 0 10]",30,10,50,0.01) : si.smoo;
del = hslider("del[acc: 0 0 -10 0 10]",0.5,0.01,1,0.01) : si.smoo;
fb = hslider("fb[acc: 1 0 -10 0 10]",0.5,0,1,0.01) : si.smoo;
// mapping
impFreq = 2 + x0*20;
resFreq = y0*3000+300;
// simple echo effect
echo = +~(de.delay(65536,del*ma.SR)*fb);
// putting it together
process = os.lf_imptrain(impFreq) : fi.resonlp(resFreq,q,1) : echo : ef.cubicnl(y1,0)*0.95 <: _,_;
| https://raw.githubusercontent.com/tonal-glyph/faustus/cc887b115aceaee202edbdb37ee0e4087bfb5a33/examples/smartKeyboard/toy.dsp | faust | ##################################### toy.dsp #######################################
Faust sound toy specifically designed for `faust2smartkeyb` where a funny
synth can be controlled using several fingers on the screen and the built-in
accelerometer.
## `SmartKeyboard` Use Strategy
We just want a blank screen where the position of the different fingers on
the screen can be tracked and retrieved in the Faust object. For that, we
create one keyboard with one key, that should fill the screen. We ask the
interface to not compute the `freq` and `bend` parameters to save
computation by setting `'Keyboard 0 - Send Freq':'0'`. We don't want the
color of the key to change when it is touched so we deactivate the
`Piano Keyboard` mode. Fingers should be numbered to be able to use the
numbered `x` and `y` parameters (`x0`, `y0`, `x1`, etc.), so `Count Fingers`
is enabled. Finally, by setting `Max Keyboard Polyphony` to 0, we deactivate
the voice allocation system and we automatically start a voice when the app
is launched. This means that fingers are no longer associated to specific voices.
## Compilation Instructions
This Faust code will compile fine with any of the standard Faust targets. However
it was specifically designed to be used with `faust2smartkeyb`. For best results,
we recommend to use the following parameters to compile it:
```
faust2smartkeyb [-ios/-android] toy.dsp
```
## Version/Licence
Version 0.0, Feb. 2017
Copyright Romain Michon CCRMA (Stanford University)/GRAME 2017:
https://ccrma.stanford.edu/~rmichon
MIT Licence: https://opensource.org/licenses/MIT
########################################################################################
X/Y interface: one keyboard with one key
freq and bend are not computed
fingers are counted
voice is launched on startup
parameters
mapping
simple echo effect
putting it together |
declare interface "SmartKeyboard{
'Number of Keyboards':'1',
'Max Keyboard Polyphony':'0',
'Keyboard 0 - Number of Keys':'1',
'Keyboard 0 - Send Freq':'0',
'Keyboard 0 - Static Mode':'1',
'Keyboard 0 - Piano Keyboard':'0',
'Keyboard 0 - Send Numbered X':'1',
'Keyboard 0 - Send Numbered Y':'1'
}";
import("stdfaust.lib");
x0 = hslider("x0",0.5,0,1,0.01) : si.smoo;
y0 = hslider("y0",0.5,0,1,0.01) : si.smoo;
y1 = hslider("y1",0,0,1,0.01) : si.smoo;
q = hslider("q[acc: 0 0 -10 0 10]",30,10,50,0.01) : si.smoo;
del = hslider("del[acc: 0 0 -10 0 10]",0.5,0.01,1,0.01) : si.smoo;
fb = hslider("fb[acc: 1 0 -10 0 10]",0.5,0,1,0.01) : si.smoo;
impFreq = 2 + x0*20;
resFreq = y0*3000+300;
echo = +~(de.delay(65536,del*ma.SR)*fb);
process = os.lf_imptrain(impFreq) : fi.resonlp(resFreq,q,1) : echo : ef.cubicnl(y1,0)*0.95 <: _,_;
|
94e053f65be40718d58333e616022bab07e7d87f1a8ae065510f5b9977885c2f | tonal-glyph/faustus | bowed.dsp | //##################################### bowed.dsp ########################################
// Faust instrument specifically designed for `faust2smartkeyb` implementing a
// non-polyphonic synthesizer (e.g., physical model; etc.) using a combination of
// different types of UI elements.
//
// ## `SmartKeyboard` Use Strategy
//
// 5 keyboards are declared (4 actual keyboards and 1 control surface). We want to
// disable the voice allocation system and we want to activate a voice on start-up
// so that all strings are constantly running so we set `Max Keyboard Polyphony` to
// 0. Since we don't want the first 4 keyboards to send the X and Y position of
// fingers on the screen, we set `Send X` and `Send Y` to 0 for all these keyboards.
// Similarly, we don't want the fifth keyboard to send pitch information to the synth
// so we set `Send Freq` to 0 for that keyboard. Finally, we deactivate piano keyboard
// mode for the fifth keyboard to make sure that color doesn't change when the key is
// touch and that note names are not displayed.
//
// ## Compilation Instructions
//
// This Faust code will compile fine with any of the standard Faust targets. However
// it was specifically designed to be used with `faust2smartkeyb`. For best results,
// we recommend to use the following parameters to compile it:
//
// ```
// faust2smartkeyb [-ios/-android] -effect reverb.dsp midiOnly.dsp
// ```
//
// ## Version/Licence
//
// Version 0.0, Feb. 2017
// Copyright Romain Michon CCRMA (Stanford University)/GRAME 2017
// MIT Licence: https://opensource.org/licenses/MIT
//########################################################################################
declare interface "SmartKeyboard{
'Number of Keyboards':'5',
'Max Keyboard Polyphony':'0',
'Rounding Mode':'1',
'Keyboard 0 - Number of Keys':'19',
'Keyboard 1 - Number of Keys':'19',
'Keyboard 2 - Number of Keys':'19',
'Keyboard 3 - Number of Keys':'19',
'Keyboard 4 - Number of Keys':'1',
'Keyboard 4 - Send Freq':'0',
'Keyboard 0 - Send X':'0',
'Keyboard 1 - Send X':'0',
'Keyboard 2 - Send X':'0',
'Keyboard 3 - Send X':'0',
'Keyboard 0 - Send Y':'0',
'Keyboard 1 - Send Y':'0',
'Keyboard 2 - Send Y':'0',
'Keyboard 3 - Send Y':'0',
'Keyboard 0 - Lowest Key':'55',
'Keyboard 1 - Lowest Key':'62',
'Keyboard 2 - Lowest Key':'69',
'Keyboard 3 - Lowest Key':'76',
'Keyboard 4 - Piano Keyboard':'0',
'Keyboard 4 - Key 0 - Label':'Bow'
}";
import("stdfaust.lib");
// parameters
f = hslider("freq",400,50,2000,0.01);
bend = hslider("bend",1,0,10,0.01);
keyboard = hslider("keyboard",0,0,5,1) : int;
key = hslider("key",0,0,18,1) : int;
x = hslider("x",0.5,0,1,0.01) : si.smoo;
y = hslider("y",0,0,1,0.01) : si.smoo;
// mapping
freq = f*bend;
// dirty motion tracker
velocity = x-x' : abs : an.amp_follower_ar(0.1,1) : *(8000) : min(1);
// 4 "strings"
synthSet = par(i,4,synth(localFreq(i),velocity)) :> _
with{
localFreq(i) = freq : ba.sAndH(keyboard == i) : si.smoo;
synth(freq,velocity) = sy.fm((freq,freq + freq*modFreqRatio),index*velocity)*velocity
with{
index = 1000;
modFreqRatio = y*0.3;
};
};
process = synthSet <: _,_; | https://raw.githubusercontent.com/tonal-glyph/faustus/cc887b115aceaee202edbdb37ee0e4087bfb5a33/examples/smartKeyboard/bowed.dsp | faust | ##################################### bowed.dsp ########################################
Faust instrument specifically designed for `faust2smartkeyb` implementing a
non-polyphonic synthesizer (e.g., physical model; etc.) using a combination of
different types of UI elements.
## `SmartKeyboard` Use Strategy
5 keyboards are declared (4 actual keyboards and 1 control surface). We want to
disable the voice allocation system and we want to activate a voice on start-up
so that all strings are constantly running so we set `Max Keyboard Polyphony` to
0. Since we don't want the first 4 keyboards to send the X and Y position of
fingers on the screen, we set `Send X` and `Send Y` to 0 for all these keyboards.
Similarly, we don't want the fifth keyboard to send pitch information to the synth
so we set `Send Freq` to 0 for that keyboard. Finally, we deactivate piano keyboard
mode for the fifth keyboard to make sure that color doesn't change when the key is
touch and that note names are not displayed.
## Compilation Instructions
This Faust code will compile fine with any of the standard Faust targets. However
it was specifically designed to be used with `faust2smartkeyb`. For best results,
we recommend to use the following parameters to compile it:
```
faust2smartkeyb [-ios/-android] -effect reverb.dsp midiOnly.dsp
```
## Version/Licence
Version 0.0, Feb. 2017
Copyright Romain Michon CCRMA (Stanford University)/GRAME 2017
MIT Licence: https://opensource.org/licenses/MIT
########################################################################################
parameters
mapping
dirty motion tracker
4 "strings" |
declare interface "SmartKeyboard{
'Number of Keyboards':'5',
'Max Keyboard Polyphony':'0',
'Rounding Mode':'1',
'Keyboard 0 - Number of Keys':'19',
'Keyboard 1 - Number of Keys':'19',
'Keyboard 2 - Number of Keys':'19',
'Keyboard 3 - Number of Keys':'19',
'Keyboard 4 - Number of Keys':'1',
'Keyboard 4 - Send Freq':'0',
'Keyboard 0 - Send X':'0',
'Keyboard 1 - Send X':'0',
'Keyboard 2 - Send X':'0',
'Keyboard 3 - Send X':'0',
'Keyboard 0 - Send Y':'0',
'Keyboard 1 - Send Y':'0',
'Keyboard 2 - Send Y':'0',
'Keyboard 3 - Send Y':'0',
'Keyboard 0 - Lowest Key':'55',
'Keyboard 1 - Lowest Key':'62',
'Keyboard 2 - Lowest Key':'69',
'Keyboard 3 - Lowest Key':'76',
'Keyboard 4 - Piano Keyboard':'0',
'Keyboard 4 - Key 0 - Label':'Bow'
}";
import("stdfaust.lib");
f = hslider("freq",400,50,2000,0.01);
bend = hslider("bend",1,0,10,0.01);
keyboard = hslider("keyboard",0,0,5,1) : int;
key = hslider("key",0,0,18,1) : int;
x = hslider("x",0.5,0,1,0.01) : si.smoo;
y = hslider("y",0,0,1,0.01) : si.smoo;
freq = f*bend;
velocity = x-x' : abs : an.amp_follower_ar(0.1,1) : *(8000) : min(1);
synthSet = par(i,4,synth(localFreq(i),velocity)) :> _
with{
localFreq(i) = freq : ba.sAndH(keyboard == i) : si.smoo;
synth(freq,velocity) = sy.fm((freq,freq + freq*modFreqRatio),index*velocity)*velocity
with{
index = 1000;
modFreqRatio = y*0.3;
};
};
process = synthSet <: _,_; |
e8feecc7b08c5f82c7bad35e2073bceed00c7d709941984f82d842e212ff5367 | tonal-glyph/faustus | 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 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));
process = _ <: _, amp * echo_mono(dmax,dEchoSamples,dTapSamples,fb,fbspr(fbs),gi) : +;
| https://raw.githubusercontent.com/tonal-glyph/faustus/cc887b115aceaee202edbdb37ee0e4087bfb5a33/examples/SAM/effects/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 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));
process = _ <: _, amp * echo_mono(dmax,dEchoSamples,dTapSamples,fb,fbspr(fbs),gi) : +;
|
7109d74309ad1de531e4a0814698217ff8f17b02cbd340801ab8f8d525075da9 | tonal-glyph/faustus | 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 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));
process = _ <: _, amp * echo_mono(dmax,dEchoSamples,dTapSamples,fb,fbspr(fbs),gi) : +;
| https://raw.githubusercontent.com/tonal-glyph/faustus/cc887b115aceaee202edbdb37ee0e4087bfb5a33/examples/SAM/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) : +;
|
62ecb572fc43815c46d0643b2431ccfabbbb97df2e845afbdd8e9c2062bc0875 | tonal-glyph/faustus | freeverb.dsp | import("stdfaust.lib");
import("layout2.dsp");
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 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 105][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);
| https://raw.githubusercontent.com/tonal-glyph/faustus/cc887b115aceaee202edbdb37ee0e4087bfb5a33/examples/SAM/freeverb/freeverb.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)); | import("stdfaust.lib");
import("layout2.dsp");
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 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 105][style:knob]",0,0,1,1)));
freeverb = fxctrl(fixedgain, wetSlider, monoReverbToStereo(combfeed, allpassfeed, dampSlider, stereospread));
process = ba.bypass2(rbp,freeverb);
|
e1abc620d32556e56f6cb0e1b19819460fec785627302b5ceb8973b5149ed3ca | tonal-glyph/faustus | turenas.dsp | //################################### turenas.dsp ########################################
// A simple smart phone percussion based on an additive synthesizer.
//
// ## `SmartKeyboard` Use Strategy
//
// Since the sounds generated by this synth are very short, the strategy here is to take
// advantage of the polyphony capabilities of the iOSKeyboard architecture by creating
// a new voice every time a new key is pressed. Since the `SmartKeyboard` interface has a
// large number of keys here (180), lots of sounds are generated when sliding a
// finger across the keyboard.
//
//
// ## Compilation Instructions
//
// This Faust code will compile fine with any of the standard Faust targets. However
// it was specifically designed to be used with `faust2smartkeyb`. For best results,
// we recommend to use the following parameters to compile it:
//
// ```
// faust2smartkeyb [-ios/-android] turenas.dsp
// ```
//
// ## Version/Licence
//
// Version 0.0, Feb. 2017
// Copyright Romain Michon CCRMA (Stanford University)/GRAME 2017
// MIT Licence: https://opensource.org/licenses/MIT
//########################################################################################
declare name "turenas";
import("stdfaust.lib");
//========================= Smart Keyboard Configuration =================================
// (10 keyboards with 18 keys each configured as a pitch matrix.
//========================================================================================
declare interface "SmartKeyboard{
'Number of Keyboards':'10',
'Keyboard 0 - Number of Keys':'18',
'Keyboard 1 - Number of Keys':'18',
'Keyboard 2 - Number of Keys':'18',
'Keyboard 3 - Number of Keys':'18',
'Keyboard 4 - Number of Keys':'18',
'Keyboard 5 - Number of Keys':'18',
'Keyboard 6 - Number of Keys':'18',
'Keyboard 7 - Number of Keys':'18',
'Keyboard 8 - Number of Keys':'18',
'Keyboard 9 - Number of Keys':'18',
'Keyboard 0 - Lowest Key':'50',
'Keyboard 1 - Lowest Key':'55',
'Keyboard 2 - Lowest Key':'60',
'Keyboard 3 - Lowest Key':'65',
'Keyboard 4 - Lowest Key':'70',
'Keyboard 5 - Lowest Key':'75',
'Keyboard 6 - Lowest Key':'80',
'Keyboard 7 - Lowest Key':'85',
'Keyboard 8 - Lowest Key':'90',
'Keyboard 9 - Lowest Key':'95',
'Keyboard 0 - Piano Keyboard':'0',
'Keyboard 1 - Piano Keyboard':'0',
'Keyboard 2 - Piano Keyboard':'0',
'Keyboard 3 - Piano Keyboard':'0',
'Keyboard 4 - Piano Keyboard':'0',
'Keyboard 5 - Piano Keyboard':'0',
'Keyboard 6 - Piano Keyboard':'0',
'Keyboard 7 - Piano Keyboard':'0',
'Keyboard 8 - Piano Keyboard':'0',
'Keyboard 9 - Piano Keyboard':'0',
'Keyboard 0 - Send X':'0',
'Keyboard 1 - Send X':'0',
'Keyboard 2 - Send X':'0',
'Keyboard 3 - Send X':'0',
'Keyboard 4 - Send X':'0',
'Keyboard 5 - Send X':'0',
'Keyboard 6 - Send X':'0',
'Keyboard 7 - Send X':'0',
'Keyboard 8 - Send X':'0',
'Keyboard 9 - Send X':'0'
}";
//================================ Instrument Parameters =================================
// Creates the connection between the synth and the mobile device
//========================================================================================
// SmartKeyboard Y parameter
y = hslider("y",0,0,1,0.01);
// Smart Keyboard frequency parameter
freq = hslider("freq",400,50,2000,0.01);
// SmartKeyboard gate parameter
gate = button("gate");
// mode resonance duration is controlled with the x axis of the accelerometer
res = hslider("res[acc: 0 0 -10 0 10]",2.5,0.01,5,0.01);
//=================================== Parameters Mapping =================================
//========================================================================================
// number of modes
nModes = 6;
// distance between each mode
maxModeSpread = 5;
modeSpread = y*maxModeSpread;
// computing modes frequency ratio
modeFreqRatios = par(i,nModes,1+(i+1)/nModes*modeSpread);
// computing modes gain
minModeGain = 0.3;
modeGains = par(i,nModes,1-(i+1)/(nModes*minModeGain));
// smoothed mode resonance
modeRes = res : si.smoo;
//============================================ DSP =======================================
//========================================================================================
process = sy.additiveDrum(freq,modeFreqRatios,modeGains,0.8,0.001,modeRes,gate)*0.05;
| https://raw.githubusercontent.com/tonal-glyph/faustus/cc887b115aceaee202edbdb37ee0e4087bfb5a33/examples/smartKeyboard/turenas.dsp | faust | ################################### turenas.dsp ########################################
A simple smart phone percussion based on an additive synthesizer.
## `SmartKeyboard` Use Strategy
Since the sounds generated by this synth are very short, the strategy here is to take
advantage of the polyphony capabilities of the iOSKeyboard architecture by creating
a new voice every time a new key is pressed. Since the `SmartKeyboard` interface has a
large number of keys here (180), lots of sounds are generated when sliding a
finger across the keyboard.
## Compilation Instructions
This Faust code will compile fine with any of the standard Faust targets. However
it was specifically designed to be used with `faust2smartkeyb`. For best results,
we recommend to use the following parameters to compile it:
```
faust2smartkeyb [-ios/-android] turenas.dsp
```
## Version/Licence
Version 0.0, Feb. 2017
Copyright Romain Michon CCRMA (Stanford University)/GRAME 2017
MIT Licence: https://opensource.org/licenses/MIT
########################################################################################
========================= Smart Keyboard Configuration =================================
(10 keyboards with 18 keys each configured as a pitch matrix.
========================================================================================
================================ Instrument Parameters =================================
Creates the connection between the synth and the mobile device
========================================================================================
SmartKeyboard Y parameter
Smart Keyboard frequency parameter
SmartKeyboard gate parameter
mode resonance duration is controlled with the x axis of the accelerometer
=================================== Parameters Mapping =================================
========================================================================================
number of modes
distance between each mode
computing modes frequency ratio
computing modes gain
smoothed mode resonance
============================================ DSP =======================================
======================================================================================== |
declare name "turenas";
import("stdfaust.lib");
declare interface "SmartKeyboard{
'Number of Keyboards':'10',
'Keyboard 0 - Number of Keys':'18',
'Keyboard 1 - Number of Keys':'18',
'Keyboard 2 - Number of Keys':'18',
'Keyboard 3 - Number of Keys':'18',
'Keyboard 4 - Number of Keys':'18',
'Keyboard 5 - Number of Keys':'18',
'Keyboard 6 - Number of Keys':'18',
'Keyboard 7 - Number of Keys':'18',
'Keyboard 8 - Number of Keys':'18',
'Keyboard 9 - Number of Keys':'18',
'Keyboard 0 - Lowest Key':'50',
'Keyboard 1 - Lowest Key':'55',
'Keyboard 2 - Lowest Key':'60',
'Keyboard 3 - Lowest Key':'65',
'Keyboard 4 - Lowest Key':'70',
'Keyboard 5 - Lowest Key':'75',
'Keyboard 6 - Lowest Key':'80',
'Keyboard 7 - Lowest Key':'85',
'Keyboard 8 - Lowest Key':'90',
'Keyboard 9 - Lowest Key':'95',
'Keyboard 0 - Piano Keyboard':'0',
'Keyboard 1 - Piano Keyboard':'0',
'Keyboard 2 - Piano Keyboard':'0',
'Keyboard 3 - Piano Keyboard':'0',
'Keyboard 4 - Piano Keyboard':'0',
'Keyboard 5 - Piano Keyboard':'0',
'Keyboard 6 - Piano Keyboard':'0',
'Keyboard 7 - Piano Keyboard':'0',
'Keyboard 8 - Piano Keyboard':'0',
'Keyboard 9 - Piano Keyboard':'0',
'Keyboard 0 - Send X':'0',
'Keyboard 1 - Send X':'0',
'Keyboard 2 - Send X':'0',
'Keyboard 3 - Send X':'0',
'Keyboard 4 - Send X':'0',
'Keyboard 5 - Send X':'0',
'Keyboard 6 - Send X':'0',
'Keyboard 7 - Send X':'0',
'Keyboard 8 - Send X':'0',
'Keyboard 9 - Send X':'0'
}";
y = hslider("y",0,0,1,0.01);
freq = hslider("freq",400,50,2000,0.01);
gate = button("gate");
res = hslider("res[acc: 0 0 -10 0 10]",2.5,0.01,5,0.01);
nModes = 6;
maxModeSpread = 5;
modeSpread = y*maxModeSpread;
modeFreqRatios = par(i,nModes,1+(i+1)/nModes*modeSpread);
minModeGain = 0.3;
modeGains = par(i,nModes,1-(i+1)/(nModes*minModeGain));
modeRes = res : si.smoo;
process = sy.additiveDrum(freq,modeFreqRatios,modeGains,0.8,0.001,modeRes,gate)*0.05;
|
85774624081902f435c779bc87052b0d08932fb4f4c19f76b26ed52aa3701264 | tonal-glyph/faustus | acGuitar.dsp | //############################### acGuitar.dsp #################################
// Faust instrument specifically designed for `faust2smartkeyb` where 6 virtual
// nylon strings can be strummed and plucked using a dedicated keyboard. The
// extra "strumming keyboard" could be easily replaced by an external strumming
// interface while the touch screen could keep being used to change the pitch
// of the strings.
//
// ## `SmartKeyboard` Use Strategy
//
// The first 6 keyboards implement each individual string of the instrument. A
// seventh keybaord is used a strumming/plucking interface. As mentionned
// previously, it could be easily replaced by an external interface.
//
// ## Compilation Instructions
//
// This Faust code will compile fine with any of the standard Faust targets.
// However it was specifically designed to be used with `faust2smartkeyb`. For
// best results, we recommend to use the following parameters to compile it:
//
// ```
// faust2smartkeyb [-ios/-android] -effect reverb.dsp acGuitar.dsp
// ```
//
// ## Version/Licence
//
// Version 0.0, Aug. 2017
// Copyright Romain Michon CCRMA (Stanford University)/GRAME 2017
// MIT Licence: https://opensource.org/licenses/MIT
//##############################################################################
declare interface "SmartKeyboard{
'Number of Keyboards':'7',
'Max Keyboard Polyphony':'0',
'Rounding Mode':'2',
'Keyboard 0 - Number of Keys':'14',
'Keyboard 1 - Number of Keys':'14',
'Keyboard 2 - Number of Keys':'14',
'Keyboard 3 - Number of Keys':'14',
'Keyboard 4 - Number of Keys':'14',
'Keyboard 5 - Number of Keys':'14',
'Keyboard 6 - Number of Keys':'6',
'Keyboard 0 - Lowest Key':'52',
'Keyboard 1 - Lowest Key':'57',
'Keyboard 2 - Lowest Key':'62',
'Keyboard 3 - Lowest Key':'67',
'Keyboard 4 - Lowest Key':'71',
'Keyboard 5 - Lowest Key':'76',
'Keyboard 0 - Send Keyboard Freq':'1',
'Keyboard 1 - Send Keyboard Freq':'1',
'Keyboard 2 - Send Keyboard Freq':'1',
'Keyboard 3 - Send Keyboard Freq':'1',
'Keyboard 4 - Send Keyboard Freq':'1',
'Keyboard 5 - Send Keyboard Freq':'1',
'Keyboard 6 - Piano Keyboard':'0',
'Keyboard 6 - Send Key Status':'1',
'Keyboard 6 - Key 0 - Label':'S0',
'Keyboard 6 - Key 1 - Label':'S1',
'Keyboard 6 - Key 2 - Label':'S2',
'Keyboard 6 - Key 3 - Label':'S3',
'Keyboard 6 - Key 4 - Label':'S4',
'Keyboard 6 - Key 5 - Label':'S5'
}";
import("stdfaust.lib");
// SMARTKEYBOARD PARAMS
kbfreq(0) = hslider("kb0freq",164.8,20,10000,0.01);
kbbend(0) = hslider("kb0bend",1,0,10,0.01);
kbfreq(1) = hslider("kb1freq",220,20,10000,0.01);
kbbend(1) = hslider("kb1bend",1,0,10,0.01);
kbfreq(2) = hslider("kb2freq",293.7,20,10000,0.01);
kbbend(2) = hslider("kb2bend",1,0,10,0.01);
kbfreq(3) = hslider("kb3freq",392,20,10000,0.01);
kbbend(3) = hslider("kb3bend",1,0,10,0.01);
kbfreq(4) = hslider("kb4freq",493.9,20,10000,0.01);
kbbend(4) = hslider("kb4bend",1,0,10,0.01);
kbfreq(5) = hslider("kb5freq",659.2,20,10000,0.01);
kbbend(5) = hslider("kb5bend",1,0,10,0.01);
kb6kstatus(0) = hslider("kb6k0status",0,0,1,1) <: ==(1) | ==(4) : int;
kb6kstatus(1) = hslider("kb6k1status",0,0,1,1) <: ==(1) | ==(4) : int;
kb6kstatus(2) = hslider("kb6k2status",0,0,1,1) <: ==(1) | ==(4) : int;
kb6kstatus(3) = hslider("kb6k3status",0,0,1,1) <: ==(1) | ==(4) : int;
kb6kstatus(4) = hslider("kb6k4status",0,0,1,1) <: ==(1) | ==(4) : int;
kb6kstatus(5) = hslider("kb6k5status",0,0,1,1) <: ==(1) | ==(4) : int;
// MODEL PARAMETERS
// strings length
sl(i) = kbfreq(i)*kbbend(i) : pm.f2l : si.smoo;
// pluck position is controlled by the x axis of the accel
pluckPosition =
hslider("pluckPosition[acc: 1 0 -10 0 10]",0.5,0,1,0.01) : si.smoo;
// ASSEMBLING MODELS
// number of strings
nStrings = 6;
guitar = par(i,nStrings,
kb6kstatus(i) : ba.impulsify : // using "raw" impulses to drive the models
pm.nylonGuitarModel(sl(i),pluckPosition)) :> _;
process = guitar <: _,_;
| https://raw.githubusercontent.com/tonal-glyph/faustus/cc887b115aceaee202edbdb37ee0e4087bfb5a33/examples/smartKeyboard/acGuitar.dsp | faust | ############################### acGuitar.dsp #################################
Faust instrument specifically designed for `faust2smartkeyb` where 6 virtual
nylon strings can be strummed and plucked using a dedicated keyboard. The
extra "strumming keyboard" could be easily replaced by an external strumming
interface while the touch screen could keep being used to change the pitch
of the strings.
## `SmartKeyboard` Use Strategy
The first 6 keyboards implement each individual string of the instrument. A
seventh keybaord is used a strumming/plucking interface. As mentionned
previously, it could be easily replaced by an external interface.
## Compilation Instructions
This Faust code will compile fine with any of the standard Faust targets.
However it was specifically designed to be used with `faust2smartkeyb`. For
best results, we recommend to use the following parameters to compile it:
```
faust2smartkeyb [-ios/-android] -effect reverb.dsp acGuitar.dsp
```
## Version/Licence
Version 0.0, Aug. 2017
Copyright Romain Michon CCRMA (Stanford University)/GRAME 2017
MIT Licence: https://opensource.org/licenses/MIT
##############################################################################
SMARTKEYBOARD PARAMS
MODEL PARAMETERS
strings length
pluck position is controlled by the x axis of the accel
ASSEMBLING MODELS
number of strings
using "raw" impulses to drive the models |
declare interface "SmartKeyboard{
'Number of Keyboards':'7',
'Max Keyboard Polyphony':'0',
'Rounding Mode':'2',
'Keyboard 0 - Number of Keys':'14',
'Keyboard 1 - Number of Keys':'14',
'Keyboard 2 - Number of Keys':'14',
'Keyboard 3 - Number of Keys':'14',
'Keyboard 4 - Number of Keys':'14',
'Keyboard 5 - Number of Keys':'14',
'Keyboard 6 - Number of Keys':'6',
'Keyboard 0 - Lowest Key':'52',
'Keyboard 1 - Lowest Key':'57',
'Keyboard 2 - Lowest Key':'62',
'Keyboard 3 - Lowest Key':'67',
'Keyboard 4 - Lowest Key':'71',
'Keyboard 5 - Lowest Key':'76',
'Keyboard 0 - Send Keyboard Freq':'1',
'Keyboard 1 - Send Keyboard Freq':'1',
'Keyboard 2 - Send Keyboard Freq':'1',
'Keyboard 3 - Send Keyboard Freq':'1',
'Keyboard 4 - Send Keyboard Freq':'1',
'Keyboard 5 - Send Keyboard Freq':'1',
'Keyboard 6 - Piano Keyboard':'0',
'Keyboard 6 - Send Key Status':'1',
'Keyboard 6 - Key 0 - Label':'S0',
'Keyboard 6 - Key 1 - Label':'S1',
'Keyboard 6 - Key 2 - Label':'S2',
'Keyboard 6 - Key 3 - Label':'S3',
'Keyboard 6 - Key 4 - Label':'S4',
'Keyboard 6 - Key 5 - Label':'S5'
}";
import("stdfaust.lib");
kbfreq(0) = hslider("kb0freq",164.8,20,10000,0.01);
kbbend(0) = hslider("kb0bend",1,0,10,0.01);
kbfreq(1) = hslider("kb1freq",220,20,10000,0.01);
kbbend(1) = hslider("kb1bend",1,0,10,0.01);
kbfreq(2) = hslider("kb2freq",293.7,20,10000,0.01);
kbbend(2) = hslider("kb2bend",1,0,10,0.01);
kbfreq(3) = hslider("kb3freq",392,20,10000,0.01);
kbbend(3) = hslider("kb3bend",1,0,10,0.01);
kbfreq(4) = hslider("kb4freq",493.9,20,10000,0.01);
kbbend(4) = hslider("kb4bend",1,0,10,0.01);
kbfreq(5) = hslider("kb5freq",659.2,20,10000,0.01);
kbbend(5) = hslider("kb5bend",1,0,10,0.01);
kb6kstatus(0) = hslider("kb6k0status",0,0,1,1) <: ==(1) | ==(4) : int;
kb6kstatus(1) = hslider("kb6k1status",0,0,1,1) <: ==(1) | ==(4) : int;
kb6kstatus(2) = hslider("kb6k2status",0,0,1,1) <: ==(1) | ==(4) : int;
kb6kstatus(3) = hslider("kb6k3status",0,0,1,1) <: ==(1) | ==(4) : int;
kb6kstatus(4) = hslider("kb6k4status",0,0,1,1) <: ==(1) | ==(4) : int;
kb6kstatus(5) = hslider("kb6k5status",0,0,1,1) <: ==(1) | ==(4) : int;
sl(i) = kbfreq(i)*kbbend(i) : pm.f2l : si.smoo;
pluckPosition =
hslider("pluckPosition[acc: 1 0 -10 0 10]",0.5,0,1,0.01) : si.smoo;
nStrings = 6;
guitar = par(i,nStrings,
pm.nylonGuitarModel(sl(i),pluckPosition)) :> _;
process = guitar <: _,_;
|
a5a58a8f0e23129843cc173179e6b42b0501a387d528f5fd9870f9137f1e66df | tonal-glyph/faustus | crazyGuiro.dsp | //################################### crazyGuiro.dsp #####################################
// A simple smart phone "Guiro" where the touch screen is used to drive the instrument and
// select its pitch and where the x and y axis of the accelerometer control the
// resonance properties of the instrument.
//
// ## `SmartKeyboard` Use Strategy
//
// Since the sounds generated by this synth are very short, the strategy here is to take
// advantage of the polyphony capabilities of the iOSKeyboard architecture by creating
// a new voice every time a new key is pressed. Since the `SmartKeyboard` interface has a
// large number of keys here (128), lots of sounds are generated when sliding a
// finger across the keyboard. Also, it's interesting to notice that the `freq` parameter
// is not used here. Instead `keyboard` and `key` are used which allows us to easily
// make custom mappings.
//
// ## Compilation Instructions
//
// This Faust code will compile fine with any of the standard Faust targets. However
// it was specifically designed to be used with `faust2smartkeyb`. For best results,
// we recommend to use the following parameters to compile it:
//
// ```
// faust2smartkeyb [-ios/-android] crazyGuiro.dsp
// ```
//
// ## Version/Licence
//
// Version 0.0, Feb. 2017
// Copyright Romain Michon CCRMA (Stanford University)/GRAME 2017
// MIT Licence: https://opensource.org/licenses/MIT
//########################################################################################
import("stdfaust.lib");
//========================= Smart Keyboard Configuration =================================
// 8 keyboards, each has 16 keys, none of them display key names.
//========================================================================================
declare interface "SmartKeyboard{
'Number of Keyboards':'8',
'Keyboard 0 - Number of Keys':'16',
'Keyboard 1 - Number of Keys':'16',
'Keyboard 2 - Number of Keys':'16',
'Keyboard 3 - Number of Keys':'16',
'Keyboard 4 - Number of Keys':'16',
'Keyboard 5 - Number of Keys':'16',
'Keyboard 6 - Number of Keys':'16',
'Keyboard 7 - Number of Keys':'16',
'Keyboard 0 - Piano Keyboard':'0',
'Keyboard 1 - Piano Keyboard':'0',
'Keyboard 2 - Piano Keyboard':'0',
'Keyboard 3 - Piano Keyboard':'0',
'Keyboard 4 - Piano Keyboard':'0',
'Keyboard 5 - Piano Keyboard':'0',
'Keyboard 6 - Piano Keyboard':'0',
'Keyboard 7 - Piano Keyboard':'0'
}";
//================================ Instrument Parameters =================================
// Creates the connection between the synth and the mobile device
//========================================================================================
// the current keyboard
keyboard = hslider("keyboard",0,0,2,1);
// the current key of the current keyboard
key = hslider("key",0,0,2,1);
// the wet factor of the reverb
wet = hslider("wet[acc: 0 0 -10 0 10]",0,0,1,0.01);
// the resonance factor of the reverb
res = hslider("res[acc: 1 0 -10 0 10]",0.5,0,1,0.01);
// smart keyboard gate parameter
gate = button("gate");
//=================================== Parameters Mapping =================================
//========================================================================================
// the resonance frequency of each click of the Guiro changes in function of
// the selected keyboard and key on it
minKey = 50; // min key of lowest keyboard
keySkipKeyboard = 8; // key skip per keyboard
drumResFreq = (key+minKey)+(keyboard*keySkipKeyboard) : ba.midikey2hz;
reverbWet = wet : si.smoo;
reverbRes = wet : si.smoo;
// filter q
q = 8;
//============================================ DSP =======================================
//========================================================================================
reverb(wet,res) = _ <: *(1-wet),(*(wet) : re.mono_freeverb(res, 0.5, 0.5, 0)) :> _;
process = sy.popFilterDrum(drumResFreq,q,gate) : reverb(wet,res) <: _,_;
| https://raw.githubusercontent.com/tonal-glyph/faustus/cc887b115aceaee202edbdb37ee0e4087bfb5a33/examples/smartKeyboard/crazyGuiro.dsp | faust | ################################### crazyGuiro.dsp #####################################
A simple smart phone "Guiro" where the touch screen is used to drive the instrument and
select its pitch and where the x and y axis of the accelerometer control the
resonance properties of the instrument.
## `SmartKeyboard` Use Strategy
Since the sounds generated by this synth are very short, the strategy here is to take
advantage of the polyphony capabilities of the iOSKeyboard architecture by creating
a new voice every time a new key is pressed. Since the `SmartKeyboard` interface has a
large number of keys here (128), lots of sounds are generated when sliding a
finger across the keyboard. Also, it's interesting to notice that the `freq` parameter
is not used here. Instead `keyboard` and `key` are used which allows us to easily
make custom mappings.
## Compilation Instructions
This Faust code will compile fine with any of the standard Faust targets. However
it was specifically designed to be used with `faust2smartkeyb`. For best results,
we recommend to use the following parameters to compile it:
```
faust2smartkeyb [-ios/-android] crazyGuiro.dsp
```
## Version/Licence
Version 0.0, Feb. 2017
Copyright Romain Michon CCRMA (Stanford University)/GRAME 2017
MIT Licence: https://opensource.org/licenses/MIT
########################################################################################
========================= Smart Keyboard Configuration =================================
8 keyboards, each has 16 keys, none of them display key names.
========================================================================================
================================ Instrument Parameters =================================
Creates the connection between the synth and the mobile device
========================================================================================
the current keyboard
the current key of the current keyboard
the wet factor of the reverb
the resonance factor of the reverb
smart keyboard gate parameter
=================================== Parameters Mapping =================================
========================================================================================
the resonance frequency of each click of the Guiro changes in function of
the selected keyboard and key on it
min key of lowest keyboard
key skip per keyboard
filter q
============================================ DSP =======================================
======================================================================================== |
import("stdfaust.lib");
declare interface "SmartKeyboard{
'Number of Keyboards':'8',
'Keyboard 0 - Number of Keys':'16',
'Keyboard 1 - Number of Keys':'16',
'Keyboard 2 - Number of Keys':'16',
'Keyboard 3 - Number of Keys':'16',
'Keyboard 4 - Number of Keys':'16',
'Keyboard 5 - Number of Keys':'16',
'Keyboard 6 - Number of Keys':'16',
'Keyboard 7 - Number of Keys':'16',
'Keyboard 0 - Piano Keyboard':'0',
'Keyboard 1 - Piano Keyboard':'0',
'Keyboard 2 - Piano Keyboard':'0',
'Keyboard 3 - Piano Keyboard':'0',
'Keyboard 4 - Piano Keyboard':'0',
'Keyboard 5 - Piano Keyboard':'0',
'Keyboard 6 - Piano Keyboard':'0',
'Keyboard 7 - Piano Keyboard':'0'
}";
keyboard = hslider("keyboard",0,0,2,1);
key = hslider("key",0,0,2,1);
wet = hslider("wet[acc: 0 0 -10 0 10]",0,0,1,0.01);
res = hslider("res[acc: 1 0 -10 0 10]",0.5,0,1,0.01);
gate = button("gate");
drumResFreq = (key+minKey)+(keyboard*keySkipKeyboard) : ba.midikey2hz;
reverbWet = wet : si.smoo;
reverbRes = wet : si.smoo;
q = 8;
reverb(wet,res) = _ <: *(1-wet),(*(wet) : re.mono_freeverb(res, 0.5, 0.5, 0)) :> _;
process = sy.popFilterDrum(drumResFreq,q,gate) : reverb(wet,res) <: _,_;
|
5a281496160c0aa387e3cf14c29927b01ba7401139ca377ca72fdf7554dab0d8 | tonal-glyph/faustus | violin.dsp | //############################### violin.dsp ###################################
// Faust instrument specifically designed for `faust2smartkeyb` where a
// complete violin physical model can be played using the touch sceen
// interface. While the 4 virtual strings can be bowed using a control
// surface on the screen, it could be easily substituted with an external
// interface.
//
// ## `SmartKeyboard` Use Strategy
//
// 4 keyboards are used to control the pitch of the 4 bowed strings. Strings
// are connected to the virtual bow when they are touched. A pad created from
// a keybaord with a single key can be used to control the bow velocity and
// pressure on the selected strings.
//
// ## Compilation Instructions
//
// This Faust code will compile fine with any of the standard Faust targets.
// However it was specifically designed to be used with `faust2smartkeyb`. For
// best results, we recommend to use the following parameters to compile it:
//
// ```
// faust2smartkeyb [-ios/-android] -effect reverb.dsp violin.dsp
// ```
//
// ## Version/Licence
//
// Version 0.0, Aug. 2017
// Copyright Romain Michon CCRMA (Stanford University)/GRAME 2017
// MIT Licence: https://opensource.org/licenses/MIT
//##############################################################################
declare interface "SmartKeyboard{
'Number of Keyboards':'5',
'Max Keyboard Polyphony':'0',
'Rounding Mode':'2',
'Send Fingers Count':'1',
'Keyboard 0 - Number of Keys':'19',
'Keyboard 1 - Number of Keys':'19',
'Keyboard 2 - Number of Keys':'19',
'Keyboard 3 - Number of Keys':'19',
'Keyboard 4 - Number of Keys':'1',
'Keyboard 0 - Lowest Key':'55',
'Keyboard 1 - Lowest Key':'62',
'Keyboard 2 - Lowest Key':'69',
'Keyboard 3 - Lowest Key':'76',
'Keyboard 0 - Send Keyboard Freq':'1',
'Keyboard 1 - Send Keyboard Freq':'1',
'Keyboard 2 - Send Keyboard Freq':'1',
'Keyboard 3 - Send Keyboard Freq':'1',
'Keyboard 4 - Send Freq':'0',
'Keyboard 4 - Send Key X':'1',
'Keyboard 4 - Send Key Y':'1',
'Keyboard 4 - Key 0 - Label':'Bow',
'Keyboard 4 - Static Mode':'1'
}";
import("stdfaust.lib");
// SMARTKEYBOARD PARAMS
kbfreq(0) = hslider("kb0freq",220,20,10000,0.01);
kbbend(0) = hslider("kb0bend",1,0,10,0.01);
kbfreq(1) = hslider("kb1freq",330,20,10000,0.01);
kbbend(1) = hslider("kb1bend",1,0,10,0.01);
kbfreq(2) = hslider("kb2freq",440,20,10000,0.01);
kbbend(2) = hslider("kb2bend",1,0,10,0.01);
kbfreq(3) = hslider("kb3freq",550,20,10000,0.01);
kbbend(3) = hslider("kb3bend",1,0,10,0.01);
kb4k0x = hslider("kb4k0x",0,0,1,1) : si.smoo;
kb4k0y = hslider("kb4k0y",0,0,1,1) : si.smoo;
kbfingers(0) = hslider("kb0fingers",0,0,10,1) : int;
kbfingers(1) = hslider("kb1fingers",0,0,10,1) : int;
kbfingers(2) = hslider("kb2fingers",0,0,10,1) : int;
kbfingers(3) = hslider("kb3fingers",0,0,10,1) : int;
// MODEL PARAMETERS
// strings lengths
sl(i) = kbfreq(i)*kbbend(i) : pm.f2l : si.smoo;
// string active only if fingers are touching the keyboard
as(i) = kbfingers(i)>0;
// bow pressure could also be controlled by an external parameter
bowPress = kb4k0y;
// retrieving finger displacement on screen (dirt simple)
bowVel = kb4k0x-kb4k0x' : abs : *(8000) : min(1) : si.smoo;
// bow position is constant but could be ontrolled by an external interface
bowPos = 0.7;
// ASSEMBLING MODELS
// essentially 4 parallel violin strings
model = par(i,4,pm.violinModel(sl(i),bowPress,bowVel*as(i),bowPos)) :> _;
process = model <: _,_;
| https://raw.githubusercontent.com/tonal-glyph/faustus/cc887b115aceaee202edbdb37ee0e4087bfb5a33/examples/smartKeyboard/violin.dsp | faust | ############################### violin.dsp ###################################
Faust instrument specifically designed for `faust2smartkeyb` where a
complete violin physical model can be played using the touch sceen
interface. While the 4 virtual strings can be bowed using a control
surface on the screen, it could be easily substituted with an external
interface.
## `SmartKeyboard` Use Strategy
4 keyboards are used to control the pitch of the 4 bowed strings. Strings
are connected to the virtual bow when they are touched. A pad created from
a keybaord with a single key can be used to control the bow velocity and
pressure on the selected strings.
## Compilation Instructions
This Faust code will compile fine with any of the standard Faust targets.
However it was specifically designed to be used with `faust2smartkeyb`. For
best results, we recommend to use the following parameters to compile it:
```
faust2smartkeyb [-ios/-android] -effect reverb.dsp violin.dsp
```
## Version/Licence
Version 0.0, Aug. 2017
Copyright Romain Michon CCRMA (Stanford University)/GRAME 2017
MIT Licence: https://opensource.org/licenses/MIT
##############################################################################
SMARTKEYBOARD PARAMS
MODEL PARAMETERS
strings lengths
string active only if fingers are touching the keyboard
bow pressure could also be controlled by an external parameter
retrieving finger displacement on screen (dirt simple)
bow position is constant but could be ontrolled by an external interface
ASSEMBLING MODELS
essentially 4 parallel violin strings |
declare interface "SmartKeyboard{
'Number of Keyboards':'5',
'Max Keyboard Polyphony':'0',
'Rounding Mode':'2',
'Send Fingers Count':'1',
'Keyboard 0 - Number of Keys':'19',
'Keyboard 1 - Number of Keys':'19',
'Keyboard 2 - Number of Keys':'19',
'Keyboard 3 - Number of Keys':'19',
'Keyboard 4 - Number of Keys':'1',
'Keyboard 0 - Lowest Key':'55',
'Keyboard 1 - Lowest Key':'62',
'Keyboard 2 - Lowest Key':'69',
'Keyboard 3 - Lowest Key':'76',
'Keyboard 0 - Send Keyboard Freq':'1',
'Keyboard 1 - Send Keyboard Freq':'1',
'Keyboard 2 - Send Keyboard Freq':'1',
'Keyboard 3 - Send Keyboard Freq':'1',
'Keyboard 4 - Send Freq':'0',
'Keyboard 4 - Send Key X':'1',
'Keyboard 4 - Send Key Y':'1',
'Keyboard 4 - Key 0 - Label':'Bow',
'Keyboard 4 - Static Mode':'1'
}";
import("stdfaust.lib");
kbfreq(0) = hslider("kb0freq",220,20,10000,0.01);
kbbend(0) = hslider("kb0bend",1,0,10,0.01);
kbfreq(1) = hslider("kb1freq",330,20,10000,0.01);
kbbend(1) = hslider("kb1bend",1,0,10,0.01);
kbfreq(2) = hslider("kb2freq",440,20,10000,0.01);
kbbend(2) = hslider("kb2bend",1,0,10,0.01);
kbfreq(3) = hslider("kb3freq",550,20,10000,0.01);
kbbend(3) = hslider("kb3bend",1,0,10,0.01);
kb4k0x = hslider("kb4k0x",0,0,1,1) : si.smoo;
kb4k0y = hslider("kb4k0y",0,0,1,1) : si.smoo;
kbfingers(0) = hslider("kb0fingers",0,0,10,1) : int;
kbfingers(1) = hslider("kb1fingers",0,0,10,1) : int;
kbfingers(2) = hslider("kb2fingers",0,0,10,1) : int;
kbfingers(3) = hslider("kb3fingers",0,0,10,1) : int;
sl(i) = kbfreq(i)*kbbend(i) : pm.f2l : si.smoo;
as(i) = kbfingers(i)>0;
bowPress = kb4k0y;
bowVel = kb4k0x-kb4k0x' : abs : *(8000) : min(1) : si.smoo;
bowPos = 0.7;
model = par(i,4,pm.violinModel(sl(i),bowPress,bowVel*as(i),bowPos)) :> _;
process = model <: _,_;
|
3d281d0b7e86e02e62f83b7e8ffe42a98e1ae64f999b48d31e9002f5ac534c2c | tonal-glyph/faustus | clarinet.dsp | //############################### clarinet.dsp #################################
// Faust instrument specifically designed for `faust2smartkeyb` where a
// clarinet physical model is controlled by an interface implementing
// fingerings similar to that of a the real instrument. The pressure of the
// breath in the mouthpiece of the clarinet is controlled by blowing on the
// built-in microphone of the device.
//
// ## `SmartKeyboard` Use Strategy
//
// The device is meant to be held with 2 hands vertically in order to put all
// fingers on the screen at the same time. Key combinations determine the
// pitch of the instrument. A single voice is constantly ran.
//
// ## Compilation Instructions
//
// This Faust code will compile fine with any of the standard Faust targets.
// However it was specifically designed to be used with `faust2smartkeyb`. For
// best results, we recommend to use the following parameters to compile it:
//
// ```
// faust2smartkeyb [-ios/-android] clarinet.dsp
// ```
//
// ## Version/Licence
//
// Version 0.0, Aug. 2017
// Copyright Romain Michon CCRMA (Stanford University)/GRAME 2017
// MIT Licence: https://opensource.org/licenses/MIT
//##############################################################################
declare interface "SmartKeyboard{
'Number of Keyboards':'2',
'Max Keyboard Polyphony':'0',
'Keyboard 0 - Number of Keys':'4',
'Keyboard 1 - Number of Keys':'5',
'Keyboard 0 - Send Freq':'0',
'Keyboard 1 - Send Freq':'0',
'Keyboard 0 - Piano Keyboard':'0',
'Keyboard 1 - Piano Keyboard':'0',
'Keyboard 0 - Send Key Status':'1',
'Keyboard 1 - Send Key Status':'1',
'Keyboard 0 - Key 3 - Label':'O+',
'Keyboard 1 - Key 4 - Label':'O-'
}";
import("stdfaust.lib");
// SMARTKEYBOARD PARAMS
kb0k0status = hslider("kb0k0status",0,0,1,1) : min(1) : int;
kb0k1status = hslider("kb0k1status",0,0,1,1) : min(1) : int;
kb0k2status = hslider("kb0k2status",0,0,1,1) : min(1) : int;
kb0k3status = hslider("kb0k3status",0,0,1,1) : min(1) : int;
kb1k0status = hslider("kb1k0status",0,0,1,1) : min(1) : int;
kb1k1status = hslider("kb1k1status",0,0,1,1) : min(1) : int;
kb1k2status = hslider("kb1k2status",0,0,1,1) : min(1) : int;
kb1k3status = hslider("kb1k3status",0,0,1,1) : min(1) : int;
kb1k4status = hslider("kb1k4status",0,0,1,1) : min(1) : int;
// MODEL PARAMETERS
reedStiffness = hslider("reedStiffness[acc: 1 1 -10 0 10]",0,0,1,0.01) : si.smoo;
basePitch = 73; // C#4
pitchShift = // calculate pitch shfit in function of "keys" combination
((kb0k0status == 0) & (kb0k1status == 1) & (kb0k2status == 0) &
(kb1k0status == 0) & (kb1k1status == 0) & (kb1k2status == 0) &
(kb1k3status == 0))*(-1) + // C
((kb0k0status == 1) & (kb0k1status == 0) & (kb0k2status == 0) &
(kb1k0status == 0) & (kb1k1status == 0) & (kb1k2status == 0) &
(kb1k3status == 0))*(-2) + // B
((kb0k0status == 1) & (kb0k1status == 0) & (kb0k2status == 1) &
(kb1k0status == 0) & (kb1k1status == 0) & (kb1k2status == 0) &
(kb1k3status == 0))*(-3) + // Bb
((kb0k0status == 1) & (kb0k1status == 1) & (kb0k2status == 0) &
(kb1k0status == 0) & (kb1k1status == 0) & (kb1k2status == 0) &
(kb1k3status == 0))*(-4) + // A
((kb0k0status == 1) & (kb0k1status == 1) & (kb0k2status == 0) &
(kb1k0status == 1) & (kb1k1status == 0) & (kb1k2status == 0) &
(kb1k3status == 0))*(-5) + // G#
((kb0k0status == 1) & (kb0k1status == 1) & (kb0k2status == 1) &
(kb1k0status == 0) & (kb1k1status == 0) & (kb1k2status == 0) &
(kb1k3status == 0))*(-6) + // G
((kb0k0status == 1) & (kb0k1status == 1) & (kb0k2status == 1) &
(kb1k0status == 0) & (kb1k1status == 1) & (kb1k2status == 0) &
(kb1k3status == 0))*(-7) + // F#
((kb0k0status == 1) & (kb0k1status == 1) & (kb0k2status == 1) &
(kb1k0status == 1) & (kb1k1status == 0) & (kb1k2status == 0) &
(kb1k3status == 0))*(-8) + // F
((kb0k0status == 1) & (kb0k1status == 1) & (kb0k2status == 1) &
(kb1k0status == 1) & (kb1k1status == 1) & (kb1k2status == 0) &
(kb1k3status == 0))*(-9) + // E
((kb0k0status == 1) & (kb0k1status == 1) & (kb0k2status == 1) &
(kb1k0status == 1) & (kb1k1status == 1) & (kb1k2status == 0) &
(kb1k3status == 1))*(-10) + // Eb
((kb0k0status == 1) & (kb0k1status == 1) & (kb0k2status == 1) &
(kb1k0status == 1) & (kb1k1status == 1) & (kb1k2status == 1) &
(kb1k3status == 0))*(-11) + // D
((kb0k0status == 0) & (kb0k1status == 0) & (kb0k2status == 0) &
(kb1k0status == 0) & (kb1k1status == 0) & (kb1k2status == 0) &
(kb1k3status == 1))*(-12) + // C#
((kb0k0status == 1) & (kb0k1status == 1) & (kb0k2status == 1) &
(kb1k0status == 1) & (kb1k1status == 1) & (kb1k2status == 1) &
(kb1k3status == 1))*(-13); // C
octaveShiftUp = +(kb0k3status : ba.impulsify)~_; // counting up
octaveShiftDown = +(kb1k4status : ba.impulsify)~_; // counting down
octaveShift = (octaveShiftUp-octaveShiftDown)*(12);
// tube length is just smoothed: could be improved
tubeLength = basePitch+pitchShift+octaveShift : ba.midikey2hz : pm.f2l : si.smoo;
bellOpening = 0.5;
// ASSEMBLING MODEL
model(pressure) = pm.clarinetModel(tubeLength,pressure,reedStiffness,bellOpening);
// pressure is estimated from mic signal
process = an.amp_follower_ud(0.02,0.02)*0.7 : model <: _,_;
| https://raw.githubusercontent.com/tonal-glyph/faustus/cc887b115aceaee202edbdb37ee0e4087bfb5a33/examples/smartKeyboard/clarinet.dsp | faust | ############################### clarinet.dsp #################################
Faust instrument specifically designed for `faust2smartkeyb` where a
clarinet physical model is controlled by an interface implementing
fingerings similar to that of a the real instrument. The pressure of the
breath in the mouthpiece of the clarinet is controlled by blowing on the
built-in microphone of the device.
## `SmartKeyboard` Use Strategy
The device is meant to be held with 2 hands vertically in order to put all
fingers on the screen at the same time. Key combinations determine the
pitch of the instrument. A single voice is constantly ran.
## Compilation Instructions
This Faust code will compile fine with any of the standard Faust targets.
However it was specifically designed to be used with `faust2smartkeyb`. For
best results, we recommend to use the following parameters to compile it:
```
faust2smartkeyb [-ios/-android] clarinet.dsp
```
## Version/Licence
Version 0.0, Aug. 2017
Copyright Romain Michon CCRMA (Stanford University)/GRAME 2017
MIT Licence: https://opensource.org/licenses/MIT
##############################################################################
SMARTKEYBOARD PARAMS
MODEL PARAMETERS
C#4
calculate pitch shfit in function of "keys" combination
C
B
Bb
A
G#
G
F#
F
E
Eb
D
C#
C
counting up
counting down
tube length is just smoothed: could be improved
ASSEMBLING MODEL
pressure is estimated from mic signal |
declare interface "SmartKeyboard{
'Number of Keyboards':'2',
'Max Keyboard Polyphony':'0',
'Keyboard 0 - Number of Keys':'4',
'Keyboard 1 - Number of Keys':'5',
'Keyboard 0 - Send Freq':'0',
'Keyboard 1 - Send Freq':'0',
'Keyboard 0 - Piano Keyboard':'0',
'Keyboard 1 - Piano Keyboard':'0',
'Keyboard 0 - Send Key Status':'1',
'Keyboard 1 - Send Key Status':'1',
'Keyboard 0 - Key 3 - Label':'O+',
'Keyboard 1 - Key 4 - Label':'O-'
}";
import("stdfaust.lib");
kb0k0status = hslider("kb0k0status",0,0,1,1) : min(1) : int;
kb0k1status = hslider("kb0k1status",0,0,1,1) : min(1) : int;
kb0k2status = hslider("kb0k2status",0,0,1,1) : min(1) : int;
kb0k3status = hslider("kb0k3status",0,0,1,1) : min(1) : int;
kb1k0status = hslider("kb1k0status",0,0,1,1) : min(1) : int;
kb1k1status = hslider("kb1k1status",0,0,1,1) : min(1) : int;
kb1k2status = hslider("kb1k2status",0,0,1,1) : min(1) : int;
kb1k3status = hslider("kb1k3status",0,0,1,1) : min(1) : int;
kb1k4status = hslider("kb1k4status",0,0,1,1) : min(1) : int;
reedStiffness = hslider("reedStiffness[acc: 1 1 -10 0 10]",0,0,1,0.01) : si.smoo;
((kb0k0status == 0) & (kb0k1status == 1) & (kb0k2status == 0) &
(kb1k0status == 0) & (kb1k1status == 0) & (kb1k2status == 0) &
((kb0k0status == 1) & (kb0k1status == 0) & (kb0k2status == 0) &
(kb1k0status == 0) & (kb1k1status == 0) & (kb1k2status == 0) &
((kb0k0status == 1) & (kb0k1status == 0) & (kb0k2status == 1) &
(kb1k0status == 0) & (kb1k1status == 0) & (kb1k2status == 0) &
((kb0k0status == 1) & (kb0k1status == 1) & (kb0k2status == 0) &
(kb1k0status == 0) & (kb1k1status == 0) & (kb1k2status == 0) &
((kb0k0status == 1) & (kb0k1status == 1) & (kb0k2status == 0) &
(kb1k0status == 1) & (kb1k1status == 0) & (kb1k2status == 0) &
((kb0k0status == 1) & (kb0k1status == 1) & (kb0k2status == 1) &
(kb1k0status == 0) & (kb1k1status == 0) & (kb1k2status == 0) &
((kb0k0status == 1) & (kb0k1status == 1) & (kb0k2status == 1) &
(kb1k0status == 0) & (kb1k1status == 1) & (kb1k2status == 0) &
((kb0k0status == 1) & (kb0k1status == 1) & (kb0k2status == 1) &
(kb1k0status == 1) & (kb1k1status == 0) & (kb1k2status == 0) &
((kb0k0status == 1) & (kb0k1status == 1) & (kb0k2status == 1) &
(kb1k0status == 1) & (kb1k1status == 1) & (kb1k2status == 0) &
((kb0k0status == 1) & (kb0k1status == 1) & (kb0k2status == 1) &
(kb1k0status == 1) & (kb1k1status == 1) & (kb1k2status == 0) &
((kb0k0status == 1) & (kb0k1status == 1) & (kb0k2status == 1) &
(kb1k0status == 1) & (kb1k1status == 1) & (kb1k2status == 1) &
((kb0k0status == 0) & (kb0k1status == 0) & (kb0k2status == 0) &
(kb1k0status == 0) & (kb1k1status == 0) & (kb1k2status == 0) &
((kb0k0status == 1) & (kb0k1status == 1) & (kb0k2status == 1) &
(kb1k0status == 1) & (kb1k1status == 1) & (kb1k2status == 1) &
octaveShift = (octaveShiftUp-octaveShiftDown)*(12);
tubeLength = basePitch+pitchShift+octaveShift : ba.midikey2hz : pm.f2l : si.smoo;
bellOpening = 0.5;
model(pressure) = pm.clarinetModel(tubeLength,pressure,reedStiffness,bellOpening);
process = an.amp_follower_ud(0.02,0.02)*0.7 : model <: _,_;
|
3af402e1147b0841838ef9ab87fddd389565a44984866202a55bc6e42ba12fa5 | tonal-glyph/faustus | WaveSynth_FX.dsp | import("stdfaust.lib");
///////////////////////////////////////////////////////////////////////////////////////////////////
//
// Simple demo of wavetable synthesis. A LFO modulate the interpolation between 4 tables.
// It's possible to add more tables step.
//
///////////////////////////////////////////////////////////////////////////////////////////////////
// MIDI IMPLEMENTATION:
//
// CC 1 : LFO Depth (wave travel modulation)
// CC 14 : LFO Frequency
// CC 70 : Wave travelling
//
// CC 73 : Attack
// CC 76 : Decay
// CC 77 : Sustain
// CC 72 : Release
//
///////////////////////////////////////////////////////////////////////////////////////////////////
// GENERAL
midigate = button ("gate");
midifreq = nentry("freq[unit:Hz]", 440, 20, 20000, 1);
midigain = nentry("gain", 0.5, 0, 1, 0.01);
waveTravel = hslider("waveTravel [midi:ctrl ]",0,0,1,0.01);
// pitchwheel
pitchwheel = hslider("bend [midi:pitchwheel]",1,0.001,10,0.01);
gFreq = midifreq * pitchwheel;
// LFO
lfoDepth = hslider("lfoDepth[midi:ctrl 1]",0,0.,1,0.001):si.smoo;
lfoFreq = hslider("lfoFreq[midi:ctrl 14]",0.1,0.01,10,0.001):si.smoo;
moov = ((os.lf_trianglepos(lfoFreq) * lfoDepth) + waveTravel) : min(1) : max(0);
volA = hslider("A[midi:ctrl 73]",0.01,0.01,4,0.01);
volD = hslider("D[midi:ctrl 76]",0.6,0.01,8,0.01);
volS = hslider("S[midi:ctrl 77]",0.2,0,1,0.01);
volR = hslider("R[midi:ctrl 72]",0.8,0.01,8,0.01);
envelop = en.adsre(volA,volD,volS,volR,midigate);
// Out Amplitude
vol = envelop * midigain ;
WF(tablesize, rang) = abs((fmod ((1+(float(ba.time)*rang)/float(tablesize)), 4.0 ))-2) -1.;
// 4 WF maxi with this version:
scanner(nb, position) = -(_,soustraction) : *(_,coef) : cos : max(0)
with {
coef = 3.14159 * ((nb-1)*0.5);
soustraction = select2( position>0, 0, (position/(nb-1)) );
};
wfosc(freq) = (rdtable(tablesize, wt1, faze)*(moov : scanner(4,0)))+(rdtable(tablesize, wt2, faze)*(moov : scanner(4,1)))
+ (rdtable(tablesize, wt3, faze)*(moov : scanner(4,2)))+(rdtable(tablesize, wt4, faze)*(moov : scanner(4,3)))
with {
tablesize = 1024;
wt1 = WF(tablesize, 16);
wt2 = WF(tablesize, 8);
wt3 = WF(tablesize, 6);
wt4 = WF(tablesize, 4);
faze = int(os.phasor(tablesize,freq));
};
//#################################################################################################//
//##################################### EFFECT SECTION ############################################//
//#################################################################################################//
// Simple FX chaine build for a mono synthesizer.
// It controle general volume and pan.
// FX Chaine is:
// Drive
// Flanger
// Reverberation
//
///////////////////////////////////////////////////////////////////////////////////////////////////
// MIDI IMPLEMENTATION:
// (All are available by OSC)
//
// CC 7 : Volume
// CC 10 : Pan
//
// CC 92 : Distortion Drive
//
// CC 13 : Flanger Delay
// CC 93 : Flanger Dry/Wet
// CC 94 : Flanger Feedback
//
// CC 12 : Reverberation Room size
// CC 91 : Reverberation Dry/Wet
// CC 95 : Reverberation Damp
// CC 90 : Reverberation Stereo Width
//
///////////////////////////////////////////////////////////////////////////////////////////////////
// VOLUME:
volFX = hslider("volume[midi:ctrl 7]",1,0,1,0.001);// Should be 7 according to MIDI CC norm.
// EFFECTS /////////////////////////////////////////////
drive = hslider ("drive[midi:ctrl 92]",0.3,0,1,0.001);
// Flanger
curdel = hslider("flangDel[midi:ctrl 13]",4,0.001,10,0.001);
fb = hslider("flangFeedback[midi:ctrl 94]",0.7,0,1,0.001);
fldw = hslider("dryWetFlang[midi:ctrl 93]",0.5,0,1,0.001);
flanger = efx
with {
fldel = (curdel + (os.lf_triangle(1) * 2) ) : min(10);
efx = _ <: _, pf.flanger_mono(10,fldel,1,fb,0) : dry_wet(fldw);
};
// Pannoramique:
panno = _ : sp.panner(hslider ("pan[midi:ctrl 10]",0.5,0,1,0.001)) : _,_;
// REVERB (from freeverb_demo)
reverb = _,_ <: (*(g)*fixedgain,*(g)*fixedgain :
re.stereo_freeverb(combfeed, allpassfeed, damping, spatSpread)),
*(1-g), *(1-g) :> _,_
with {
scaleroom = 0.28;
offsetroom = 0.7;
allpassfeed = 0.5;
scaledamp = 0.4;
fixedgain = 0.1;
origSR = 44100;
damping = vslider("Damp[midi:ctrl 95]",0.5, 0, 1, 0.025)*scaledamp*origSR/ma.SR;
combfeed = vslider("RoomSize[midi:ctrl 12]", 0.7, 0, 1, 0.025)*scaleroom*origSR/ma.SR + offsetroom;
spatSpread = vslider("Stereo[midi:ctrl 90]",0.6,0,1,0.01)*46*ma.SR/origSR;
g = vslider("dryWetReverb[midi:ctrl 91]", 0.4, 0, 1, 0.001);
// (g = Dry/Wet)
};
// Dry-Wet (from C. LEBRETON)
dry_wet(dw,x,y) = wet*y + dry*x
with {
wet = 0.5*(dw+1.0);
dry = 1.0-wet;
};
// ALL
effect = _ *(volFX) : ef.cubicnl_nodc(drive, 0.1) : flanger : panno : reverb;
process = wfosc(gFreq) * vol;
| https://raw.githubusercontent.com/tonal-glyph/faustus/cc887b115aceaee202edbdb37ee0e4087bfb5a33/examples/bela/WaveSynth_FX.dsp | faust | /////////////////////////////////////////////////////////////////////////////////////////////////
Simple demo of wavetable synthesis. A LFO modulate the interpolation between 4 tables.
It's possible to add more tables step.
/////////////////////////////////////////////////////////////////////////////////////////////////
MIDI IMPLEMENTATION:
CC 1 : LFO Depth (wave travel modulation)
CC 14 : LFO Frequency
CC 70 : Wave travelling
CC 73 : Attack
CC 76 : Decay
CC 77 : Sustain
CC 72 : Release
/////////////////////////////////////////////////////////////////////////////////////////////////
GENERAL
pitchwheel
LFO
Out Amplitude
4 WF maxi with this version:
#################################################################################################//
##################################### EFFECT SECTION ############################################//
#################################################################################################//
Simple FX chaine build for a mono synthesizer.
It controle general volume and pan.
FX Chaine is:
Drive
Flanger
Reverberation
/////////////////////////////////////////////////////////////////////////////////////////////////
MIDI IMPLEMENTATION:
(All are available by OSC)
CC 7 : Volume
CC 10 : Pan
CC 92 : Distortion Drive
CC 13 : Flanger Delay
CC 93 : Flanger Dry/Wet
CC 94 : Flanger Feedback
CC 12 : Reverberation Room size
CC 91 : Reverberation Dry/Wet
CC 95 : Reverberation Damp
CC 90 : Reverberation Stereo Width
/////////////////////////////////////////////////////////////////////////////////////////////////
VOLUME:
Should be 7 according to MIDI CC norm.
EFFECTS /////////////////////////////////////////////
Flanger
Pannoramique:
REVERB (from freeverb_demo)
(g = Dry/Wet)
Dry-Wet (from C. LEBRETON)
ALL | import("stdfaust.lib");
midigate = button ("gate");
midifreq = nentry("freq[unit:Hz]", 440, 20, 20000, 1);
midigain = nentry("gain", 0.5, 0, 1, 0.01);
waveTravel = hslider("waveTravel [midi:ctrl ]",0,0,1,0.01);
pitchwheel = hslider("bend [midi:pitchwheel]",1,0.001,10,0.01);
gFreq = midifreq * pitchwheel;
lfoDepth = hslider("lfoDepth[midi:ctrl 1]",0,0.,1,0.001):si.smoo;
lfoFreq = hslider("lfoFreq[midi:ctrl 14]",0.1,0.01,10,0.001):si.smoo;
moov = ((os.lf_trianglepos(lfoFreq) * lfoDepth) + waveTravel) : min(1) : max(0);
volA = hslider("A[midi:ctrl 73]",0.01,0.01,4,0.01);
volD = hslider("D[midi:ctrl 76]",0.6,0.01,8,0.01);
volS = hslider("S[midi:ctrl 77]",0.2,0,1,0.01);
volR = hslider("R[midi:ctrl 72]",0.8,0.01,8,0.01);
envelop = en.adsre(volA,volD,volS,volR,midigate);
vol = envelop * midigain ;
WF(tablesize, rang) = abs((fmod ((1+(float(ba.time)*rang)/float(tablesize)), 4.0 ))-2) -1.;
scanner(nb, position) = -(_,soustraction) : *(_,coef) : cos : max(0)
with {
coef = 3.14159 * ((nb-1)*0.5);
soustraction = select2( position>0, 0, (position/(nb-1)) );
};
wfosc(freq) = (rdtable(tablesize, wt1, faze)*(moov : scanner(4,0)))+(rdtable(tablesize, wt2, faze)*(moov : scanner(4,1)))
+ (rdtable(tablesize, wt3, faze)*(moov : scanner(4,2)))+(rdtable(tablesize, wt4, faze)*(moov : scanner(4,3)))
with {
tablesize = 1024;
wt1 = WF(tablesize, 16);
wt2 = WF(tablesize, 8);
wt3 = WF(tablesize, 6);
wt4 = WF(tablesize, 4);
faze = int(os.phasor(tablesize,freq));
};
drive = hslider ("drive[midi:ctrl 92]",0.3,0,1,0.001);
curdel = hslider("flangDel[midi:ctrl 13]",4,0.001,10,0.001);
fb = hslider("flangFeedback[midi:ctrl 94]",0.7,0,1,0.001);
fldw = hslider("dryWetFlang[midi:ctrl 93]",0.5,0,1,0.001);
flanger = efx
with {
fldel = (curdel + (os.lf_triangle(1) * 2) ) : min(10);
efx = _ <: _, pf.flanger_mono(10,fldel,1,fb,0) : dry_wet(fldw);
};
panno = _ : sp.panner(hslider ("pan[midi:ctrl 10]",0.5,0,1,0.001)) : _,_;
reverb = _,_ <: (*(g)*fixedgain,*(g)*fixedgain :
re.stereo_freeverb(combfeed, allpassfeed, damping, spatSpread)),
*(1-g), *(1-g) :> _,_
with {
scaleroom = 0.28;
offsetroom = 0.7;
allpassfeed = 0.5;
scaledamp = 0.4;
fixedgain = 0.1;
origSR = 44100;
damping = vslider("Damp[midi:ctrl 95]",0.5, 0, 1, 0.025)*scaledamp*origSR/ma.SR;
combfeed = vslider("RoomSize[midi:ctrl 12]", 0.7, 0, 1, 0.025)*scaleroom*origSR/ma.SR + offsetroom;
spatSpread = vslider("Stereo[midi:ctrl 90]",0.6,0,1,0.01)*46*ma.SR/origSR;
g = vslider("dryWetReverb[midi:ctrl 91]", 0.4, 0, 1, 0.001);
};
dry_wet(dw,x,y) = wet*y + dry*x
with {
wet = 0.5*(dw+1.0);
dry = 1.0-wet;
};
effect = _ *(volFX) : ef.cubicnl_nodc(drive, 0.1) : flanger : panno : reverb;
process = wfosc(gFreq) * vol;
|
63278909baca212df4c57ccc715a09d66fdf7aa54a35726391f06e39f73e759c | tonal-glyph/faustus | WaveSynth_FX_Analog.dsp | import("stdfaust.lib");
///////////////////////////////////////////////////////////////////////////////////////////////////
//
// Simple demo of wavetable synthesis. A LFO modulate the interpolation between 4 tables.
// It's possible to add more tables step.
//
///////////////////////////////////////////////////////////////////////////////////////////////////
// ANALOG IMPLEMENTATION:
//
// ANALOG_0 : Wave travelling
// ANALOG_1 : LFO Frequency
// ANALOG_2 : LFO Depth (wave travel modulation)
// ANALOG_3 : Release
//
// MIDI:
// CC 73 : Attack
// CC 76 : Decay
// CC 77 : Sustain
//
///////////////////////////////////////////////////////////////////////////////////////////////////
// GENERAL
midigate = button ("gate");
midifreq = nentry("freq[unit:Hz]", 440, 20, 20000, 1);
midigain = nentry("gain", 0.5, 0, 1, 0.01);
waveTravel = hslider("waveTravel[BELA: ANALOG_0]",0,0,1,0.01);
// pitchwheel
pitchwheel = hslider("bend [midi:pitchwheel]",1,0.001,10,0.01);
gFreq = midifreq * pitchwheel;
// LFO
lfoDepth = hslider("lfoDepth[BELA: ANALOG_2]",0,0.,1,0.001):si.smoo;
lfoFreq = hslider("lfoFreq[BELA: ANALOG_1]",0.1,0.01,10,0.001):si.smoo;
moov = ((os.lf_trianglepos(lfoFreq) * lfoDepth) + waveTravel) : min(1) : max(0);
volA = hslider("A[midi:ctrl 73]",0.01,0.01,4,0.01);
volD = hslider("D[midi:ctrl 76]",0.6,0.01,8,0.01);
volS = hslider("S[midi:ctrl 77]",0.2,0,1,0.01);
volR = hslider("R[BELA: ANALOG_3]",0.8,0.01,8,0.01);
envelop = en.adsre(volA,volD,volS,volR,midigate);
// Out Amplitude
vol = envelop * midigain ;
WF(tablesize, rang) = abs((fmod ((1+(float(ba.time)*rang)/float(tablesize)), 4.0 ))-2) -1.;
// 4 WF maxi with this version:
scanner(nb, position) = -(_,soustraction) : *(_,coef) : cos : max(0)
with {
coef = 3.14159 * ((nb-1)*0.5);
soustraction = select2( position>0, 0, (position/(nb-1)) );
};
wfosc(freq) = (rdtable(tablesize, wt1, faze)*(moov : scanner(4,0)))+(rdtable(tablesize, wt2, faze)*(moov : scanner(4,1)))
+ (rdtable(tablesize, wt3, faze)*(moov : scanner(4,2)))+(rdtable(tablesize, wt4, faze)*(moov : scanner(4,3)))
with {
tablesize = 1024;
wt1 = WF(tablesize, 16);
wt2 = WF(tablesize, 8);
wt3 = WF(tablesize, 6);
wt4 = WF(tablesize, 4);
faze = int(os.phasor(tablesize,freq));
};
//#################################################################################################//
//##################################### EFFECT SECTION ############################################//
//#################################################################################################//
//
// Simple FX chaine build for a mono synthesizer.
// It controle general volume and pan.
// FX Chaine is:
// Drive
// Flanger
// Reverberation
//
// This version use ANALOG IN to controle some of the parameters.
// Other parameters continue to be available by MIDI or OSC.
//
///////////////////////////////////////////////////////////////////////////////////////////////////
// ANALOG IMPLEMENTATION:
//
// ANALOG_4 : Distortion Drive
// ANALOG_5 : Flanger Dry/Wet
// ANALOG_6 : Reverberation Dry/Wet
// ANALOG_7 : Reverberation Room size
//
// MIDI:
// CC 7 : Volume
// CC 10 : Pan
//
// CC 13 : Flanger Delay
// CC 13 : Flanger Delay
// CC 94 : Flanger Feedback
//
// CC 95 : Reverberation Damp
// CC 90 : Reverberation Stereo Width
//
///////////////////////////////////////////////////////////////////////////////////////////////////
// VOLUME:
volFX = hslider("volume[midi:ctrl 7]",1,0,1,0.001);// Should be 7 according to MIDI CC norm.
// EFFECTS /////////////////////////////////////////////
drive = hslider ("drive[BELA: ANALOG_4]",0.3,0,1,0.001);
// Flanger
curdel = hslider("flangDel[midi:ctrl 13]",4,0.001,10,0.001);
fb = hslider("flangFeedback[midi:ctrl 94]",0.7,0,1,0.001);
fldw = hslider("dryWetFlang[BELA: ANALOG_5]",0.5,0,1,0.001);
flanger = efx
with {
fldel = (curdel + (os.lf_triangle(1) * 2) ) : min(10);
efx = _ <: _, pf.flanger_mono(10,fldel,1,fb,0) : dry_wet(fldw);
};
// Pannoramique:
panno = _ : sp.panner(hslider ("pan[midi:ctrl 10]",0.5,0,1,0.001)) : _,_;
// REVERB (from freeverb_demo)
reverb = _,_ <: (*(g)*fixedgain,*(g)*fixedgain :
re.stereo_freeverb(combfeed, allpassfeed, damping, spatSpread)),
*(1-g), *(1-g) :> _,_
with {
scaleroom = 0.28;
offsetroom = 0.7;
allpassfeed = 0.5;
scaledamp = 0.4;
fixedgain = 0.1;
origSR = 44100;
damping = vslider("Damp[midi:ctrl 95]",0.5, 0, 1, 0.025)*scaledamp*origSR/ma.SR;
combfeed = vslider("RoomSize[BELA: ANALOG_7]", 0.7, 0, 1, 0.025)*scaleroom*origSR/ma.SR + offsetroom;
spatSpread = vslider("Stereo[midi:ctrl 90]",0.6,0,1,0.01)*46*ma.SR/origSR;
g = vslider("dryWetReverb[BELA: ANALOG_6]", 0.4, 0, 1, 0.001);
// (g = Dry/Wet)
};
// Dry-Wet (from C. LEBRETON)
dry_wet(dw,x,y) = wet*y + dry*x
with {
wet = 0.5*(dw+1.0);
dry = 1.0-wet;
};
// ALL
effect = _ *(volFX) : ef.cubicnl_nodc(drive, 0.1) : flanger : panno : reverb;
process = wfosc(gFreq) * vol;
| https://raw.githubusercontent.com/tonal-glyph/faustus/cc887b115aceaee202edbdb37ee0e4087bfb5a33/examples/bela/WaveSynth_FX_Analog.dsp | faust | /////////////////////////////////////////////////////////////////////////////////////////////////
Simple demo of wavetable synthesis. A LFO modulate the interpolation between 4 tables.
It's possible to add more tables step.
/////////////////////////////////////////////////////////////////////////////////////////////////
ANALOG IMPLEMENTATION:
ANALOG_0 : Wave travelling
ANALOG_1 : LFO Frequency
ANALOG_2 : LFO Depth (wave travel modulation)
ANALOG_3 : Release
MIDI:
CC 73 : Attack
CC 76 : Decay
CC 77 : Sustain
/////////////////////////////////////////////////////////////////////////////////////////////////
GENERAL
pitchwheel
LFO
Out Amplitude
4 WF maxi with this version:
#################################################################################################//
##################################### EFFECT SECTION ############################################//
#################################################################################################//
Simple FX chaine build for a mono synthesizer.
It controle general volume and pan.
FX Chaine is:
Drive
Flanger
Reverberation
This version use ANALOG IN to controle some of the parameters.
Other parameters continue to be available by MIDI or OSC.
/////////////////////////////////////////////////////////////////////////////////////////////////
ANALOG IMPLEMENTATION:
ANALOG_4 : Distortion Drive
ANALOG_5 : Flanger Dry/Wet
ANALOG_6 : Reverberation Dry/Wet
ANALOG_7 : Reverberation Room size
MIDI:
CC 7 : Volume
CC 10 : Pan
CC 13 : Flanger Delay
CC 13 : Flanger Delay
CC 94 : Flanger Feedback
CC 95 : Reverberation Damp
CC 90 : Reverberation Stereo Width
/////////////////////////////////////////////////////////////////////////////////////////////////
VOLUME:
Should be 7 according to MIDI CC norm.
EFFECTS /////////////////////////////////////////////
Flanger
Pannoramique:
REVERB (from freeverb_demo)
(g = Dry/Wet)
Dry-Wet (from C. LEBRETON)
ALL | import("stdfaust.lib");
midigate = button ("gate");
midifreq = nentry("freq[unit:Hz]", 440, 20, 20000, 1);
midigain = nentry("gain", 0.5, 0, 1, 0.01);
waveTravel = hslider("waveTravel[BELA: ANALOG_0]",0,0,1,0.01);
pitchwheel = hslider("bend [midi:pitchwheel]",1,0.001,10,0.01);
gFreq = midifreq * pitchwheel;
lfoDepth = hslider("lfoDepth[BELA: ANALOG_2]",0,0.,1,0.001):si.smoo;
lfoFreq = hslider("lfoFreq[BELA: ANALOG_1]",0.1,0.01,10,0.001):si.smoo;
moov = ((os.lf_trianglepos(lfoFreq) * lfoDepth) + waveTravel) : min(1) : max(0);
volA = hslider("A[midi:ctrl 73]",0.01,0.01,4,0.01);
volD = hslider("D[midi:ctrl 76]",0.6,0.01,8,0.01);
volS = hslider("S[midi:ctrl 77]",0.2,0,1,0.01);
volR = hslider("R[BELA: ANALOG_3]",0.8,0.01,8,0.01);
envelop = en.adsre(volA,volD,volS,volR,midigate);
vol = envelop * midigain ;
WF(tablesize, rang) = abs((fmod ((1+(float(ba.time)*rang)/float(tablesize)), 4.0 ))-2) -1.;
scanner(nb, position) = -(_,soustraction) : *(_,coef) : cos : max(0)
with {
coef = 3.14159 * ((nb-1)*0.5);
soustraction = select2( position>0, 0, (position/(nb-1)) );
};
wfosc(freq) = (rdtable(tablesize, wt1, faze)*(moov : scanner(4,0)))+(rdtable(tablesize, wt2, faze)*(moov : scanner(4,1)))
+ (rdtable(tablesize, wt3, faze)*(moov : scanner(4,2)))+(rdtable(tablesize, wt4, faze)*(moov : scanner(4,3)))
with {
tablesize = 1024;
wt1 = WF(tablesize, 16);
wt2 = WF(tablesize, 8);
wt3 = WF(tablesize, 6);
wt4 = WF(tablesize, 4);
faze = int(os.phasor(tablesize,freq));
};
drive = hslider ("drive[BELA: ANALOG_4]",0.3,0,1,0.001);
curdel = hslider("flangDel[midi:ctrl 13]",4,0.001,10,0.001);
fb = hslider("flangFeedback[midi:ctrl 94]",0.7,0,1,0.001);
fldw = hslider("dryWetFlang[BELA: ANALOG_5]",0.5,0,1,0.001);
flanger = efx
with {
fldel = (curdel + (os.lf_triangle(1) * 2) ) : min(10);
efx = _ <: _, pf.flanger_mono(10,fldel,1,fb,0) : dry_wet(fldw);
};
panno = _ : sp.panner(hslider ("pan[midi:ctrl 10]",0.5,0,1,0.001)) : _,_;
reverb = _,_ <: (*(g)*fixedgain,*(g)*fixedgain :
re.stereo_freeverb(combfeed, allpassfeed, damping, spatSpread)),
*(1-g), *(1-g) :> _,_
with {
scaleroom = 0.28;
offsetroom = 0.7;
allpassfeed = 0.5;
scaledamp = 0.4;
fixedgain = 0.1;
origSR = 44100;
damping = vslider("Damp[midi:ctrl 95]",0.5, 0, 1, 0.025)*scaledamp*origSR/ma.SR;
combfeed = vslider("RoomSize[BELA: ANALOG_7]", 0.7, 0, 1, 0.025)*scaleroom*origSR/ma.SR + offsetroom;
spatSpread = vslider("Stereo[midi:ctrl 90]",0.6,0,1,0.01)*46*ma.SR/origSR;
g = vslider("dryWetReverb[BELA: ANALOG_6]", 0.4, 0, 1, 0.001);
};
dry_wet(dw,x,y) = wet*y + dry*x
with {
wet = 0.5*(dw+1.0);
dry = 1.0-wet;
};
effect = _ *(volFX) : ef.cubicnl_nodc(drive, 0.1) : flanger : panno : reverb;
process = wfosc(gFreq) * vol;
|
8dbf18f743447caf3b11a528c80ce7cc6608e05124a25a6584f8bd33f8c8ba19 | tonal-glyph/faustus | simpleSynth_FX_Analog.dsp | import("stdfaust.lib");
///////////////////////////////////////////////////////////////////////////////////////////////////
//
// A very simple subtractive synthesizer with 1 VCO 1 VCF.
// The VCO Waveform is variable between Saw and Square
// The frequency is modulated by an LFO
// The envelope control volum and filter frequency
//
///////////////////////////////////////////////////////////////////////////////////////////////////
// ANALOG IMPLEMENTATION:
//
// ANALOG_0 : waveform (Saw to square)
// ANALOG_1 : Filter Cutoff frequency
// ANALOG_2 : Filter resonance (Q)
// ANALOG_3 : Filter Envelope Modulation
//
// MIDI:
// CC 79 : Filter keyboard tracking (0 to X2, default 1)
//
// Envelope
// CC 73 : Attack
// CC 76 : Decay
// CC 77 : Sustain
// CC 72 : Release
//
// CC 78 : LFO frequency (0.001Hz to 10Hz)
// CC 1 : LFO Amplitude (Modulation)
//
///////////////////////////////////////////////////////////////////////////////////////////////////
//
// HUI //////////////////////////////////////////////////
// Keyboard
midigate = button("gate");
midifreq = nentry("freq[unit:Hz]", 440, 20, 20000, 1);
midigain = nentry("gain", 0.5, 0, 0.5, 0.01);// MIDI KEYBOARD
// pitchwheel
pitchwheel = hslider("bend [midi:pitchwheel]",1,0.001,10,0.01);
// VCO
wfFade = hslider("waveform[BELA: ANALOG_0]",0.5,0,1,0.001):si.smoo;
// VCF
res = hslider("resonnance[BELA: ANALOG_2]",0.5,0,1,0.001):si.smoo;
fr = hslider("fc[BELA: ANALOG_1]", 10, 15, 12000, 0.001):si.smoo;
track = hslider("tracking[midi:ctrl 79]", 1, 0, 2, 0.001);
envMod = hslider("envMod[BELA: ANALOG_3]",50,0,100,0.01):si.smoo;
// ENV
att = 0.01 * (hslider ("attack[midi:ctrl 73]",0.1,0.1,400,0.001));
dec = 0.01 * (hslider ("decay[midi:ctrl 76]",60,0.1,400,0.001));
sust = hslider ("sustain[midi:ctrl 77]",0.2,0,1,0.001);
rel = 0.01 * (hslider ("release[midi:ctrl 72]",100,0.1,400,0.001));
// LFO
lfoFreq = hslider("lfoFreq[midi:ctrl 78]",6,0.001,10,0.001):si.smoo;
modwheel = hslider("modwheel[midi:ctrl 1]",0,0,0.5,0.001):si.smoo;
// PROCESS /////////////////////////////////////////////
allfreq = (midifreq * pitchwheel) + LFO;
// VCF
cutoff = ((allfreq * track) + fr + (envMod * midigain * env)) : min(ma.SR/8);
// VCO
oscillo(f) = (os.sawtooth(f)*(1-wfFade))+(os.square(f)*wfFade);
// VCA
volume = midigain * env;
// Enveloppe
env = en.adsre(att,dec,sust,rel,midigate);
// LFO
LFO = os.lf_triangle(lfoFreq)*modwheel*10;
// SYNTH ////////////////////////////////////////////////
synth = (oscillo(allfreq) :ve.moog_vcf(res,cutoff)) * volume;
//#################################################################################################//
//##################################### EFFECT SECTION ############################################//
//#################################################################################################//
//
// Simple FX chaine build for a mono synthesizer.
// It controle general volume and pan.
// FX Chaine is:
// Drive
// Flanger
// Reverberation
//
// This version use ANALOG IN to controle some of the parameters.
// Other parameters continue to be available by MIDI or OSC.
//
///////////////////////////////////////////////////////////////////////////////////////////////////
// ANALOG IMPLEMENTATION:
//
// ANALOG_4 : Distortion Drive
// ANALOG_5 : Flanger Dry/Wet
// ANALOG_6 : Reverberation Dry/Wet
// ANALOG_7 : Reverberation Room size
//
// MIDI:
// CC 7 : Volume
// CC 10 : Pan
//
// CC 13 : Flanger Delay
// CC 13 : Flanger Delay
// CC 94 : Flanger Feedback
//
// CC 95 : Reverberation Damp
// CC 90 : Reverberation Stereo Width
//
///////////////////////////////////////////////////////////////////////////////////////////////////
// VOLUME:
volFX = hslider ("volume[midi:ctrl 7]",1,0,1,0.001);// Should be 7 according to MIDI CC norm.
// EFFECTS /////////////////////////////////////////////
drive = hslider ("drive[BELA: ANALOG_4]",0.3,0,1,0.001);
// Flanger
curdel = hslider ("flangDel[midi:ctrl 13]",4,0.001,10,0.001);
fb = hslider ("flangFeedback[midi:ctrl 94]",0.7,0,1,0.001);
fldw = hslider ("dryWetFlang[BELA: ANALOG_5]",0.5,0,1,0.001);
flanger = efx
with {
fldel = (curdel + (os.lf_triangle(1) * 2) ) : min(10);
efx = _ <: _, pf.flanger_mono(10,fldel,1,fb,0) : dry_wet(fldw);
};
// Pannoramique:
panno = _ : sp.panner(hslider ("pan[midi:ctrl 10]",0.5,0,1,0.001)) : _,_;
// REVERB (from freeverb_demo)
reverb = _,_ <: (*(g)*fixedgain,*(g)*fixedgain :
re.stereo_freeverb(combfeed, allpassfeed, damping, spatSpread)),
*(1-g), *(1-g) :> _,_
with {
scaleroom = 0.28;
offsetroom = 0.7;
allpassfeed = 0.5;
scaledamp = 0.4;
fixedgain = 0.1;
origSR = 44100;
damping = vslider("Damp[midi:ctrl 95]",0.5, 0, 1, 0.025)*scaledamp*origSR/ma.SR;
combfeed = vslider("RoomSize[BELA: ANALOG_7]", 0.7, 0, 1, 0.025)*scaleroom*origSR/ma.SR + offsetroom;
spatSpread = vslider("Stereo[midi:ctrl 90]",0.6,0,1,0.01)*46*ma.SR/origSR;
g = vslider("dryWetReverb[BELA: ANALOG_6]", 0.4, 0, 1, 0.001);
// (g = Dry/Wet)
};
// Dry-Wet (from C. LEBRETON)
dry_wet(dw,x,y) = wet*y + dry*x
with {
wet = 0.5*(dw+1.0);
dry = 1.0-wet;
};
// ALL
effect = _ *(volFX) : ef.cubicnl_nodc(drive, 0.1) : flanger : panno : reverb;
// PROCESS /////////////////////////////////////////////
process = synth;
| https://raw.githubusercontent.com/tonal-glyph/faustus/cc887b115aceaee202edbdb37ee0e4087bfb5a33/examples/bela/simpleSynth_FX_Analog.dsp | faust | /////////////////////////////////////////////////////////////////////////////////////////////////
A very simple subtractive synthesizer with 1 VCO 1 VCF.
The VCO Waveform is variable between Saw and Square
The frequency is modulated by an LFO
The envelope control volum and filter frequency
/////////////////////////////////////////////////////////////////////////////////////////////////
ANALOG IMPLEMENTATION:
ANALOG_0 : waveform (Saw to square)
ANALOG_1 : Filter Cutoff frequency
ANALOG_2 : Filter resonance (Q)
ANALOG_3 : Filter Envelope Modulation
MIDI:
CC 79 : Filter keyboard tracking (0 to X2, default 1)
Envelope
CC 73 : Attack
CC 76 : Decay
CC 77 : Sustain
CC 72 : Release
CC 78 : LFO frequency (0.001Hz to 10Hz)
CC 1 : LFO Amplitude (Modulation)
/////////////////////////////////////////////////////////////////////////////////////////////////
HUI //////////////////////////////////////////////////
Keyboard
MIDI KEYBOARD
pitchwheel
VCO
VCF
ENV
LFO
PROCESS /////////////////////////////////////////////
VCF
VCO
VCA
Enveloppe
LFO
SYNTH ////////////////////////////////////////////////
#################################################################################################//
##################################### EFFECT SECTION ############################################//
#################################################################################################//
Simple FX chaine build for a mono synthesizer.
It controle general volume and pan.
FX Chaine is:
Drive
Flanger
Reverberation
This version use ANALOG IN to controle some of the parameters.
Other parameters continue to be available by MIDI or OSC.
/////////////////////////////////////////////////////////////////////////////////////////////////
ANALOG IMPLEMENTATION:
ANALOG_4 : Distortion Drive
ANALOG_5 : Flanger Dry/Wet
ANALOG_6 : Reverberation Dry/Wet
ANALOG_7 : Reverberation Room size
MIDI:
CC 7 : Volume
CC 10 : Pan
CC 13 : Flanger Delay
CC 13 : Flanger Delay
CC 94 : Flanger Feedback
CC 95 : Reverberation Damp
CC 90 : Reverberation Stereo Width
/////////////////////////////////////////////////////////////////////////////////////////////////
VOLUME:
Should be 7 according to MIDI CC norm.
EFFECTS /////////////////////////////////////////////
Flanger
Pannoramique:
REVERB (from freeverb_demo)
(g = Dry/Wet)
Dry-Wet (from C. LEBRETON)
ALL
PROCESS ///////////////////////////////////////////// | import("stdfaust.lib");
midigate = button("gate");
midifreq = nentry("freq[unit:Hz]", 440, 20, 20000, 1);
pitchwheel = hslider("bend [midi:pitchwheel]",1,0.001,10,0.01);
wfFade = hslider("waveform[BELA: ANALOG_0]",0.5,0,1,0.001):si.smoo;
res = hslider("resonnance[BELA: ANALOG_2]",0.5,0,1,0.001):si.smoo;
fr = hslider("fc[BELA: ANALOG_1]", 10, 15, 12000, 0.001):si.smoo;
track = hslider("tracking[midi:ctrl 79]", 1, 0, 2, 0.001);
envMod = hslider("envMod[BELA: ANALOG_3]",50,0,100,0.01):si.smoo;
att = 0.01 * (hslider ("attack[midi:ctrl 73]",0.1,0.1,400,0.001));
dec = 0.01 * (hslider ("decay[midi:ctrl 76]",60,0.1,400,0.001));
sust = hslider ("sustain[midi:ctrl 77]",0.2,0,1,0.001);
rel = 0.01 * (hslider ("release[midi:ctrl 72]",100,0.1,400,0.001));
lfoFreq = hslider("lfoFreq[midi:ctrl 78]",6,0.001,10,0.001):si.smoo;
modwheel = hslider("modwheel[midi:ctrl 1]",0,0,0.5,0.001):si.smoo;
allfreq = (midifreq * pitchwheel) + LFO;
cutoff = ((allfreq * track) + fr + (envMod * midigain * env)) : min(ma.SR/8);
oscillo(f) = (os.sawtooth(f)*(1-wfFade))+(os.square(f)*wfFade);
volume = midigain * env;
env = en.adsre(att,dec,sust,rel,midigate);
LFO = os.lf_triangle(lfoFreq)*modwheel*10;
synth = (oscillo(allfreq) :ve.moog_vcf(res,cutoff)) * volume;
drive = hslider ("drive[BELA: ANALOG_4]",0.3,0,1,0.001);
curdel = hslider ("flangDel[midi:ctrl 13]",4,0.001,10,0.001);
fb = hslider ("flangFeedback[midi:ctrl 94]",0.7,0,1,0.001);
fldw = hslider ("dryWetFlang[BELA: ANALOG_5]",0.5,0,1,0.001);
flanger = efx
with {
fldel = (curdel + (os.lf_triangle(1) * 2) ) : min(10);
efx = _ <: _, pf.flanger_mono(10,fldel,1,fb,0) : dry_wet(fldw);
};
panno = _ : sp.panner(hslider ("pan[midi:ctrl 10]",0.5,0,1,0.001)) : _,_;
reverb = _,_ <: (*(g)*fixedgain,*(g)*fixedgain :
re.stereo_freeverb(combfeed, allpassfeed, damping, spatSpread)),
*(1-g), *(1-g) :> _,_
with {
scaleroom = 0.28;
offsetroom = 0.7;
allpassfeed = 0.5;
scaledamp = 0.4;
fixedgain = 0.1;
origSR = 44100;
damping = vslider("Damp[midi:ctrl 95]",0.5, 0, 1, 0.025)*scaledamp*origSR/ma.SR;
combfeed = vslider("RoomSize[BELA: ANALOG_7]", 0.7, 0, 1, 0.025)*scaleroom*origSR/ma.SR + offsetroom;
spatSpread = vslider("Stereo[midi:ctrl 90]",0.6,0,1,0.01)*46*ma.SR/origSR;
g = vslider("dryWetReverb[BELA: ANALOG_6]", 0.4, 0, 1, 0.001);
};
dry_wet(dw,x,y) = wet*y + dry*x
with {
wet = 0.5*(dw+1.0);
dry = 1.0-wet;
};
effect = _ *(volFX) : ef.cubicnl_nodc(drive, 0.1) : flanger : panno : reverb;
process = synth;
|
314b3966050243fea26d3892d8977f9113e0ac0723f7484b8dfe6059bd3e733e | tonal-glyph/faustus | FXChaine2.dsp | import("stdfaust.lib");
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// A complete Stereo FX chain with:
// CHORUS
// PHASER
// DELAY
// REVERB
//
// Designed to use the Analog Input for parameters controls.
//
// CONTROLES ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// ANALOG IN:
// ANALOG 0 : Chorus Depth
// ANALOG 1 : Chorus Delay
// ANALOG 2 : Phaser Dry/Wet
// ANALOG 3 : Phaser Frequency ratio
// ANALOG 4 : Delay Dry/Wet
// ANALOG 5 : Delay Time
// ANALOG 6 : Reverberation Dry/Wet
// ANALOG 7 : Reverberation Room size
//
// Available by OSC : (see BELA console for precise adress)
// Rate : Chorus LFO modulation rate (Hz)
// Deviation : Chorus delay time deviation.
//
// InvertSum : Phaser inversion of phaser in sum. (On/Off)
// VibratoMode : Phaser vibrato Mode. (On/Off)
// Speed : Phaser LFO frequency
// NotchDepth : Phaser LFO depth
// Feedback : Phaser Feedback
// NotchWidth : Phaser Notch Width
// MinNotch1 : Phaser Minimal frequency
// MaxNotch1 : Phaser Maximal Frequency
//
// Damp : Reverberation Damp
// Stereo : Reverberation Stereo Width
//
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
process = chorus_stereo(dmax,curdel,rate,sigma,do2,voices) : phaserSt : xdelay : reverb;
// CHORUS (from SAM demo lib) //////////////////////////////////////////////////////////////////////////////////////////////////////////
voices = 8; // MUST BE EVEN
pi = 4.0*atan(1.0);
periodic = 1;
dmax = 8192;
curdel = dmax * vslider("Delay[BELA: ANALOG_1]", 0.5, 0, 1, 1) : si.smooth(0.999);
rateMax = 7.0; // Hz
rateMin = 0.01;
rateT60 = 0.15661;
rate = vslider("Rate", 0.5, rateMin, rateMax, 0.0001): si.smooth(ba.tau2pole(rateT60/6.91));
depth = vslider("Depth [BELA: ANALOG_0]", 0.5, 0, 1, 0.001) : si.smooth(ba.tau2pole(depthT60/6.91));
// (dept = dry/wet)
depthT60 = 0.15661;
delayPerVoice = 0.5*curdel/voices;
sigma = delayPerVoice * vslider("Deviation",0.5,0,1,0.001) : si.smooth(0.999);
do2 = depth; // use when depth=1 means "multivibrato" effect (no original => all are modulated)
chorus_stereo(dmax,curdel,rate,sigma,do2,voices) =
_,_ <: *(1-do2),*(1-do2),(*(do2),*(do2) <: par(i,voices,voice(i)):>_,_) : ro.interleave(2,2) : +,+;
voice(i) = de.fdelay(dmax,min(dmax,del(i)))/(i+1)
with {
angle(i) = 2*pi*(i/2)/voices + (i%2)*pi/2;
voice(i) = de.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 *
os.oscp(rates(i),i*2*pi/voices);
};
// PHASER (from demo lib.) /////////////////////////////////////////////////////////////////////////////////////////////////////////////
phaserSt = _,_ <: _, _, phaser2_stereo : dry_wetST(dwPhaz)
with {
invert = checkbox("InvertSum");
vibr = checkbox("VibratoMode"); // In this mode you can hear any "Doppler"
phaser2_stereo = pf.phaser2_stereo(Notches,width,frqmin,fratio,frqmax,speed,mdepth,fb,invert);
Notches = 4; // Compile-time parameter: 2 is typical for analog phaser stomp-boxes
speed = hslider("Speed", 0.5, 0, 10, 0.001);
depth = hslider("NotchDepth", 1, 0, 1, 0.001);
fb = hslider("Feedback", 0.7, -0.999, 0.999, 0.001);
width = hslider("NotchWidth",1000, 10, 5000, 1);
frqmin = hslider("MinNotch1",100, 20, 5000, 1);
frqmax = hslider("MaxNotch1",800, 20, 10000, 1) : max(frqmin);
fratio = hslider("NotchFreqRatio[BELA: ANALOG_3]",1.5, 1.1, 4, 0.001);
dwPhaz = vslider("dryWetPhaser[BELA: ANALOG_2]", 0.5, 0, 1, 0.001);
mdepth = select2(vibr,depth,2); // Improve "ease of use"
};
// DELAY (with feedback and crossfeeback) //////////////////////////////////////////////////////////////////////////////////////////////
delay = ba.sec2samp(hslider("delay[BELA: ANALOG_5]", 1,0,2,0.001));
preDelL = delay/2;
delL = delay;
delR = delay;
crossLF = 1200;
CrossFeedb = 0.6;
dwDel = vslider("dryWetDelay[BELA: ANALOG_4]", 0.5, 0, 1, 0.001);
routeur(a,b,c,d) = ((a*CrossFeedb):fi.lowpass(2,crossLF))+c,
((b*CrossFeedb):fi.lowpass(2,crossLF))+d;
xdelay = _,_ <: _,_,((de.sdelay(65536, 512,preDelL),_):
(routeur : de.sdelay(65536, 512,delL) ,de.sdelay(65536, 512,delR) ) ~ (_,_)) : dry_wetST(dwDel);
// REVERB (from freeverb_demo) /////////////////////////////////////////////////////////////////////////////////////////////////////////
reverb = _,_ <: (*(g)*fixedgain,*(g)*fixedgain :
re.stereo_freeverb(combfeed, allpassfeed, damping, spatSpread)),
*(1-g), *(1-g) :> _,_
with {
scaleroom = 0.28;
offsetroom = 0.7;
allpassfeed = 0.5;
scaledamp = 0.4;
fixedgain = 0.1;
origSR = 44100;
damping = vslider("Damp",0.5, 0, 1, 0.025)*scaledamp*origSR/ma.SR;
combfeed = vslider("RoomSize[BELA: ANALOG_7]", 0.5, 0, 1, 0.001)*scaleroom*origSR/ma.SR + offsetroom;
spatSpread = vslider("Stereo",0.5,0,1,0.01)*46*ma.SR/origSR;
g = vslider("dryWetReverb[BELA: ANALOG_6]", 0.2, 0, 1, 0.001);
// (g = Dry/Wet)
};
// Dry-Wet (from C. LEBRETON)
dry_wetST(dw,x1,x2,y1,y2) = (wet*y1 + dry*x1),(wet*y2 + dry*x2)
with {
wet = 0.5*(dw+1.0);
dry = 1.0-wet;
};
| https://raw.githubusercontent.com/tonal-glyph/faustus/cc887b115aceaee202edbdb37ee0e4087bfb5a33/examples/bela/FXChaine2.dsp | faust | ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
A complete Stereo FX chain with:
CHORUS
PHASER
DELAY
REVERB
Designed to use the Analog Input for parameters controls.
CONTROLES ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
ANALOG IN:
ANALOG 0 : Chorus Depth
ANALOG 1 : Chorus Delay
ANALOG 2 : Phaser Dry/Wet
ANALOG 3 : Phaser Frequency ratio
ANALOG 4 : Delay Dry/Wet
ANALOG 5 : Delay Time
ANALOG 6 : Reverberation Dry/Wet
ANALOG 7 : Reverberation Room size
Available by OSC : (see BELA console for precise adress)
Rate : Chorus LFO modulation rate (Hz)
Deviation : Chorus delay time deviation.
InvertSum : Phaser inversion of phaser in sum. (On/Off)
VibratoMode : Phaser vibrato Mode. (On/Off)
Speed : Phaser LFO frequency
NotchDepth : Phaser LFO depth
Feedback : Phaser Feedback
NotchWidth : Phaser Notch Width
MinNotch1 : Phaser Minimal frequency
MaxNotch1 : Phaser Maximal Frequency
Damp : Reverberation Damp
Stereo : Reverberation Stereo Width
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
CHORUS (from SAM demo lib) //////////////////////////////////////////////////////////////////////////////////////////////////////////
MUST BE EVEN
Hz
(dept = dry/wet)
use when depth=1 means "multivibrato" effect (no original => all are modulated)
PHASER (from demo lib.) /////////////////////////////////////////////////////////////////////////////////////////////////////////////
In this mode you can hear any "Doppler"
Compile-time parameter: 2 is typical for analog phaser stomp-boxes
Improve "ease of use"
DELAY (with feedback and crossfeeback) //////////////////////////////////////////////////////////////////////////////////////////////
REVERB (from freeverb_demo) /////////////////////////////////////////////////////////////////////////////////////////////////////////
(g = Dry/Wet)
Dry-Wet (from C. LEBRETON) | import("stdfaust.lib");
process = chorus_stereo(dmax,curdel,rate,sigma,do2,voices) : phaserSt : xdelay : reverb;
pi = 4.0*atan(1.0);
periodic = 1;
dmax = 8192;
curdel = dmax * vslider("Delay[BELA: ANALOG_1]", 0.5, 0, 1, 1) : si.smooth(0.999);
rateMin = 0.01;
rateT60 = 0.15661;
rate = vslider("Rate", 0.5, rateMin, rateMax, 0.0001): si.smooth(ba.tau2pole(rateT60/6.91));
depth = vslider("Depth [BELA: ANALOG_0]", 0.5, 0, 1, 0.001) : si.smooth(ba.tau2pole(depthT60/6.91));
depthT60 = 0.15661;
delayPerVoice = 0.5*curdel/voices;
sigma = delayPerVoice * vslider("Deviation",0.5,0,1,0.001) : si.smooth(0.999);
chorus_stereo(dmax,curdel,rate,sigma,do2,voices) =
_,_ <: *(1-do2),*(1-do2),(*(do2),*(do2) <: par(i,voices,voice(i)):>_,_) : ro.interleave(2,2) : +,+;
voice(i) = de.fdelay(dmax,min(dmax,del(i)))/(i+1)
with {
angle(i) = 2*pi*(i/2)/voices + (i%2)*pi/2;
voice(i) = de.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 *
os.oscp(rates(i),i*2*pi/voices);
};
phaserSt = _,_ <: _, _, phaser2_stereo : dry_wetST(dwPhaz)
with {
invert = checkbox("InvertSum");
phaser2_stereo = pf.phaser2_stereo(Notches,width,frqmin,fratio,frqmax,speed,mdepth,fb,invert);
speed = hslider("Speed", 0.5, 0, 10, 0.001);
depth = hslider("NotchDepth", 1, 0, 1, 0.001);
fb = hslider("Feedback", 0.7, -0.999, 0.999, 0.001);
width = hslider("NotchWidth",1000, 10, 5000, 1);
frqmin = hslider("MinNotch1",100, 20, 5000, 1);
frqmax = hslider("MaxNotch1",800, 20, 10000, 1) : max(frqmin);
fratio = hslider("NotchFreqRatio[BELA: ANALOG_3]",1.5, 1.1, 4, 0.001);
dwPhaz = vslider("dryWetPhaser[BELA: ANALOG_2]", 0.5, 0, 1, 0.001);
};
delay = ba.sec2samp(hslider("delay[BELA: ANALOG_5]", 1,0,2,0.001));
preDelL = delay/2;
delL = delay;
delR = delay;
crossLF = 1200;
CrossFeedb = 0.6;
dwDel = vslider("dryWetDelay[BELA: ANALOG_4]", 0.5, 0, 1, 0.001);
routeur(a,b,c,d) = ((a*CrossFeedb):fi.lowpass(2,crossLF))+c,
((b*CrossFeedb):fi.lowpass(2,crossLF))+d;
xdelay = _,_ <: _,_,((de.sdelay(65536, 512,preDelL),_):
(routeur : de.sdelay(65536, 512,delL) ,de.sdelay(65536, 512,delR) ) ~ (_,_)) : dry_wetST(dwDel);
reverb = _,_ <: (*(g)*fixedgain,*(g)*fixedgain :
re.stereo_freeverb(combfeed, allpassfeed, damping, spatSpread)),
*(1-g), *(1-g) :> _,_
with {
scaleroom = 0.28;
offsetroom = 0.7;
allpassfeed = 0.5;
scaledamp = 0.4;
fixedgain = 0.1;
origSR = 44100;
damping = vslider("Damp",0.5, 0, 1, 0.025)*scaledamp*origSR/ma.SR;
combfeed = vslider("RoomSize[BELA: ANALOG_7]", 0.5, 0, 1, 0.001)*scaleroom*origSR/ma.SR + offsetroom;
spatSpread = vslider("Stereo",0.5,0,1,0.01)*46*ma.SR/origSR;
g = vslider("dryWetReverb[BELA: ANALOG_6]", 0.2, 0, 1, 0.001);
};
dry_wetST(dw,x1,x2,y1,y2) = (wet*y1 + dry*x1),(wet*y2 + dry*x2)
with {
wet = 0.5*(dw+1.0);
dry = 1.0-wet;
};
|
8f56622e01cadf64a22191f08d38589925c87a48cdef024511e5233623f789ff | tonal-glyph/faustus | simpleSynth_FX.dsp | import("stdfaust.lib");
///////////////////////////////////////////////////////////////////////////////////////////////////
//
// A very simple subtractive synthesizer with 1 VCO 1 VCF.
// The VCO Waveform is variable between Saw and Square
// The frequency is modulated by an LFO
// The envelope control volum and filter frequency
//
///////////////////////////////////////////////////////////////////////////////////////////////////
// MIDI IMPLEMENTATION:
//
// CC 70 : waveform (Saw to square)
// CC 71 : Filter resonance (Q)
// CC 74 : Filter Cutoff frequency
// CC 79 : Filter keyboard tracking (0 to X2, default 1)
// CC 75 : Filter Envelope Modulation
//
// Envelope
// CC 73 : Attack
// CC 76 : Decay
// CC 77 : Sustain
// CC 72 : Release
//
// CC 78 : LFO frequency (0.001Hz to 10Hz)
// CC 1 : LFO Amplitude (Modulation)
//
///////////////////////////////////////////////////////////////////////////////////////////////////
//
// HUI //////////////////////////////////////////////////
// Keyboard
midigate = button ("gate");
midifreq = nentry("freq[unit:Hz]", 440, 20, 20000, 1);
midigain = nentry("gain", 0.5, 0, 0.5, 0.01);// MIDI KEYBOARD
// pitchwheel
pitchwheel = hslider("bend [midi:pitchwheel]",1,0.001,10,0.01);
// VCO
wfFade = hslider("waveform[midi:ctrl 70]",0.5,0,1,0.001):si.smoo;
// VCF
res = hslider("resonnance[midi:ctrl 71]",0.5,0,1,0.001):si.smoo;
fr = hslider("fc[midi:ctrl 74]", 10, 15, 12000, 0.001):si.smoo;
track = hslider("tracking[midi:ctrl 79]", 1, 0, 2, 0.001);
envMod = hslider("envMod[midi:ctrl 75]",50,0,100,0.01):si.smoo;
// ENV
att = 0.01 * (hslider ("attack[midi:ctrl 73]",0.1,0.1,400,0.001));
dec = 0.01 * (hslider ("decay[midi:ctrl 76]",60,0.1,400,0.001));
sust = hslider ("sustain[midi:ctrl 77]",0.1,0,1,0.001);
rel = 0.01 * (hslider ("release[midi:ctrl 72]",100,0.1,400,0.001));
// LFO
lfoFreq = hslider ("lfoFreq[midi:ctrl 78]",6,0.001,10,0.001):si.smoo;
modwheel= hslider ("modwheel[midi:ctrl 1]",0,0,0.5,0.001):si.smoo;
// PROCESS /////////////////////////////////////////////
allfreq = (midifreq * pitchwheel) + LFO;
// VCF
cutoff= ((allfreq * track) + fr + (envMod * midigain * env)) : min(ma.SR/8);
// VCO
oscillo(f) = (os.sawtooth(f)*(1-wfFade))+(os.square(f)*wfFade);
// VCA
volume = midigain * env;
// Enveloppe
env = en.adsre(att,dec,sust,rel,midigate);
// LFO
LFO = os.lf_triangle(lfoFreq)*modwheel*10;
// SYNTH ////////////////////////////////////////////////
synth = (oscillo(allfreq) :ve.moog_vcf(res,cutoff)) * volume;
//#################################################################################################//
//##################################### EFFECT SECTION ############################################//
//#################################################################################################//
// Simple FX chaine build for a mono synthesizer.
// It controle general volume and pan.
// FX Chaine is:
// Drive
// Flanger
// Reverberation
//
///////////////////////////////////////////////////////////////////////////////////////////////////
// MIDI IMPLEMENTATION:
// (All are available by OSC)
//
// CC 7 : Volume
// CC 10 : Pan
//
// CC 92 : Distortion Drive
//
// CC 13 : Flanger Delay
// CC 93 : Flanger Dry/Wet
// CC 94 : Flanger Feedback
//
// CC 12 : Reverberation Room size
// CC 91 : Reverberation Dry/Wet
// CC 95 : Reverberation Damp
// CC 90 : Reverberation Stereo Width
//
///////////////////////////////////////////////////////////////////////////////////////////////////
// VOLUME:
volFX = hslider ("volume[midi:ctrl 7]",1,0,1,0.001);// Should be 7 according to MIDI CC norm.
// EFFECTS /////////////////////////////////////////////
drive = hslider ("drive[midi:ctrl 92]",0.3,0,1,0.001);
// Flanger
curdel = hslider ("flangDel[midi:ctrl 13]",4,0.001,10,0.001);
fb = hslider ("flangFeedback[midi:ctrl 94]",0.7,0,1,0.001);
fldw = hslider ("dryWetFlang[midi:ctrl 93]",0.5,0,1,0.001);
flanger = efx
with {
fldel = (curdel + (os.lf_triangle(1) * 2) ) : min(10);
efx = _ <: _, pf.flanger_mono(10,fldel,1,fb,0) : dry_wet(fldw);
};
// Pannoramique:
panno = _ : sp.panner(hslider ("pan[midi:ctrl 10]",0.5,0,1,0.001)) : _,_;
// REVERB (from freeverb_demo)
reverb = _,_ <: (*(g)*fixedgain,*(g)*fixedgain :
re.stereo_freeverb(combfeed, allpassfeed, damping, spatSpread)),
*(1-g), *(1-g) :> _,_
with {
scaleroom = 0.28;
offsetroom = 0.7;
allpassfeed = 0.5;
scaledamp = 0.4;
fixedgain = 0.1;
origSR = 44100;
damping = vslider("Damp[midi:ctrl 95]",0.5, 0, 1, 0.025)*scaledamp*origSR/ma.SR;
combfeed = vslider("RoomSize[midi:ctrl 12]", 0.7, 0, 1, 0.025)*scaleroom*origSR/ma.SR + offsetroom;
spatSpread = vslider("Stereo[midi:ctrl 90]",0.6,0,1,0.01)*46*ma.SR/origSR;
g = vslider("dryWetReverb[midi:ctrl 91]", 0.4, 0, 1, 0.001);
// (g = Dry/Wet)
};
// Dry-Wet (from C. LEBRETON)
dry_wet(dw,x,y) = wet*y + dry*x
with {
wet = 0.5*(dw+1.0);
dry = 1.0-wet;
};
// ALL
effect = _ *(volFX) : ef.cubicnl_nodc(drive, 0.1) : flanger : panno : reverb;
// PROCESS /////////////////////////////////////////////
process = synth;
| https://raw.githubusercontent.com/tonal-glyph/faustus/cc887b115aceaee202edbdb37ee0e4087bfb5a33/examples/bela/simpleSynth_FX.dsp | faust | /////////////////////////////////////////////////////////////////////////////////////////////////
A very simple subtractive synthesizer with 1 VCO 1 VCF.
The VCO Waveform is variable between Saw and Square
The frequency is modulated by an LFO
The envelope control volum and filter frequency
/////////////////////////////////////////////////////////////////////////////////////////////////
MIDI IMPLEMENTATION:
CC 70 : waveform (Saw to square)
CC 71 : Filter resonance (Q)
CC 74 : Filter Cutoff frequency
CC 79 : Filter keyboard tracking (0 to X2, default 1)
CC 75 : Filter Envelope Modulation
Envelope
CC 73 : Attack
CC 76 : Decay
CC 77 : Sustain
CC 72 : Release
CC 78 : LFO frequency (0.001Hz to 10Hz)
CC 1 : LFO Amplitude (Modulation)
/////////////////////////////////////////////////////////////////////////////////////////////////
HUI //////////////////////////////////////////////////
Keyboard
MIDI KEYBOARD
pitchwheel
VCO
VCF
ENV
LFO
PROCESS /////////////////////////////////////////////
VCF
VCO
VCA
Enveloppe
LFO
SYNTH ////////////////////////////////////////////////
#################################################################################################//
##################################### EFFECT SECTION ############################################//
#################################################################################################//
Simple FX chaine build for a mono synthesizer.
It controle general volume and pan.
FX Chaine is:
Drive
Flanger
Reverberation
/////////////////////////////////////////////////////////////////////////////////////////////////
MIDI IMPLEMENTATION:
(All are available by OSC)
CC 7 : Volume
CC 10 : Pan
CC 92 : Distortion Drive
CC 13 : Flanger Delay
CC 93 : Flanger Dry/Wet
CC 94 : Flanger Feedback
CC 12 : Reverberation Room size
CC 91 : Reverberation Dry/Wet
CC 95 : Reverberation Damp
CC 90 : Reverberation Stereo Width
/////////////////////////////////////////////////////////////////////////////////////////////////
VOLUME:
Should be 7 according to MIDI CC norm.
EFFECTS /////////////////////////////////////////////
Flanger
Pannoramique:
REVERB (from freeverb_demo)
(g = Dry/Wet)
Dry-Wet (from C. LEBRETON)
ALL
PROCESS ///////////////////////////////////////////// | import("stdfaust.lib");
midigate = button ("gate");
midifreq = nentry("freq[unit:Hz]", 440, 20, 20000, 1);
pitchwheel = hslider("bend [midi:pitchwheel]",1,0.001,10,0.01);
wfFade = hslider("waveform[midi:ctrl 70]",0.5,0,1,0.001):si.smoo;
res = hslider("resonnance[midi:ctrl 71]",0.5,0,1,0.001):si.smoo;
fr = hslider("fc[midi:ctrl 74]", 10, 15, 12000, 0.001):si.smoo;
track = hslider("tracking[midi:ctrl 79]", 1, 0, 2, 0.001);
envMod = hslider("envMod[midi:ctrl 75]",50,0,100,0.01):si.smoo;
att = 0.01 * (hslider ("attack[midi:ctrl 73]",0.1,0.1,400,0.001));
dec = 0.01 * (hslider ("decay[midi:ctrl 76]",60,0.1,400,0.001));
sust = hslider ("sustain[midi:ctrl 77]",0.1,0,1,0.001);
rel = 0.01 * (hslider ("release[midi:ctrl 72]",100,0.1,400,0.001));
lfoFreq = hslider ("lfoFreq[midi:ctrl 78]",6,0.001,10,0.001):si.smoo;
modwheel= hslider ("modwheel[midi:ctrl 1]",0,0,0.5,0.001):si.smoo;
allfreq = (midifreq * pitchwheel) + LFO;
cutoff= ((allfreq * track) + fr + (envMod * midigain * env)) : min(ma.SR/8);
oscillo(f) = (os.sawtooth(f)*(1-wfFade))+(os.square(f)*wfFade);
volume = midigain * env;
env = en.adsre(att,dec,sust,rel,midigate);
LFO = os.lf_triangle(lfoFreq)*modwheel*10;
synth = (oscillo(allfreq) :ve.moog_vcf(res,cutoff)) * volume;
drive = hslider ("drive[midi:ctrl 92]",0.3,0,1,0.001);
curdel = hslider ("flangDel[midi:ctrl 13]",4,0.001,10,0.001);
fb = hslider ("flangFeedback[midi:ctrl 94]",0.7,0,1,0.001);
fldw = hslider ("dryWetFlang[midi:ctrl 93]",0.5,0,1,0.001);
flanger = efx
with {
fldel = (curdel + (os.lf_triangle(1) * 2) ) : min(10);
efx = _ <: _, pf.flanger_mono(10,fldel,1,fb,0) : dry_wet(fldw);
};
panno = _ : sp.panner(hslider ("pan[midi:ctrl 10]",0.5,0,1,0.001)) : _,_;
reverb = _,_ <: (*(g)*fixedgain,*(g)*fixedgain :
re.stereo_freeverb(combfeed, allpassfeed, damping, spatSpread)),
*(1-g), *(1-g) :> _,_
with {
scaleroom = 0.28;
offsetroom = 0.7;
allpassfeed = 0.5;
scaledamp = 0.4;
fixedgain = 0.1;
origSR = 44100;
damping = vslider("Damp[midi:ctrl 95]",0.5, 0, 1, 0.025)*scaledamp*origSR/ma.SR;
combfeed = vslider("RoomSize[midi:ctrl 12]", 0.7, 0, 1, 0.025)*scaleroom*origSR/ma.SR + offsetroom;
spatSpread = vslider("Stereo[midi:ctrl 90]",0.6,0,1,0.01)*46*ma.SR/origSR;
g = vslider("dryWetReverb[midi:ctrl 91]", 0.4, 0, 1, 0.001);
};
dry_wet(dw,x,y) = wet*y + dry*x
with {
wet = 0.5*(dw+1.0);
dry = 1.0-wet;
};
effect = _ *(volFX) : ef.cubicnl_nodc(drive, 0.1) : flanger : panno : reverb;
process = synth;
|
d3d1cac5b70e9744fc1c23f3499c410f50326235f764c0555cdbfc5ee0d3475a | tonal-glyph/faustus | 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 = ba.bypass1to2(cbp,chorus_mono(dmax,curdel,rate,sigma,do2,voices));
dmax = 8192;
curdel = dmax * ckg(vslider("[0] Delay [midi:ctrl 55] [style:knob]", 0.5, 0, 1, 1)) : si.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))
: si.smooth(ba.tau2pole(rateT60/6.91));
depth = ckg(vslider("[4] Depth [midi:ctrl 57] [style:knob]", 0.5, 0, 1, 0.001)) : si.smooth(ba.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)) : si.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)) :> _,_) : ro.interleave(2,2) : +,+
with {
angle(i) = 2*ma.PI*(i/2)/voices + (i%2)*ma.PI/2;
voice(i) = de.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 * os.oscp(rates(i),i*2*ma.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/tonal-glyph/faustus/cc887b115aceaee202edbdb37ee0e4087bfb5a33/examples/SAM/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
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)
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 = ba.bypass1to2(cbp,chorus_mono(dmax,curdel,rate,sigma,do2,voices));
dmax = 8192;
curdel = dmax * ckg(vslider("[0] Delay [midi:ctrl 55] [style:knob]", 0.5, 0, 1, 1)) : si.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))
: si.smooth(ba.tau2pole(rateT60/6.91));
depth = ckg(vslider("[4] Depth [midi:ctrl 57] [style:knob]", 0.5, 0, 1, 0.001)) : si.smooth(ba.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)) : si.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)) :> _,_) : ro.interleave(2,2) : +,+
with {
angle(i) = 2*ma.PI*(i/2)/voices + (i%2)*ma.PI/2;
voice(i) = de.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 * os.oscp(rates(i),i*2*ma.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));
|
61f5d49f1f3216e52e0af7ea54144b2425f80ceb6abcc39712d450714ec6a573 | tonal-glyph/faustus | 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 105][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/tonal-glyph/faustus/cc887b115aceaee202edbdb37ee0e4087bfb5a33/examples/SAM/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 105][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));
|
f5a0be453e113e09c9d18c64d0fcc67621f314547a6a8a7723f822449a6630de | tonal-glyph/faustus | chorusForBrowser.dsp | import("stdfaust.lib");
voices = 8; // MUST BE EVEN
process = ba.bypass1to2(cbp,chorus_mono(dmax,curdel,rate,sigma,do2,voices));
dmax = 8192;
curdel = dmax * ckg(vslider("[0] Delay [midi:ctrl 4] [style:knob]", 0.5, 0, 1, 1)) : si.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))
: si.smooth(ba.tau2pole(rateT60/6.91));
depth = ckg(vslider("[4] Depth [midi:ctrl 3] [style:knob]", 0.5, 0, 1, 0.001)) : si.smooth(ba.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)) : si.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 105][style:knob]",0,0,1,1)));
chorus_mono(dmax,curdel,rate,sigma,do2,voices)
= _ <: (*(1-do2)<:_,_),(*(do2) <: par(i,voices,voice(i)) :> _,_) : ro.interleave(2,2) : +,+
with {
angle(i) = 2*ma.PI*(i/2)/voices + (i%2)*ma.PI/2;
voice(i) = de.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 * os.oscp(rates(i),i*2*ma.PI/voices);
};
// 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/tonal-glyph/faustus/cc887b115aceaee202edbdb37ee0e4087bfb5a33/examples/SAM/chorus/chorusForBrowser.dsp | faust | MUST BE EVEN
Hz
use when depth=1 means "multivibrato" effect (no original => all are modulated)
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 = ba.bypass1to2(cbp,chorus_mono(dmax,curdel,rate,sigma,do2,voices));
dmax = 8192;
curdel = dmax * ckg(vslider("[0] Delay [midi:ctrl 4] [style:knob]", 0.5, 0, 1, 1)) : si.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))
: si.smooth(ba.tau2pole(rateT60/6.91));
depth = ckg(vslider("[4] Depth [midi:ctrl 3] [style:knob]", 0.5, 0, 1, 0.001)) : si.smooth(ba.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)) : si.smooth(0.999);
periodic = 1;
cbp = 1-int(csg(vslider("[0] Enable [midi:ctrl 105][style:knob]",0,0,1,1)));
chorus_mono(dmax,curdel,rate,sigma,do2,voices)
= _ <: (*(1-do2)<:_,_),(*(do2) <: par(i,voices,voice(i)) :> _,_) : ro.interleave(2,2) : +,+
with {
angle(i) = 2*ma.PI*(i/2)/voices + (i%2)*ma.PI/2;
voice(i) = de.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 * os.oscp(rates(i),i*2*ma.PI/voices);
};
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));
|
b60256692b45b00b1ae82ebcf9cb2531bc6860cdeff819d8a7492cc5790d34ac | tonal-glyph/faustus | 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 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));
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/tonal-glyph/faustus/cc887b115aceaee202edbdb37ee0e4087bfb5a33/examples/SAM/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));
|
9be2909509c6cd475f44b136bdbd6aee3e7525622a83066a13b06f72f2adccc7 | tonal-glyph/faustus | 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 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 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 105][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/tonal-glyph/faustus/cc887b115aceaee202edbdb37ee0e4087bfb5a33/examples/SAM/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 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 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 105][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));
|
a2f2535b172da65c52481541f65ed68a98484765e2201f9a79b40d5614e44ab4 | tonal-glyph/faustus | 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 = ve.moog_vcf_2bn(res,fc);
// 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 = 0.01 * 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 = 0.01 * 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 = ba.bypass1to2(cbp,chorus_mono(dmax,curdel,rate,sigma,do2,voices));
dmax = 8192;
curdel = dmax * ckg(vslider("[0] Delay [midi:ctrl 55] [style:knob]", 0.5, 0, 1, 1)) : si.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))
: si.smooth(ba.tau2pole(rateT60/6.91));
depth = ckg(vslider("[4] Depth [midi:ctrl 57] [style:knob]", 0.5, 0, 1, 0.001)) : si.smooth(ba.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)) : si.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)) :> _,_) : ro.interleave(2,2) : +,+
with {
angle(i) = 2*ma.PI*(i/2)/voices + (i%2)*ma.PI/2;
voice(i) = de.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 * os.oscp(rates(i),i*2*ma.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/tonal-glyph/faustus/cc887b115aceaee202edbdb37ee0e4087bfb5a33/examples/SAM/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
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
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 = ve.moog_vcf_2bn(res,fc);
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 = 0.01 * 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 = 0.01 * 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_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 = ba.bypass1to2(cbp,chorus_mono(dmax,curdel,rate,sigma,do2,voices));
dmax = 8192;
curdel = dmax * ckg(vslider("[0] Delay [midi:ctrl 55] [style:knob]", 0.5, 0, 1, 1)) : si.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))
: si.smooth(ba.tau2pole(rateT60/6.91));
depth = ckg(vslider("[4] Depth [midi:ctrl 57] [style:knob]", 0.5, 0, 1, 0.001)) : si.smooth(ba.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)) : si.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)) :> _,_) : ro.interleave(2,2) : +,+
with {
angle(i) = 2*ma.PI*(i/2)/voices + (i%2)*ma.PI/2;
voice(i) = de.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 * os.oscp(rates(i),i*2*ma.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));
|
ee0227d7765f449f76f0f897aa5a9912427e9f24dd270a35fdb3194e0c3e991e | tonal-glyph/faustus | 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 = ve.moog_vcf_2bn(res,fc);
// 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 = 0.01 * 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 = 0.01 * 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/tonal-glyph/faustus/cc887b115aceaee202edbdb37ee0e4087bfb5a33/examples/SAM/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
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 = ve.moog_vcf_2bn(res,fc);
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 = 0.01 * 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 = 0.01 * 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);
|
f8015f984a1d9a69d0c3176bc75944759ec68d22b2413e3f49f9c4509f581faf | tonal-glyph/faustus | 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 = ve.moog_vcf_2bn(res,fc);
// 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 = 0.01 * 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 = 0.01 * 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/tonal-glyph/faustus/cc887b115aceaee202edbdb37ee0e4087bfb5a33/examples/SAM/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
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 = ve.moog_vcf_2bn(res,fc);
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 = 0.01 * 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 = 0.01 * 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));
|
0e2660fc73dd84c609a0c78607b446208a3eb85dc01fc698404da15b09ffa2e6 | schollz/zxcvbn | fverb.dsp | //
// Référence:
// Dattorro, Jon. "Effect design, part 1: Reverberator and other filters."
// Journal of the Audio Engineering Society 45.9 (1997): 660-684.
//
declare name "fverb";
declare author "Jean Pierre Cimalando";
declare version "0.5";
declare license "BSD-2-Clause";
import("stdfaust.lib");
ptMax = 300e-3;
pt = hslider("[01] Predelay [symbol:predelay] [unit:ms]", 0., 0., ptMax*1e3, 1.) : *(1e-3) : si.smoo;
ing = hslider("[02] Input amount [symbol:input] [unit:%]", 100., 0., 100., 0.01) : *(0.01) : si.smoo;
tone = hslider("[03] Input low-pass cutoff [symbol:input_lowpass] [unit:Hz] [scale:log]", 10000., 1., 20000., 1.);
htone = hslider("[04] Input high-pass cutoff [symbol:input_highpass] [unit:Hz] [scale:log]", 100., 1., 1000., 1.);
id1 = hslider("[05] Input diffusion 1 [symbol:input_diffusion_1] [unit:%]", 75., 0., 100., 0.01) : *(0.01) : si.smoo;
id2 = hslider("[06] Input diffusion 2 [symbol:input_diffusion_2] [unit:%]", 62.5, 0., 100., 0.01) : *(0.01) : si.smoo;
dd1 = hslider("[07] Tail density [symbol:tail_density] [unit:%]", 70., 0., 100., 0.01) : *(0.01) : si.smoo;
dd2 = (dr + 0.15) : max(0.25) : min(0.5); /* (cf. table 1 Reverberation parameters) */
dr = hslider("[08] Decay [symbol:decay] [unit:%]", 50., 0., 100., 0.01) : *(0.01) : si.smoo;
damp = hslider("[09] Damping [symbol:damping] [unit:Hz] [scale:log]", 5500., 10., 20000., 1.);
modf = /*1.0*/hslider("[10] Modulator frequency [symbol:mod_frequency] [unit:Hz]", 1., 0.01, 4., 0.01) : si.smoo;
maxModt = 10e-3;
modt = hslider("[11] Modulator depth [symbol:mod_depth] [unit:ms]", 0.5, 0., maxModt*1e3, 0.1) : *(1e-3) : si.smoo;
dry = hslider("[12] Dry [symbol:dry] [unit:%]", 100., 0., 100., 0.01) : *(0.01) : si.smoo;
wet = hslider("[13] Wet [symbol:wet] [unit:%]", 50., 0., 100., 0.01) : *(0.01) : si.smoo;
/* 0:full stereo, 1:full mono */
cmix = 0.; //hslider("[12] Stereo cross mix", 0., 0., 1., 0.01) : *(0.5);
/* for complete control of decay parameters */
// dd1 = hslider("[05] Decay diffusion 1 [unit:%]", 70., 0., 100., 0.01) : *(0.01) : si.smoo;
// dd2 = hslider("[06] Decay diffusion 2 [unit:%]", 50., 0., 100., 0.01) : *(0.01) : si.smoo;
fverb(lIn, rIn) =
((preInL : preInjectorL), (preInR : preInjectorR)) :
crossInjector(ff1A, ff1B, ff1C, fb1, ff2A, ff2B, ff2C, fb2) :
outputReconstruction
with {
// this reverb was designed for nominal rate of 29761 Hz
T(x) = x/refSR with { refSR = 29761.; }; // reference time to seconds
// stereo input (reference was mono downmixed)
preInL = (1.-cmix)*lIn+cmix*rIn : *(ing);
preInR = (1.-cmix)*rIn+cmix*lIn : *(ing);
/* before entry into tank */
/* Note(jpc) different delays left and right in hope to decorrelate more.
values not documented anywhere, just out of my magic hat */
preInjectorL = predelay : toneLpf(tone) : toneHpf(htone) :
diffusion(id1, 1.03*T(142)) : diffusion(id1, 0.97*T(107)) :
diffusion(id2, 0.97*T(379)) : diffusion(id2, 1.03*T(277));
preInjectorR = predelay : toneLpf(tone) : toneHpf(htone) :
diffusion(id1, 0.97*T(142)) : diffusion(id1, 1.03*T(107)) :
diffusion(id2, 1.03*T(379)) : diffusion(id2, 0.97*T(277));
/* the default for mixed down mono input */
// preInjector = predelay : toneLpf(tone) :
// diffusion(id1, T(142)) : diffusion(id1, T(107)) :
// diffusion(id2, T(379)) : diffusion(id2, T(277));
/*
(cf. 1.3.7 Delay Modulation)
Linear delay interpolation introduces undesired damping artifacts,
this problem is resolved by using all-pass interpolation instead.
Note(jpc) I'm told Dual Delay Interpolation aka `sdelay` works better and
exhibits less artifacts. The choice of time constant is for now
arbitrary, based on some hints in the documentation of `sdelay`.
*/
fcomb = ddi(10e-3)/*allpass*/ with {
linear = fi.allpass_fcomb;
lagrange = fi.allpass_fcomb5;
allpass = fi.allpass_fcomb1a;
ddi(it, maxdel, N, aN) = (+ <: de.sdelay(maxdel, int(ma.SR*it), N-1),*(aN)) ~ *(-aN) : mem,_ : +;
};
delayDim(t) = 65536; // TODO(jpc) expression below does not work?
//delayDim(t) = ma.nextpow2(t*maxSR) with { maxSR = 192000. };
predelay = de.delay(delayDim(ptMax), int(pt*ma.SR));
toneLpf(f) = fi.iir((1.-p), (0.-p)) with { p = exp(-2.*ma.PI*f/ma.SR) : si.smoo; };
toneHpf(f) = fi.iir((0.5*(1.+p),-0.5*(1.+p)), (0.-p)) with { p = exp(-2.*ma.PI*f/ma.SR) : si.smoo; };
/* note(jpc) round fixed delays to samples to make it faster */
diffusion(amt, del) = fi.allpass_comb/*fcomb*/(delayDim(del), int(del*ma.SR), amt);
dd1Mod1 = dd1OscPair : (_, !);
//dd1Mod2 = dd1Mod1;
/*
(cf. 1.3.7 Delay Modulation)
A different secondary oscillator can decorrelate the signal further and
create more resonances.
*/
dd1Mod2 = dd1OscPair : (!, _);
/* prefer a quadrature oscillator if frequency is fixed */
//dd1OscPair = os.oscq(modf);
/* otherwise use a phase-synchronized pair */
dd1OscPair = sine(p), cosine(p) with {
sine(p) = rdtable(tablesize, os.sinwaveform(tablesize), int(p*tablesize));
cosine(p) = sine(wrap(p+0.25));
tablesize = 1 << 16;
}
letrec {
'p = wrap(p+modf*(1./ma.SR));
};
wrap(p) = p-int(p);
fixedDelay(t) = de.delay(delayDim(t), int(ma.SR*t));
modulatedFcomb(t, tMaxExc, tMod, g) = fcomb(delayDim(t+tMaxExc), int(ma.SR*(t+tMod)), g);
ff1A = modulatedFcomb(T(762), maxModt, dd1Mod1*modt, ma.neg(dd1));
ff1B = fixedDelay(T(4453)) : toneLpf(damp);
ff1C = *(dr) : diffusion(ma.neg(dd2), T(1800));
fb1 = fixedDelay(T(3720)) : *(dr);
ff2A = modulatedFcomb(T(908), maxModt, dd1Mod2*modt, ma.neg(dd1));
ff2B = fixedDelay(T(4217)) : toneLpf(damp);
ff2C = *(dr) : diffusion(ma.neg(dd2), T(2656));
fb2 = fixedDelay(T(3163)) : *(dr);
outputReconstruction(n1, n2, n3, n4, n5, n6) =
0.6*sum(i, 7, lTap(i)), 0.6*sum(i, 7, rTap(i))
with {
lTap(0) = n4 : fixedDelay(T(266));
lTap(1) = n4 : fixedDelay(T(2974));
lTap(2) = n5 : fixedDelay(T(1913)) : ma.neg;
lTap(3) = n6 : fixedDelay(T(1996));
lTap(4) = n1 : fixedDelay(T(1990)) : ma.neg;
lTap(5) = n2 : fixedDelay(T(187)) : ma.neg;
lTap(6) = n3 : fixedDelay(T(1066)) : ma.neg;
//
rTap(0) = n1 : fixedDelay(T(353));
rTap(1) = n1 : fixedDelay(T(3627));
rTap(2) = n2 : fixedDelay(T(1228)) : ma.neg;
rTap(3) = n3 : fixedDelay(T(2673));
rTap(4) = n4 : fixedDelay(T(2111)) : ma.neg;
rTap(5) = n5 : fixedDelay(T(335)) : ma.neg;
rTap(6) = n6 : fixedDelay(T(121)) : ma.neg;
};
/*
* A1 B1 C1
* ^ ^ ^
* | | |
* in1 -> [+] ----> [ . ff1 . ] >--.---.
* ^ |
* | |
* .----< [fb1] <--- [z-1] <-------.
* | |
* .----< [fb2] <--- [z-1] <---. |
* | |
* v |
* in2 -> [+] ----> [ . ff2 . ] >--.-------.
* | | |
* v v v
* A2 B2 C2
*
* note: implicit unit delay in the feedback paths
*/
crossInjector(
ff1A, ff1B, ff1C, fb1,
ff2A, ff2B, ff2C, fb2,
in1, in2) =
A1, B1, C1,
A2, B2, C2
letrec {
'A1 = C2 : fb1 : +(in1) : ff1A;
'B1 = C2 : fb1 : +(in1) : ff1A : ff1B;
'C1 = C2 : fb1 : +(in1) : ff1A : ff1B : ff1C;
'A2 = C1 : fb2 : +(in2) : ff2A;
'B2 = C1 : fb2 : +(in2) : ff2A : ff2B;
'C2 = C1 : fb2 : +(in2) : ff2A : ff2B : ff2C;
};
};
process(l, r) = fverb(l, r) /* : mix */ with {
mix(rl, rr) = dry*l+wet*rl, dry*r+wet*rr;
};
| https://raw.githubusercontent.com/schollz/zxcvbn/1026fc072d21df0de0ce4f05358e99dd7f8915aa/lib/ignore/fverb/fverb.dsp | faust |
Référence:
Dattorro, Jon. "Effect design, part 1: Reverberator and other filters."
Journal of the Audio Engineering Society 45.9 (1997): 660-684.
(cf. table 1 Reverberation parameters)
1.0
0:full stereo, 1:full mono
hslider("[12] Stereo cross mix", 0., 0., 1., 0.01) : *(0.5);
for complete control of decay parameters
dd1 = hslider("[05] Decay diffusion 1 [unit:%]", 70., 0., 100., 0.01) : *(0.01) : si.smoo;
dd2 = hslider("[06] Decay diffusion 2 [unit:%]", 50., 0., 100., 0.01) : *(0.01) : si.smoo;
this reverb was designed for nominal rate of 29761 Hz
reference time to seconds
stereo input (reference was mono downmixed)
before entry into tank
Note(jpc) different delays left and right in hope to decorrelate more.
values not documented anywhere, just out of my magic hat
the default for mixed down mono input
preInjector = predelay : toneLpf(tone) :
diffusion(id1, T(142)) : diffusion(id1, T(107)) :
diffusion(id2, T(379)) : diffusion(id2, T(277));
(cf. 1.3.7 Delay Modulation)
Linear delay interpolation introduces undesired damping artifacts,
this problem is resolved by using all-pass interpolation instead.
Note(jpc) I'm told Dual Delay Interpolation aka `sdelay` works better and
exhibits less artifacts. The choice of time constant is for now
arbitrary, based on some hints in the documentation of `sdelay`.
allpass
TODO(jpc) expression below does not work?
delayDim(t) = ma.nextpow2(t*maxSR) with { maxSR = 192000. };
note(jpc) round fixed delays to samples to make it faster
fcomb
dd1Mod2 = dd1Mod1;
(cf. 1.3.7 Delay Modulation)
A different secondary oscillator can decorrelate the signal further and
create more resonances.
prefer a quadrature oscillator if frequency is fixed
dd1OscPair = os.oscq(modf);
otherwise use a phase-synchronized pair
* A1 B1 C1
* ^ ^ ^
* | | |
* in1 -> [+] ----> [ . ff1 . ] >--.---.
* ^ |
* | |
* .----< [fb1] <--- [z-1] <-------.
* | |
* .----< [fb2] <--- [z-1] <---. |
* | |
* v |
* in2 -> [+] ----> [ . ff2 . ] >--.-------.
* | | |
* v v v
* A2 B2 C2
*
* note: implicit unit delay in the feedback paths
: mix |
declare name "fverb";
declare author "Jean Pierre Cimalando";
declare version "0.5";
declare license "BSD-2-Clause";
import("stdfaust.lib");
ptMax = 300e-3;
pt = hslider("[01] Predelay [symbol:predelay] [unit:ms]", 0., 0., ptMax*1e3, 1.) : *(1e-3) : si.smoo;
ing = hslider("[02] Input amount [symbol:input] [unit:%]", 100., 0., 100., 0.01) : *(0.01) : si.smoo;
tone = hslider("[03] Input low-pass cutoff [symbol:input_lowpass] [unit:Hz] [scale:log]", 10000., 1., 20000., 1.);
htone = hslider("[04] Input high-pass cutoff [symbol:input_highpass] [unit:Hz] [scale:log]", 100., 1., 1000., 1.);
id1 = hslider("[05] Input diffusion 1 [symbol:input_diffusion_1] [unit:%]", 75., 0., 100., 0.01) : *(0.01) : si.smoo;
id2 = hslider("[06] Input diffusion 2 [symbol:input_diffusion_2] [unit:%]", 62.5, 0., 100., 0.01) : *(0.01) : si.smoo;
dd1 = hslider("[07] Tail density [symbol:tail_density] [unit:%]", 70., 0., 100., 0.01) : *(0.01) : si.smoo;
dr = hslider("[08] Decay [symbol:decay] [unit:%]", 50., 0., 100., 0.01) : *(0.01) : si.smoo;
damp = hslider("[09] Damping [symbol:damping] [unit:Hz] [scale:log]", 5500., 10., 20000., 1.);
maxModt = 10e-3;
modt = hslider("[11] Modulator depth [symbol:mod_depth] [unit:ms]", 0.5, 0., maxModt*1e3, 0.1) : *(1e-3) : si.smoo;
dry = hslider("[12] Dry [symbol:dry] [unit:%]", 100., 0., 100., 0.01) : *(0.01) : si.smoo;
wet = hslider("[13] Wet [symbol:wet] [unit:%]", 50., 0., 100., 0.01) : *(0.01) : si.smoo;
fverb(lIn, rIn) =
((preInL : preInjectorL), (preInR : preInjectorR)) :
crossInjector(ff1A, ff1B, ff1C, fb1, ff2A, ff2B, ff2C, fb2) :
outputReconstruction
with {
preInL = (1.-cmix)*lIn+cmix*rIn : *(ing);
preInR = (1.-cmix)*rIn+cmix*lIn : *(ing);
preInjectorL = predelay : toneLpf(tone) : toneHpf(htone) :
diffusion(id1, 1.03*T(142)) : diffusion(id1, 0.97*T(107)) :
diffusion(id2, 0.97*T(379)) : diffusion(id2, 1.03*T(277));
preInjectorR = predelay : toneLpf(tone) : toneHpf(htone) :
diffusion(id1, 0.97*T(142)) : diffusion(id1, 1.03*T(107)) :
diffusion(id2, 1.03*T(379)) : diffusion(id2, 0.97*T(277));
linear = fi.allpass_fcomb;
lagrange = fi.allpass_fcomb5;
allpass = fi.allpass_fcomb1a;
ddi(it, maxdel, N, aN) = (+ <: de.sdelay(maxdel, int(ma.SR*it), N-1),*(aN)) ~ *(-aN) : mem,_ : +;
};
predelay = de.delay(delayDim(ptMax), int(pt*ma.SR));
toneLpf(f) = fi.iir((1.-p), (0.-p)) with { p = exp(-2.*ma.PI*f/ma.SR) : si.smoo; };
toneHpf(f) = fi.iir((0.5*(1.+p),-0.5*(1.+p)), (0.-p)) with { p = exp(-2.*ma.PI*f/ma.SR) : si.smoo; };
dd1Mod1 = dd1OscPair : (_, !);
dd1Mod2 = dd1OscPair : (!, _);
dd1OscPair = sine(p), cosine(p) with {
sine(p) = rdtable(tablesize, os.sinwaveform(tablesize), int(p*tablesize));
cosine(p) = sine(wrap(p+0.25));
tablesize = 1 << 16;
}
letrec {
'p = wrap(p+modf*(1./ma.SR));
};
wrap(p) = p-int(p);
fixedDelay(t) = de.delay(delayDim(t), int(ma.SR*t));
modulatedFcomb(t, tMaxExc, tMod, g) = fcomb(delayDim(t+tMaxExc), int(ma.SR*(t+tMod)), g);
ff1A = modulatedFcomb(T(762), maxModt, dd1Mod1*modt, ma.neg(dd1));
ff1B = fixedDelay(T(4453)) : toneLpf(damp);
ff1C = *(dr) : diffusion(ma.neg(dd2), T(1800));
fb1 = fixedDelay(T(3720)) : *(dr);
ff2A = modulatedFcomb(T(908), maxModt, dd1Mod2*modt, ma.neg(dd1));
ff2B = fixedDelay(T(4217)) : toneLpf(damp);
ff2C = *(dr) : diffusion(ma.neg(dd2), T(2656));
fb2 = fixedDelay(T(3163)) : *(dr);
outputReconstruction(n1, n2, n3, n4, n5, n6) =
0.6*sum(i, 7, lTap(i)), 0.6*sum(i, 7, rTap(i))
with {
lTap(0) = n4 : fixedDelay(T(266));
lTap(1) = n4 : fixedDelay(T(2974));
lTap(2) = n5 : fixedDelay(T(1913)) : ma.neg;
lTap(3) = n6 : fixedDelay(T(1996));
lTap(4) = n1 : fixedDelay(T(1990)) : ma.neg;
lTap(5) = n2 : fixedDelay(T(187)) : ma.neg;
lTap(6) = n3 : fixedDelay(T(1066)) : ma.neg;
rTap(0) = n1 : fixedDelay(T(353));
rTap(1) = n1 : fixedDelay(T(3627));
rTap(2) = n2 : fixedDelay(T(1228)) : ma.neg;
rTap(3) = n3 : fixedDelay(T(2673));
rTap(4) = n4 : fixedDelay(T(2111)) : ma.neg;
rTap(5) = n5 : fixedDelay(T(335)) : ma.neg;
rTap(6) = n6 : fixedDelay(T(121)) : ma.neg;
};
crossInjector(
ff1A, ff1B, ff1C, fb1,
ff2A, ff2B, ff2C, fb2,
in1, in2) =
A1, B1, C1,
A2, B2, C2
letrec {
'A1 = C2 : fb1 : +(in1) : ff1A;
'B1 = C2 : fb1 : +(in1) : ff1A : ff1B;
'C1 = C2 : fb1 : +(in1) : ff1A : ff1B : ff1C;
'A2 = C1 : fb2 : +(in2) : ff2A;
'B2 = C1 : fb2 : +(in2) : ff2A : ff2B;
'C2 = C1 : fb2 : +(in2) : ff2A : ff2B : ff2C;
};
};
mix(rl, rr) = dry*l+wet*rl, dry*r+wet*rr;
};
|
fd6fbee782c62f471a4650e1df0c270ffaeef6ea9949fd9ba6a62a490cd08df5 | Jacajack/stm32-faust-synth | panel.dsp | import("stdfaust.lib");
import("j.lib");
declare polyphony "4";
// EG
eg( gate ) = en.adsre( A, D, S, R, gate )
with
{
A = hslider( "A [analog: c5]", 0.5, 0, 1, 0.001 ) : lin2exp( 0.01, 4 ) : si.smoo;
D = hslider( "D [analog: c6]", 0.5, 0, 1, 0.001 ) : lin2exp( 0.01, 4 ) : si.smoo;
S = hslider( "S [analog: c3]", 0.5, 0, 1, 0.001 ) : si.smoo;
R = hslider( "R [analog: c4]", 0.5, 0, 1, 0.001 ) : lin2exp( 0.01, 4 ) : si.smoo;
};
// filter EG
feg( gate ) = en.adsre( A, D, S, R, gate )
with
{
A = hslider( "FA [analog: c9]", 0.5, 0, 1, 0.001 ) : lin2exp( 0.01, 4 ) : si.smoo;
D = hslider( "FD [analog: c10]", 0.5, 0, 1, 0.001 ) : lin2exp( 0.01, 4 ) : si.smoo;
S = hslider( "FS [analog: c7]", 0.5, 0, 1, 0.001 ) : si.smoo;
R = hslider( "FR [analog: c8]", 0.5, 0, 1, 0.001 ) : lin2exp( 0.01, 4 ) : si.smoo;
};
// Oscillators
/*, os.triangle( 50 ), os.square( 120 ), os.square( 222 ), os.square( 44 )*/
osc( note ) = ( polyblep_triangle( f ) + polyblep_saw(f1) + polyblep_saw(f2) ) / 3
// osc( note ) = ( os.triangle( f ) + os.sawtooth(f1) + os.sawtooth(f2) ) / 3
with
{
oct1 = hslider( "osc1oct [analog: d10]", 0, -1.5, 1.5, 1 ) : int : _ * 12;
oct2 = hslider( "osc2oct [analog: d9]", 0, -1.5, 1.5, 1 ) : int : _ * 12;
note1 = note + ( hslider( "osc1tune [analog: d7]", 0, -12, 12, 0.001 ) : si.smoo ) + oct1;
note2 = note + ( hslider( "osc2tune [analog: d8]", 0, -12, 12, 0.001 ) : si.smoo ) + oct2;
tri_enabled = hslider( "trienabled [analog: d4]", 0, 0, 1.5, 0.001 ) : int;
f = note : mid2hz;
f1 = note1 : mid2hz;
f2 = note2 : mid2hz;
};
// Filter Moog
lpf_moog( envelope ) = ve.moog_vcf_2b( resonance, cutoff )
with
{
fc_knob = hslider( "fc [analog: d3]", 0.5, 0, 1, 0.001 ) : si.smoo;
envelope_int = hslider( "fc_env_int [analog: d6]", 0, -1, 1, 0.001 ) : si.smoo;
resonance = hslider( "reso [analog: d5]", 0.5, 0, 1, 0.001 ) : si.smoo;
fc_env = envelope_int * envelope;
cutoff = ( fc_knob + fc_env ) : min( 1 ) : max( 0 ) : lin2exp( 20, 20000 );
};
// Filter Korg
lpf( envelope ) = ve.korg35LPF( cutoff, resonance )
with
{
fc_knob = hslider( "fc [analog: d3]", 0.5, 0, 1, 0.001 ) : si.smoo;
envelope_int = hslider( "fc_env_int [analog: d6]", 0, -1, 1, 0.001 ) : si.smoo;
resonance = hslider( "reso [analog: d5]", 0.5, 0, 10, 0.001 ) : si.smoo;
fc_env = envelope_int * envelope;
cutoff = ( fc_knob + fc_env ) : min( 1 ) : max( 0 );
};
voice( note, gate ) = oscillator : filter * envelope
with
{
oscillator = osc( note );
envelope = eg( gate );
filter = lpf( feg( gate ) );
};
gate_0 = button( "gate_0" );
gate_1 = button( "gate_1" );
gate_2 = button( "gate_2" );
gate_3 = button( "gate_3" );
note_0 = hslider( "note_0", 0, 0, 127, 1 );
note_1 = hslider( "note_1", 0, 0, 127, 1 );
note_2 = hslider( "note_2", 0, 0, 127, 1 );
note_3 = hslider( "note_3", 0, 0, 127, 1 );
process = 0.25 * ( voice( note_0, gate_0 ) + voice( note_1, gate_1 ) + voice( note_2, gate_2 ) + voice( note_3, gate_3 ) );
// process = ( voice( note_0, gate_0 ) + voice( note_1, gate_1 ) + voice( note_2, gate_2 ) ) / 3; | https://raw.githubusercontent.com/Jacajack/stm32-faust-synth/5987bc2508e94318affbbccaaeaea0fd7f7ad694/faust/panel.dsp | faust | EG
filter EG
Oscillators
, os.triangle( 50 ), os.square( 120 ), os.square( 222 ), os.square( 44 )
osc( note ) = ( os.triangle( f ) + os.sawtooth(f1) + os.sawtooth(f2) ) / 3
Filter Moog
Filter Korg
process = ( voice( note_0, gate_0 ) + voice( note_1, gate_1 ) + voice( note_2, gate_2 ) ) / 3; | import("stdfaust.lib");
import("j.lib");
declare polyphony "4";
eg( gate ) = en.adsre( A, D, S, R, gate )
with
{
A = hslider( "A [analog: c5]", 0.5, 0, 1, 0.001 ) : lin2exp( 0.01, 4 ) : si.smoo;
D = hslider( "D [analog: c6]", 0.5, 0, 1, 0.001 ) : lin2exp( 0.01, 4 ) : si.smoo;
S = hslider( "S [analog: c3]", 0.5, 0, 1, 0.001 ) : si.smoo;
R = hslider( "R [analog: c4]", 0.5, 0, 1, 0.001 ) : lin2exp( 0.01, 4 ) : si.smoo;
};
feg( gate ) = en.adsre( A, D, S, R, gate )
with
{
A = hslider( "FA [analog: c9]", 0.5, 0, 1, 0.001 ) : lin2exp( 0.01, 4 ) : si.smoo;
D = hslider( "FD [analog: c10]", 0.5, 0, 1, 0.001 ) : lin2exp( 0.01, 4 ) : si.smoo;
S = hslider( "FS [analog: c7]", 0.5, 0, 1, 0.001 ) : si.smoo;
R = hslider( "FR [analog: c8]", 0.5, 0, 1, 0.001 ) : lin2exp( 0.01, 4 ) : si.smoo;
};
osc( note ) = ( polyblep_triangle( f ) + polyblep_saw(f1) + polyblep_saw(f2) ) / 3
with
{
oct1 = hslider( "osc1oct [analog: d10]", 0, -1.5, 1.5, 1 ) : int : _ * 12;
oct2 = hslider( "osc2oct [analog: d9]", 0, -1.5, 1.5, 1 ) : int : _ * 12;
note1 = note + ( hslider( "osc1tune [analog: d7]", 0, -12, 12, 0.001 ) : si.smoo ) + oct1;
note2 = note + ( hslider( "osc2tune [analog: d8]", 0, -12, 12, 0.001 ) : si.smoo ) + oct2;
tri_enabled = hslider( "trienabled [analog: d4]", 0, 0, 1.5, 0.001 ) : int;
f = note : mid2hz;
f1 = note1 : mid2hz;
f2 = note2 : mid2hz;
};
lpf_moog( envelope ) = ve.moog_vcf_2b( resonance, cutoff )
with
{
fc_knob = hslider( "fc [analog: d3]", 0.5, 0, 1, 0.001 ) : si.smoo;
envelope_int = hslider( "fc_env_int [analog: d6]", 0, -1, 1, 0.001 ) : si.smoo;
resonance = hslider( "reso [analog: d5]", 0.5, 0, 1, 0.001 ) : si.smoo;
fc_env = envelope_int * envelope;
cutoff = ( fc_knob + fc_env ) : min( 1 ) : max( 0 ) : lin2exp( 20, 20000 );
};
lpf( envelope ) = ve.korg35LPF( cutoff, resonance )
with
{
fc_knob = hslider( "fc [analog: d3]", 0.5, 0, 1, 0.001 ) : si.smoo;
envelope_int = hslider( "fc_env_int [analog: d6]", 0, -1, 1, 0.001 ) : si.smoo;
resonance = hslider( "reso [analog: d5]", 0.5, 0, 10, 0.001 ) : si.smoo;
fc_env = envelope_int * envelope;
cutoff = ( fc_knob + fc_env ) : min( 1 ) : max( 0 );
};
voice( note, gate ) = oscillator : filter * envelope
with
{
oscillator = osc( note );
envelope = eg( gate );
filter = lpf( feg( gate ) );
};
gate_0 = button( "gate_0" );
gate_1 = button( "gate_1" );
gate_2 = button( "gate_2" );
gate_3 = button( "gate_3" );
note_0 = hslider( "note_0", 0, 0, 127, 1 );
note_1 = hslider( "note_1", 0, 0, 127, 1 );
note_2 = hslider( "note_2", 0, 0, 127, 1 );
note_3 = hslider( "note_3", 0, 0, 127, 1 );
process = 0.25 * ( voice( note_0, gate_0 ) + voice( note_1, gate_1 ) + voice( note_2, gate_2 ) + voice( note_3, gate_3 ) ); |
f3c26c9f2384542b4bf118987f6e272827af8526b6412bfd6cab321b368b1dde | spencerpeterscodes/Synthesizer | Synthesizer.dsp | import("stdfaust.lib");
declare options "[midi:on]";
//MIDI inputs
freq = hslider("freq", 100, 20, 4000, 1);
gain = nentry("gain", 0.1, 0, 1, 0.01) : si.smoo;
gate = checkbox("gate");
//Example LFO
// lfo_freq = hslider("lfo", 1, 0.1, 20, 0.1);
// lfo1 = os.lf_saw(lfo_freq);
// lfo_on = checkbox("lfo_to_filter");
//normFreq = hslider("Filt.freq.", 0.1, 0., .7, .01) + lfo1 * 0.2 * lfo_on;
//analog_filt3 = ve.oberheimLPF(normFreq, Q);
//Q = hslider("Q", 1, 0.1, 10, 0.1);
//Waveform Gain
gsaw = hslider("saw", 0.1, 0.0, 0.95, 0.01);
gsqu = hslider("square", 0.1, 0.0, 0.95, 0.01);
gtri = hslider("triangle", 0.1, 0.0, 0.95, 0.01);
//Waveform ADSR
adsr = hgroup("AMP EG", en.adsr(at, dt, sl, rt, gate))
with{
at = hslider("[0]Attack[style:knob]", 1, 0.01, 5, 0.01) : si.smoo;
dt = hslider("[1]Decay[style:knob]", 0.5, 0, 1, 0.1) : si.smoo;
sl = hslider("[2]Sustain[style:knob]", 0.5, 0.1, 1, 0.1) : si.smoo;
rt = hslider("[3]Release[style:knob] [unit:s]", 5, 0.5, 10, 0.5) : si.smoo;
};
//Mixer
//lfoSq = os.lf_squarewave(lfoSq_freq);
lfoSquare = hgroup("Square LFO", os.lf_squarewave(lfoSq_freq) * lfoAmm * lfoSwitch)
with{
lfoSq_freq = hslider("LFO Rate", 1, 0.1, 20, 0.1);
lfoAmm = hslider("Amount [style:knob]", 0.15, 0.01, 0.2, 0.01);
lfoSwitch = checkbox("LFO2Filt");
};
// + lfo1 * 0.2 * lfo_on attaches to normFreq between the ) and the : in order to connect the LFO to the frequency cut off
Q = hslider("Q",1,0.5,10,0.01) : si.smoo;
normFreq = hslider("Filter Freq", 0.5, 0, 0.80, 0.01) + lfoSquare : si.smoo;
filter = ve.korg35LPF(normFreq, Q);
//ve.korg35HPF(normFreq, Q);
// Modulation Wheel is controller number 1
// Pitch Bend has a different
//Control
// First 4 tell you the type of command
// the last 4 bits encode the channel
// Pitch bend has its own message
saw = os.sawtooth(freq) * 0.33;
squ = os.square(freq) * 0.33;
tri = os.triangle(freq) * 0.33;
// brightLfoslider = hslider("lfo_Bright", 1.25, 1, 20, 0.125) : si.smoo;
// brightLfo = os.lf_saw(brightLfoslider);
bright = hslider("Brightness", 0, 0, 0.5, 0.01) : si.smoo;
casio = os.CZsquare(saw, bright);
// halfSine = os.CZhalfSine(saw, bright) * 0.1;
//Filters that have a resonance, will increase the gain and make it stronger,
// Filters treating frequencies will reduce the signal on the other
reverb = re.zita_rev1_stereo(1,100,200, 1, 2, ma.SR);
verbOn = checkbox("Reverb Off");
//<: ba.bypass2(verbOn, reverb)
process = (saw * gsaw + squ * gsqu + tri * gtri) : filter * adsr <: _,_;
// reverb = hgroup("Reverb",re.zita_rev1_stereo(rdel,f1,f2,t60dc,t60m,fsmax))
// with{
// rdel = 10;
// f1 = hslider("Frequency 1", 100, 20, 500, 0.1);
// f2 = hslider("Frequency 2", 500, 500, 1000, 0.1);
// t60dc = 1;
// t60m = 2;
// fsmax = ma.SR;
// };
// verbOn = checkbox("Reverb Off") :si.smoo;
//process = casio * gain : filter * adsr <: ba.bypass2(verbOn, reverb) : _,_;
| https://raw.githubusercontent.com/spencerpeterscodes/Synthesizer/30ec13dac8780839c2b46f3afa365142073aae96/Synthesizer.dsp | faust | MIDI inputs
Example LFO
lfo_freq = hslider("lfo", 1, 0.1, 20, 0.1);
lfo1 = os.lf_saw(lfo_freq);
lfo_on = checkbox("lfo_to_filter");
normFreq = hslider("Filt.freq.", 0.1, 0., .7, .01) + lfo1 * 0.2 * lfo_on;
analog_filt3 = ve.oberheimLPF(normFreq, Q);
Q = hslider("Q", 1, 0.1, 10, 0.1);
Waveform Gain
Waveform ADSR
Mixer
lfoSq = os.lf_squarewave(lfoSq_freq);
+ lfo1 * 0.2 * lfo_on attaches to normFreq between the ) and the : in order to connect the LFO to the frequency cut off
ve.korg35HPF(normFreq, Q);
Modulation Wheel is controller number 1
Pitch Bend has a different
Control
First 4 tell you the type of command
the last 4 bits encode the channel
Pitch bend has its own message
brightLfoslider = hslider("lfo_Bright", 1.25, 1, 20, 0.125) : si.smoo;
brightLfo = os.lf_saw(brightLfoslider);
halfSine = os.CZhalfSine(saw, bright) * 0.1;
Filters that have a resonance, will increase the gain and make it stronger,
Filters treating frequencies will reduce the signal on the other
<: ba.bypass2(verbOn, reverb)
reverb = hgroup("Reverb",re.zita_rev1_stereo(rdel,f1,f2,t60dc,t60m,fsmax))
with{
rdel = 10;
f1 = hslider("Frequency 1", 100, 20, 500, 0.1);
f2 = hslider("Frequency 2", 500, 500, 1000, 0.1);
t60dc = 1;
t60m = 2;
fsmax = ma.SR;
};
verbOn = checkbox("Reverb Off") :si.smoo;
process = casio * gain : filter * adsr <: ba.bypass2(verbOn, reverb) : _,_; | import("stdfaust.lib");
declare options "[midi:on]";
freq = hslider("freq", 100, 20, 4000, 1);
gain = nentry("gain", 0.1, 0, 1, 0.01) : si.smoo;
gate = checkbox("gate");
gsaw = hslider("saw", 0.1, 0.0, 0.95, 0.01);
gsqu = hslider("square", 0.1, 0.0, 0.95, 0.01);
gtri = hslider("triangle", 0.1, 0.0, 0.95, 0.01);
adsr = hgroup("AMP EG", en.adsr(at, dt, sl, rt, gate))
with{
at = hslider("[0]Attack[style:knob]", 1, 0.01, 5, 0.01) : si.smoo;
dt = hslider("[1]Decay[style:knob]", 0.5, 0, 1, 0.1) : si.smoo;
sl = hslider("[2]Sustain[style:knob]", 0.5, 0.1, 1, 0.1) : si.smoo;
rt = hslider("[3]Release[style:knob] [unit:s]", 5, 0.5, 10, 0.5) : si.smoo;
};
lfoSquare = hgroup("Square LFO", os.lf_squarewave(lfoSq_freq) * lfoAmm * lfoSwitch)
with{
lfoSq_freq = hslider("LFO Rate", 1, 0.1, 20, 0.1);
lfoAmm = hslider("Amount [style:knob]", 0.15, 0.01, 0.2, 0.01);
lfoSwitch = checkbox("LFO2Filt");
};
Q = hslider("Q",1,0.5,10,0.01) : si.smoo;
normFreq = hslider("Filter Freq", 0.5, 0, 0.80, 0.01) + lfoSquare : si.smoo;
filter = ve.korg35LPF(normFreq, Q);
saw = os.sawtooth(freq) * 0.33;
squ = os.square(freq) * 0.33;
tri = os.triangle(freq) * 0.33;
bright = hslider("Brightness", 0, 0, 0.5, 0.01) : si.smoo;
casio = os.CZsquare(saw, bright);
reverb = re.zita_rev1_stereo(1,100,200, 1, 2, ma.SR);
verbOn = checkbox("Reverb Off");
process = (saw * gsaw + squ * gsqu + tri * gtri) : filter * adsr <: _,_;
|
c75e54cd5d82da6d61958fdd848a10490b295a9a99df8739f66ea2ea05ad94eb | shakfu/soundlab | shax_delay3.dsp | import("stdfaust.lib");
/*
echo1s = vgroup("echo 1000", +~(de.delay(65536, int(hslider("millisecond", 0, 0, 1000, 0.10)*ba.millisec)-1) * (hslider("feedback", 0, 0, 100, 0.1)/100.0)));
echo2s = vgroup("echo 2000", +~(de.delay(131072, int(hslider("millisecond", 0, 0, 2000, 0.25)*ba.millisec)-1) * (hslider("feedback", 0, 0, 100, 0.1)/100.0)));
echo5s = vgroup("echo 5000", +~(de.delay(262144, int(hslider("millisecond", 0, 0, 5000, 0.50)*ba.millisec)-1) * (hslider("feedback", 0, 0, 100, 0.1)/100.0)));
echo10s = vgroup("echo 10000", +~(de.delay(524288, int(hslider("millisecond", 0, 0, 10000, 1.00)*ba.millisec)-1) * (hslider("feedback", 0, 0, 100, 0.1)/100.0)));
echo21s = vgroup("echo 21000", +~(de.delay(1048576, int(hslider("millisecond", 0, 0, 21000, 1.00)*ba.millisec)-1) * (hslider("feedback", 0, 0, 100, 0.1)/100.0)));
echo43s = vgroup("echo 43000", +~(de.delay(2097152, int(hslider("millisecond", 0, 0, 43000, 1.00)*ba.millisec)-1) * (hslider("feedback", 0, 0, 100, 0.1)/100.0)));
*/
echo = +~(de.sdelay(65536, it, ms) * fb)
with {
it = 1024;
ms = int((hslider("time (ms)", 0, 0, 1000, 0.10): si.smoo) * ba.millisec)-1;
fb = (hslider("feedback", 0, 0, 100, 0.1): si.smoo)/100.0;
};
process = vgroup("stereo echo", (echo, echo));
| https://raw.githubusercontent.com/shakfu/soundlab/2941e0ee74d7ade8992e5f2e3b90c7765ec1946b/faust/delays/shax_delay3.dsp | faust |
echo1s = vgroup("echo 1000", +~(de.delay(65536, int(hslider("millisecond", 0, 0, 1000, 0.10)*ba.millisec)-1) * (hslider("feedback", 0, 0, 100, 0.1)/100.0)));
echo2s = vgroup("echo 2000", +~(de.delay(131072, int(hslider("millisecond", 0, 0, 2000, 0.25)*ba.millisec)-1) * (hslider("feedback", 0, 0, 100, 0.1)/100.0)));
echo5s = vgroup("echo 5000", +~(de.delay(262144, int(hslider("millisecond", 0, 0, 5000, 0.50)*ba.millisec)-1) * (hslider("feedback", 0, 0, 100, 0.1)/100.0)));
echo10s = vgroup("echo 10000", +~(de.delay(524288, int(hslider("millisecond", 0, 0, 10000, 1.00)*ba.millisec)-1) * (hslider("feedback", 0, 0, 100, 0.1)/100.0)));
echo21s = vgroup("echo 21000", +~(de.delay(1048576, int(hslider("millisecond", 0, 0, 21000, 1.00)*ba.millisec)-1) * (hslider("feedback", 0, 0, 100, 0.1)/100.0)));
echo43s = vgroup("echo 43000", +~(de.delay(2097152, int(hslider("millisecond", 0, 0, 43000, 1.00)*ba.millisec)-1) * (hslider("feedback", 0, 0, 100, 0.1)/100.0)));
| import("stdfaust.lib");
echo = +~(de.sdelay(65536, it, ms) * fb)
with {
it = 1024;
ms = int((hslider("time (ms)", 0, 0, 1000, 0.10): si.smoo) * ba.millisec)-1;
fb = (hslider("feedback", 0, 0, 100, 0.1): si.smoo)/100.0;
};
process = vgroup("stereo echo", (echo, echo));
|
53780b9b9b5318fff0d7cf852d8988c1819a3079a2ff41d53f721497d5ec6af0 | roelkers/faustpatches | EnsembleOwl.dsp | import("stdfaust.lib");
import("owl.lib");
import("all.lib");
declare owl "[voct:input]";
tune = hslider("Tune[OWL:A]", 0, -2, 2, 0.01);
/////////////////////////////////////////////////////////
// UI ELEMENTS
/////////////////////////////////////////////////////////
//frequency = hslider("Frequency", 0, 0, 10000,0.01);
// GENERAL, Keyboard
crossfm = hslider("Crossfm[OWL:D]",0,0,1000,0.01);
spread = hslider("Spread[OWL:B]",0,0,1,0.001);
bal = hslider("balance[OWL:C]", 1.01,1.01,16,0.001);
numOscs = 16;
//============================================ DSP =======================================
//========================================================================================
fosc(i,f) = f * (1 + i * spread) : quantize(f, eolian);
//f2(f) = f * (1 + spread) : qu.quantize(pitch, qu.eolian);
//f3(f) = f * (1 + 2* spread) : qu.quantize(pitch, qu.eolian);
//f4(f) = f * (1 + 4* spread) : qu.quantize(pitch, qu.eolian);
gainComp(n) = n/sum(i,n,i);
ensosc1(n,f) = (1 - abs(1 / (n-1) * (bal - 1))) * os.osci(fosc(1,f));
ensosc(i,n,f) = (1 - abs(1 / (n-1) * (bal - i))) * os.osci(fosc(i,f) + crossfm * ensosc1(n,fosc(1,f)));
//osc2(f) = os.osci(f2(f) + crossfm * osc1(f1(f)));
//osc3(f) = os.osci(f3(f) + crossfm * osc2(f2(f)));
//osc4(f) = os.osci(f4(f) + crossfm * osc3(f3(f)));
FMall(f) = sum(i,numOscs,ensosc(i,numOscs,f)) * gainComp(numOscs);
process = sample2hertz(tune): FMall;
| https://raw.githubusercontent.com/roelkers/faustpatches/c95a53ea5d331f855a19cdc84ab8a435601dd614/EnsembleOwl.dsp | faust | ///////////////////////////////////////////////////////
UI ELEMENTS
///////////////////////////////////////////////////////
frequency = hslider("Frequency", 0, 0, 10000,0.01);
GENERAL, Keyboard
============================================ DSP =======================================
========================================================================================
f2(f) = f * (1 + spread) : qu.quantize(pitch, qu.eolian);
f3(f) = f * (1 + 2* spread) : qu.quantize(pitch, qu.eolian);
f4(f) = f * (1 + 4* spread) : qu.quantize(pitch, qu.eolian);
osc2(f) = os.osci(f2(f) + crossfm * osc1(f1(f)));
osc3(f) = os.osci(f3(f) + crossfm * osc2(f2(f)));
osc4(f) = os.osci(f4(f) + crossfm * osc3(f3(f))); | import("stdfaust.lib");
import("owl.lib");
import("all.lib");
declare owl "[voct:input]";
tune = hslider("Tune[OWL:A]", 0, -2, 2, 0.01);
crossfm = hslider("Crossfm[OWL:D]",0,0,1000,0.01);
spread = hslider("Spread[OWL:B]",0,0,1,0.001);
bal = hslider("balance[OWL:C]", 1.01,1.01,16,0.001);
numOscs = 16;
fosc(i,f) = f * (1 + i * spread) : quantize(f, eolian);
gainComp(n) = n/sum(i,n,i);
ensosc1(n,f) = (1 - abs(1 / (n-1) * (bal - 1))) * os.osci(fosc(1,f));
ensosc(i,n,f) = (1 - abs(1 / (n-1) * (bal - i))) * os.osci(fosc(i,f) + crossfm * ensosc1(n,fosc(1,f)));
FMall(f) = sum(i,numOscs,ensosc(i,numOscs,f)) * gainComp(numOscs);
process = sample2hertz(tune): FMall;
|
28ccebf16bfc68a92c18d53d5f24a5295cc213b28c9fa506656b95c595ce2d01 | LucaSpanedda/Luca_Spanedda_St_Cecilia_Conservatory_Thesis | PeakholderIIR.dsp | // import faust standard library
import("stdfaust.lib");
// Peak Max with IIR filter and max comparison
peakmax = loop
with{
loop(x) = \(y).((y , abs(x)) : max) ~ _ ;
};
process = _ : peakmax; | https://raw.githubusercontent.com/LucaSpanedda/Luca_Spanedda_St_Cecilia_Conservatory_Thesis/b73b60d9e0b45e09bbf72b1477c21202b895f1bb/ITA/codes/PeakholderIIR.dsp | faust | import faust standard library
Peak Max with IIR filter and max comparison | import("stdfaust.lib");
peakmax = loop
with{
loop(x) = \(y).((y , abs(x)) : max) ~ _ ;
};
process = _ : peakmax; |
3db2dbb44e8bf7cf36d5a8c4b4a3ec153c495dc2c412612c3c40dfb0c17145ff | LucaSpanedda/Luca_Spanedda_St_Cecilia_Conservatory_Thesis | PeakNormalizationIIR.dsp | // import faust standard library
import("stdfaust.lib");
// Peak Max with IIR filter and max comparison
peakmax = loop
with{
loop(x) = \(y).((y , abs(x)) : max) ~ _ ;
};
peaknormalization(x) = 1/(peakmax(x)) * x;
process = _ : peaknormalization; | https://raw.githubusercontent.com/LucaSpanedda/Luca_Spanedda_St_Cecilia_Conservatory_Thesis/b73b60d9e0b45e09bbf72b1477c21202b895f1bb/ITA/codes/PeakNormalizationIIR.dsp | faust | import faust standard library
Peak Max with IIR filter and max comparison | import("stdfaust.lib");
peakmax = loop
with{
loop(x) = \(y).((y , abs(x)) : max) ~ _ ;
};
peaknormalization(x) = 1/(peakmax(x)) * x;
process = _ : peaknormalization; |
6c1c4ebf56fa49b31e52edfab3e60a2fa753eae3ff425fbeca66c7ec4824fdaa | LucaSpanedda/Luca_Spanedda_St_Cecilia_Conservatory_Thesis | LARpeakmax.dsp | // import faust standard library
import("stdfaust.lib");
// LAR with Peak Max - IIR filter and max comparison
peakmax = loop
with{
loop(x) = \(y).((y , abs(x)) : max)~_;
};
LARpeakmax = _ <: (_ * (1 - (_ : peakmax)));
process = _ : LARpeakmax; | https://raw.githubusercontent.com/LucaSpanedda/Luca_Spanedda_St_Cecilia_Conservatory_Thesis/b73b60d9e0b45e09bbf72b1477c21202b895f1bb/ITA/codes/LARpeakmax.dsp | faust | import faust standard library
LAR with Peak Max - IIR filter and max comparison | import("stdfaust.lib");
peakmax = loop
with{
loop(x) = \(y).((y , abs(x)) : max)~_;
};
LARpeakmax = _ <: (_ * (1 - (_ : peakmax)));
process = _ : LARpeakmax; |
a6d17d803ed3c4913efd7df448d2a36f3024b90bf787f40bdde01a621252f453 | LucaSpanedda/Luca_Spanedda_St_Cecilia_Conservatory_Thesis | MovingAverage.dsp | // import faust standard library
import("stdfaust.lib");
movingAverage(seconds, x) = x - (x @ N) : fi.pole(1.0) / N
with {
N = seconds * ma.SR;
};
movingAverageRMS(seconds, x) = sqrt(max(0, movingAverage(seconds, x * x)));
process = movingAverageRMS(1); | https://raw.githubusercontent.com/LucaSpanedda/Luca_Spanedda_St_Cecilia_Conservatory_Thesis/b73b60d9e0b45e09bbf72b1477c21202b895f1bb/ITA/codes/MovingAverage.dsp | faust | import faust standard library | import("stdfaust.lib");
movingAverage(seconds, x) = x - (x @ N) : fi.pole(1.0) / N
with {
N = seconds * ma.SR;
};
movingAverageRMS(seconds, x) = sqrt(max(0, movingAverage(seconds, x * x)));
process = movingAverageRMS(1); |
efd8ecca9c26e4aae2606eaf73b3a404e252606be11edfd52bdc57cd1b74e30f | LucaSpanedda/Guida_Primi_Codici_in_FAUST | 0.72_Clicks_Generator_Envelope.dsp | // ---------------------------------------------------------------------------------
// import Standard Faust library
// https://github.com/grame-cncm/faustlibraries/
import("stdfaust.lib");
clicks(seed,f,samples,amp) = phase
with{
varnoise = (((seed) : (+ @(ma.SR/f)~ *(1103515245)))/2147483647.0);
routeimpulse(a,b) = a : mem, b :> - : _ > 0;
noisemaj = varnoise>0;
noisemin = varnoise<0;
majimpulse = noisemaj <: routeimpulse;
minimpulse = noisemin <: routeimpulse *-1;
outimpulse = majimpulse + minimpulse : _*amp;
phase = outimpulse : (+ : _*samples) ~ _;
};
// clicks(seed,f,samples,amp)
process = clicks(1020,10,0.1,1) <: _,_;
// ---------------------------------------------------------------------------------
| https://raw.githubusercontent.com/LucaSpanedda/Guida_Primi_Codici_in_FAUST/87aee4b33e282204fddc3ae02a23ca8006ad558f/0.72_Clicks_Generator_Envelope.dsp | faust | ---------------------------------------------------------------------------------
import Standard Faust library
https://github.com/grame-cncm/faustlibraries/
clicks(seed,f,samples,amp)
--------------------------------------------------------------------------------- |
import("stdfaust.lib");
clicks(seed,f,samples,amp) = phase
with{
varnoise = (((seed) : (+ @(ma.SR/f)~ *(1103515245)))/2147483647.0);
routeimpulse(a,b) = a : mem, b :> - : _ > 0;
noisemaj = varnoise>0;
noisemin = varnoise<0;
majimpulse = noisemaj <: routeimpulse;
minimpulse = noisemin <: routeimpulse *-1;
outimpulse = majimpulse + minimpulse : _*amp;
phase = outimpulse : (+ : _*samples) ~ _;
};
process = clicks(1020,10,0.1,1) <: _,_;
|
4d5943ff5e13e3207049f9fae7cb455ae785f3de1ee7df29dc706aa484431fd2 | LucaSpanedda/RITI-Room-Is-The-Instrument | SMSoscillators.dsp | // Faust standard libraries
import("stdfaust.lib");
// Spectral Modeling Synthesis
// https://en.wikipedia.org/wiki/Spectral_modeling_synthesis
// INSTRUMENT SPECTRE --------------------------------------
// Import lists: Frequencies, Amps, Bandwidth
spectrefreq = component("frequencies.dsp").frequencieslist;
spectreamps = component("amplitudes.dsp").amplitudeslist;
spectreband = component("bandwidths.dsp").bandwidthslist;
// index of the lists
Flist(index) = ba.take(index + 1, spectrefreq);
Alist(index) = ba.take(index + 1, spectreamps);
BWlist(index) = ba.take(index + 1, spectreband);
oscillatorbanks(B, G, S) = par(i, B, ( os.osc(Flist(i) * S) *
Alist(i)
) * (G)
):> (+/B);
//process = oscillatorbanks(32, 400, 1) <: _,_;
// SMS Out
process = oscillatorbanks(128, 10, 1) <: _,_; | https://raw.githubusercontent.com/LucaSpanedda/RITI-Room-Is-The-Instrument/dc7497f7621a32b070c9f983f75a120d486a5c46/Audio-Analysis/FAUST-SpectralModel/SMSoscillators.dsp | faust | Faust standard libraries
Spectral Modeling Synthesis
https://en.wikipedia.org/wiki/Spectral_modeling_synthesis
INSTRUMENT SPECTRE --------------------------------------
Import lists: Frequencies, Amps, Bandwidth
index of the lists
process = oscillatorbanks(32, 400, 1) <: _,_;
SMS Out | import("stdfaust.lib");
spectrefreq = component("frequencies.dsp").frequencieslist;
spectreamps = component("amplitudes.dsp").amplitudeslist;
spectreband = component("bandwidths.dsp").bandwidthslist;
Flist(index) = ba.take(index + 1, spectrefreq);
Alist(index) = ba.take(index + 1, spectreamps);
BWlist(index) = ba.take(index + 1, spectreband);
oscillatorbanks(B, G, S) = par(i, B, ( os.osc(Flist(i) * S) *
Alist(i)
) * (G)
):> (+/B);
process = oscillatorbanks(128, 10, 1) <: _,_; |
f14fcb541cd711fd6fdf395b04614bec50fce1cc0e3d09a07f77b9024594314f | LucaSpanedda/Sound_reading_and_writing_techniques_in_Faust | TimestretchingSanfilippo.dsp | import("stdfaust.lib");
// buffer(p, x) = de.fdelay(L * ma.SR, p, x);
wIdx = ba.period(L);
buffer(p, x) = it.frwtable(3, L, .0, wIdx, x, p);
hann(x) = sin(ma.frac(x) * ma.PI) ^ 2.0;
grainRate = hslider("grain rate", 50, 10, 100, 1) : si.smoo;
// timeFactor = 1 - hslider("factor", 1, .125, 8.0, .001);
timeFactor = (ma.SR / L) * hslider("factor", 1, .125, 8.0, .001) : si.smoo;
// timePhase = os.phasor(L * ma.SR, (1.0 / L) * timeFactor);
jitter = hslider("jitter", 0, 0, 1, .001) : si.smoo;
timePhase = os.phasor(L, timeFactor) * ((1 - jitter) + no.noise * jitter);
ph1 = os.phasor(1, grainRate);
ph2 = ma.frac(.5 + ph1);
pos1 = ba.sAndH(ph1 < ph1', timePhase) + ph1 * (ma.SR / grainRate);
pos2 = ba.sAndH(ph2 < ph2', timePhase) + ph2 * (ma.SR / grainRate);
head1 = hann(ph1) * buffer(pos1);
head2 = hann(ph2) * buffer(pos2);
L = 48000 * 3; // seconds
timeStretcher(x) = (x <: head1 + head2) <: _ , _;
rIdx = timePhase;
process = timeStretcher;
| https://raw.githubusercontent.com/LucaSpanedda/Sound_reading_and_writing_techniques_in_Faust/bb01eff05a51424c16420a00b383441d8973d85e/0_work-in-progress/TimestretchingSanfilippo.dsp | faust | buffer(p, x) = de.fdelay(L * ma.SR, p, x);
timeFactor = 1 - hslider("factor", 1, .125, 8.0, .001);
timePhase = os.phasor(L * ma.SR, (1.0 / L) * timeFactor);
seconds | import("stdfaust.lib");
wIdx = ba.period(L);
buffer(p, x) = it.frwtable(3, L, .0, wIdx, x, p);
hann(x) = sin(ma.frac(x) * ma.PI) ^ 2.0;
grainRate = hslider("grain rate", 50, 10, 100, 1) : si.smoo;
timeFactor = (ma.SR / L) * hslider("factor", 1, .125, 8.0, .001) : si.smoo;
jitter = hslider("jitter", 0, 0, 1, .001) : si.smoo;
timePhase = os.phasor(L, timeFactor) * ((1 - jitter) + no.noise * jitter);
ph1 = os.phasor(1, grainRate);
ph2 = ma.frac(.5 + ph1);
pos1 = ba.sAndH(ph1 < ph1', timePhase) + ph1 * (ma.SR / grainRate);
pos2 = ba.sAndH(ph2 < ph2', timePhase) + ph2 * (ma.SR / grainRate);
head1 = hann(ph1) * buffer(pos1);
head2 = hann(ph2) * buffer(pos2);
timeStretcher(x) = (x <: head1 + head2) <: _ , _;
rIdx = timePhase;
process = timeStretcher;
|
0c7c4601c2c2467f8d285d1d5e258aa8fb0457955bbedeeb1c6f3aaf693c2753 | LucaSpanedda/Sound_reading_and_writing_techniques_in_Faust | 1.05_Micro_Time_Splicing.dsp | // ---------------------------------------------------------------------------------
// import Standard Faust library
// https://github.com/grame-cncm/faustlibraries/
import("stdfaust.lib");
// MICRO-TIME SPLICING max. lenght 1 second for every sample rate
microtimesplicing
(reconoff,fnoise,fphasor,seed,sampssplice,amprec,sampsimpulse,ampimpulse) =
rwtable(dimension,0.0,indexwrite,_,indexread)
* (impulsewindow*amprec) + impulseraw*ampimpulse
with{
// noise variable in frequency
varnoise = ((seed) : (+ @(ma.SR/fnoise)~ *(1103515245)))/2147483647.0;
// impulse generation (same frequency of the noise)
routeimpulseone(a) = (a-a@( sampssplice )) != 0;
routeimpulsetwo(a) = (a-a@( sampsimpulse)) != 0;
impulsewindow = varnoise : routeimpulseone;
impulseraw = varnoise : routeimpulsetwo;
// phasor scattering with jump based on noise
scatteringphasor = (fphasor/float(ma.SR)) : (+ : ma.decimal)~
(-(_<:(_,*(_,varnoise-varnoise@(1)))):+(varnoise-varnoise@(1)));
out = scatteringphasor*minzerofive;
// recorder (rwtable)
record = reconoff : int;
dimension = 192000;
indexwrite = (+(1) : %(ma.SR : int)) ~ *(record);
indexread = scatteringphasor : *(float(ma.SR)) : int;
};
// microtimesplicing
// (reconoff,fnoise,fphasor,seed,sampssplice,amprec,sampsimpulse,ampimpulse)
process =
microtimesplicing(1,4,1,1657932344,5000,1,3,0.2),
microtimesplicing(1,4,1,1411931142,5000,1,3,0.2);
// ---------------------------------------------------------------------------------
| https://raw.githubusercontent.com/LucaSpanedda/Sound_reading_and_writing_techniques_in_Faust/bb01eff05a51424c16420a00b383441d8973d85e/0_work-in-progress/1.05_Micro_Time_Splicing.dsp | faust | ---------------------------------------------------------------------------------
import Standard Faust library
https://github.com/grame-cncm/faustlibraries/
MICRO-TIME SPLICING max. lenght 1 second for every sample rate
noise variable in frequency
impulse generation (same frequency of the noise)
phasor scattering with jump based on noise
recorder (rwtable)
microtimesplicing
(reconoff,fnoise,fphasor,seed,sampssplice,amprec,sampsimpulse,ampimpulse)
--------------------------------------------------------------------------------- |
import("stdfaust.lib");
microtimesplicing
(reconoff,fnoise,fphasor,seed,sampssplice,amprec,sampsimpulse,ampimpulse) =
rwtable(dimension,0.0,indexwrite,_,indexread)
* (impulsewindow*amprec) + impulseraw*ampimpulse
with{
varnoise = ((seed) : (+ @(ma.SR/fnoise)~ *(1103515245)))/2147483647.0;
routeimpulseone(a) = (a-a@( sampssplice )) != 0;
routeimpulsetwo(a) = (a-a@( sampsimpulse)) != 0;
impulsewindow = varnoise : routeimpulseone;
impulseraw = varnoise : routeimpulsetwo;
scatteringphasor = (fphasor/float(ma.SR)) : (+ : ma.decimal)~
(-(_<:(_,*(_,varnoise-varnoise@(1)))):+(varnoise-varnoise@(1)));
out = scatteringphasor*minzerofive;
record = reconoff : int;
dimension = 192000;
indexwrite = (+(1) : %(ma.SR : int)) ~ *(record);
indexread = scatteringphasor : *(float(ma.SR)) : int;
};
process =
microtimesplicing(1,4,1,1657932344,5000,1,3,0.2),
microtimesplicing(1,4,1,1411931142,5000,1,3,0.2);
|
ad80c75e7bced259993809302b24393dd3bd714514e2792fea17e0df12188d8c | LucaSpanedda/Luca_Spanedda_St_Cecilia_Conservatory_Thesis | PeakEnvelope.dsp | // import faust standard library
import("stdfaust.lib");
// Peak Max IIR filter with max comparison and RT60 Decay
peakenvelope(t, x) = abs(x) <: loop ~ _ * rt60(t)
with{
loop(y, z) = ( (y, z) : max);
rt60(t) = 0.001^((1/ma.SR) / t);
};
decayFactor = 10;
process = _ : peakenvelope(decayFactor); | https://raw.githubusercontent.com/LucaSpanedda/Luca_Spanedda_St_Cecilia_Conservatory_Thesis/b73b60d9e0b45e09bbf72b1477c21202b895f1bb/ITA/codes/PeakEnvelope.dsp | faust | import faust standard library
Peak Max IIR filter with max comparison and RT60 Decay | import("stdfaust.lib");
peakenvelope(t, x) = abs(x) <: loop ~ _ * rt60(t)
with{
loop(y, z) = ( (y, z) : max);
rt60(t) = 0.001^((1/ma.SR) / t);
};
decayFactor = 10;
process = _ : peakenvelope(decayFactor); |
2969eadcb8cc0e3a9242f9c9c679d941ddd21f6ff8d98ed130afa7bca0490cd6 | LucaSpanedda/Guida_Primi_Codici_in_FAUST | 0.31_Fasore_Reset_Fase.dsp | // FASORE con RESET della fase
//Importo la libreria
import("stdfaust.lib");
/* Ora che abbiamo parlato della generazione del fasore
raccogliamo i dati esposti fino ad ora per generare un segnale
non convenzionale: un Fasore con un reset della fase */
but = button("[1]gate segnale");
decimale(x)= x-int(x);
// reset passando alla variabile reset 1. Non reset = 0.
zerophase(reset) = 0.00002 : (+ : decimale) * (1-reset)~ _ ;
process = zerophase(but);
| https://raw.githubusercontent.com/LucaSpanedda/Guida_Primi_Codici_in_FAUST/f6a4ff6e68634cb7f702b332ccd2cea57764b580/0.31_Fasore_Reset_Fase.dsp | faust | FASORE con RESET della fase
Importo la libreria
Ora che abbiamo parlato della generazione del fasore
raccogliamo i dati esposti fino ad ora per generare un segnale
non convenzionale: un Fasore con un reset della fase
reset passando alla variabile reset 1. Non reset = 0. |
import("stdfaust.lib");
but = button("[1]gate segnale");
decimale(x)= x-int(x);
zerophase(reset) = 0.00002 : (+ : decimale) * (1-reset)~ _ ;
process = zerophase(but);
|
c17402786f2e075e04b7946bf1b249fffb618cd833e585c8584487e7690ffe67 | LucaSpanedda/Sound_reading_and_writing_techniques_in_Faust | 2.00_One_Grain.dsp | // ---------------------------------------------------------------------------------
/*
ONE GRAIN:
FIXED READER PHASOR with
Frequency Variable Noise - for change READING position,
same Frequency of the Noise for ENVELOPE Window.
ON A FIXED TABLE OF 1 SECOND (TAPE).
*/
// import Standard Faust library
// https://github.com/grame-cncm/faustlibraries/
import("stdfaust.lib");
// ONEGRAIN max. lenght 1 second for every sample rate
onegrain(reconoff,fnoise,fphasor,seed,powwindow,amprec) =
rwtable(dimension,0.0,indexwrite,_,indexread) * (window*amprec)
with{
// noise variable in frequency
varnoise = ((seed) : (+ @(ma.SR/fnoise)~ *(1103515245)))/2147483647.0;
// window envelope generation (same frequency of the noise)
decimale(step)= step-int(step);
fasore = (fnoise/ma.SR) : (+ : decimale) ~ _;
window = sin(fasore* ma.PI) : pow(powwindow);
// phasor scattering with jump based on noise
scatteringphasor = (fphasor/float(ma.SR)) : (+ : ma.decimal)~
(-(_<:(_,*(_,varnoise-varnoise@(1)))):+(varnoise-varnoise@(1)));
// recorder (rwtable)
record = reconoff : int;
dimension = 192000;
indexwrite = (+(1) : %(ma.SR : int)) ~ *(record);
indexread = scatteringphasor : *(float(ma.SR)) : int;
};
// onegrain(reconoff,fnoise,fphasor,seed,powwindow,amprec)
process = onegrain(1,10,1,1657932344,10,1) <: _,_;
// ---------------------------------------------------------------------------------
| https://raw.githubusercontent.com/LucaSpanedda/Sound_reading_and_writing_techniques_in_Faust/bb01eff05a51424c16420a00b383441d8973d85e/0_work-in-progress/2.00_One_Grain.dsp | faust | ---------------------------------------------------------------------------------
ONE GRAIN:
FIXED READER PHASOR with
Frequency Variable Noise - for change READING position,
same Frequency of the Noise for ENVELOPE Window.
ON A FIXED TABLE OF 1 SECOND (TAPE).
import Standard Faust library
https://github.com/grame-cncm/faustlibraries/
ONEGRAIN max. lenght 1 second for every sample rate
noise variable in frequency
window envelope generation (same frequency of the noise)
phasor scattering with jump based on noise
recorder (rwtable)
onegrain(reconoff,fnoise,fphasor,seed,powwindow,amprec)
--------------------------------------------------------------------------------- |
import("stdfaust.lib");
onegrain(reconoff,fnoise,fphasor,seed,powwindow,amprec) =
rwtable(dimension,0.0,indexwrite,_,indexread) * (window*amprec)
with{
varnoise = ((seed) : (+ @(ma.SR/fnoise)~ *(1103515245)))/2147483647.0;
decimale(step)= step-int(step);
fasore = (fnoise/ma.SR) : (+ : decimale) ~ _;
window = sin(fasore* ma.PI) : pow(powwindow);
scatteringphasor = (fphasor/float(ma.SR)) : (+ : ma.decimal)~
(-(_<:(_,*(_,varnoise-varnoise@(1)))):+(varnoise-varnoise@(1)));
record = reconoff : int;
dimension = 192000;
indexwrite = (+(1) : %(ma.SR : int)) ~ *(record);
indexread = scatteringphasor : *(float(ma.SR)) : int;
};
process = onegrain(1,10,1,1657932344,10,1) <: _,_;
|
0a9ab7c9f5de0cc82d82c3e91c3d8e1a6a106060ee024d93ef09bfb620b123fd | LucaSpanedda/Guida_Primi_Codici_in_FAUST | 0.32_Rampa_Lineare.dsp | // RAMPA LINEARE
//Importo la libreria
import("stdfaust.lib");
/* cambiamo la logica di generazione del Fasore
per generare al suo posto una rampa lineare. */
trig = button("[1]phase reset");
milliseconds = 1000;
// decimalramp permette di passare ai valori solo quando sono tra 0. e 1.
decimalramp(a) = (a < 1) * a;
// linephasor genera una rampa infinita, la cui retroazione si svuota
// quando il valore crescente al suo interno viene moltiplicato * 0.
linephasor(ms,trigger) = +( ((1/ma.SR)/ms)*1000 ) *(1-trig)~_ : decimalramp;
process = linephasor(milliseconds,trig);
| https://raw.githubusercontent.com/LucaSpanedda/Guida_Primi_Codici_in_FAUST/b13fac93d70c545fab92342087c85079d19b69d3/0.32_Rampa_Lineare.dsp | faust | RAMPA LINEARE
Importo la libreria
cambiamo la logica di generazione del Fasore
per generare al suo posto una rampa lineare.
decimalramp permette di passare ai valori solo quando sono tra 0. e 1.
linephasor genera una rampa infinita, la cui retroazione si svuota
quando il valore crescente al suo interno viene moltiplicato * 0. |
import("stdfaust.lib");
trig = button("[1]phase reset");
milliseconds = 1000;
decimalramp(a) = (a < 1) * a;
linephasor(ms,trigger) = +( ((1/ma.SR)/ms)*1000 ) *(1-trig)~_ : decimalramp;
process = linephasor(milliseconds,trig);
|
0828d6c5e762419de308d7b3d2ee5df2b5c691a433325a86694d0a77938e1ab1 | LucaSpanedda/Musical_Studies_of_Chaotic_Systems | 0.13_Filter_TPT-SVF-GUI.dsp | // import Standard Faust library
// https://github.com/grame-cncm/faustlibraries/
import("stdfaust.lib");
// TPT version of the SVF Filter by Vadim Zavalishin
// reference : (by Will Pirkle)
// http://www.willpirkle.com/Downloads/AN-4VirtualAnalogFilters.2.0.pdf
// SVFTPT filter function
SVFTPT(K, Q, CF, Glp , Ghp , Gbp, Gnotch, Gapf, Gubp, Gpeak, Gbshelf, x) = circuitout
with {
g = tan(CF * ma.PI / ma.SR);
R = 1.0 / (2.0 * Q);
G1 = 1.0 / (1.0 + 2.0 * R * g + g * g);
G2 = 2.0 * R + g;
circuit(s1, s2) = u1 , u2 , lp , hp , bp, notch, apf, ubp, peak, bshelf
with {
hp = (x - s1 * G2 - s2) * G1;
v1 = hp * g;
bp = s1 + v1;
v2 = bp * g;
lp = s2 + v2;
u1 = v1 + bp;
u2 = v2 + lp;
notch = x - ((2*R)*bp);
apf = x - ((4*R)*bp);
ubp = ((2*R)*bp);
peak = lp -hp;
bshelf = x + (((2*K)*R)*bp);
};
// choose the output from the SVF Filter (ex. bshelf)
circuitrouting(u1 , u2 , lp , hp , bp, notch, apf, ubp, peak, bshelf) =
lp*Glp+hp*Ghp+bp*Gbp+notch*Gnotch+apf*Gapf+ubp*Gubp+peak*Gpeak+bshelf*Gbshelf;
circuitout = circuit ~ si.bus(2) : circuitrouting;
};
// GUI for the Filter
CF = hslider("Frequency Cut", 1000, 20, 24000 - 20, .001);
Q = hslider("Filter-Q", 0, -60, 60, .001) : ba.db2linear;
K = hslider("Filter-K", 0, -60, 60, .001) : ba.db2linear;
BGlp = checkbox("lowpass");
BGhp = checkbox("highpass");
BGbp = checkbox("bandpass");
BGnotch = checkbox("notch");
BGapf = checkbox("allpass");
BGubp = checkbox("ubandpass");
BGpeak = checkbox("peak");
BGbshelf = checkbox("bshelf");
// Filter parameters and input (x)
svftptfilter(x) =
SVFTPT(K, Q, CF, BGlp , BGhp , BGbp, BGnotch, BGapf, BGubp, BGpeak, BGbshelf, x);
process = no.noise : svftptfilter;
| https://raw.githubusercontent.com/LucaSpanedda/Musical_Studies_of_Chaotic_Systems/d8b78c011cc0b2b75f74643eba78306d6a3f92df/Tools/0.13_Filter_TPT-SVF-GUI.dsp | faust | import Standard Faust library
https://github.com/grame-cncm/faustlibraries/
TPT version of the SVF Filter by Vadim Zavalishin
reference : (by Will Pirkle)
http://www.willpirkle.com/Downloads/AN-4VirtualAnalogFilters.2.0.pdf
SVFTPT filter function
choose the output from the SVF Filter (ex. bshelf)
GUI for the Filter
Filter parameters and input (x) | import("stdfaust.lib");
SVFTPT(K, Q, CF, Glp , Ghp , Gbp, Gnotch, Gapf, Gubp, Gpeak, Gbshelf, x) = circuitout
with {
g = tan(CF * ma.PI / ma.SR);
R = 1.0 / (2.0 * Q);
G1 = 1.0 / (1.0 + 2.0 * R * g + g * g);
G2 = 2.0 * R + g;
circuit(s1, s2) = u1 , u2 , lp , hp , bp, notch, apf, ubp, peak, bshelf
with {
hp = (x - s1 * G2 - s2) * G1;
v1 = hp * g;
bp = s1 + v1;
v2 = bp * g;
lp = s2 + v2;
u1 = v1 + bp;
u2 = v2 + lp;
notch = x - ((2*R)*bp);
apf = x - ((4*R)*bp);
ubp = ((2*R)*bp);
peak = lp -hp;
bshelf = x + (((2*K)*R)*bp);
};
circuitrouting(u1 , u2 , lp , hp , bp, notch, apf, ubp, peak, bshelf) =
lp*Glp+hp*Ghp+bp*Gbp+notch*Gnotch+apf*Gapf+ubp*Gubp+peak*Gpeak+bshelf*Gbshelf;
circuitout = circuit ~ si.bus(2) : circuitrouting;
};
CF = hslider("Frequency Cut", 1000, 20, 24000 - 20, .001);
Q = hslider("Filter-Q", 0, -60, 60, .001) : ba.db2linear;
K = hslider("Filter-K", 0, -60, 60, .001) : ba.db2linear;
BGlp = checkbox("lowpass");
BGhp = checkbox("highpass");
BGbp = checkbox("bandpass");
BGnotch = checkbox("notch");
BGapf = checkbox("allpass");
BGubp = checkbox("ubandpass");
BGpeak = checkbox("peak");
BGbshelf = checkbox("bshelf");
svftptfilter(x) =
SVFTPT(K, Q, CF, BGlp , BGhp , BGbp, BGnotch, BGapf, BGubp, BGpeak, BGbshelf, x);
process = no.noise : svftptfilter;
|
7c779fd81067639a1a3f75f35300d2cfcc1fea1640d28fc560e101a5d7a45dd3 | LucaSpanedda/Luca_Spanedda_St_Cecilia_Conservatory_Thesis | LorenzEquations.dsp | // import faust standard library
import("stdfaust.lib");
LorenzSystem(x0, y0, z0, dt, beta, rho, sigma) = LorenzSystemEquations
with {
x_init = x0-x0'; y_init = y0-y0'; z_init = z0-z0';
LorenzSystemEquations(x, y, z) =
(x + sigma * (y - x) * dt + x_init),
(y + (rho * x - x * z - y) * dt + y_init),
(z + (x * y - beta * z) * dt + z_init);
};
process = LorenzSystem(1.2, 1.3, 1.6, .01, 1.073, 3.518, 10); | https://raw.githubusercontent.com/LucaSpanedda/Luca_Spanedda_St_Cecilia_Conservatory_Thesis/b73b60d9e0b45e09bbf72b1477c21202b895f1bb/ITA/codes/LorenzEquations.dsp | faust | import faust standard library | import("stdfaust.lib");
LorenzSystem(x0, y0, z0, dt, beta, rho, sigma) = LorenzSystemEquations
with {
x_init = x0-x0'; y_init = y0-y0'; z_init = z0-z0';
LorenzSystemEquations(x, y, z) =
(x + sigma * (y - x) * dt + x_init),
(y + (rho * x - x * z - y) * dt + y_init),
(z + (x * y - beta * z) * dt + z_init);
};
process = LorenzSystem(1.2, 1.3, 1.6, .01, 1.073, 3.518, 10); |
d550207b925eaa94f98da60c61230fd40dd17febbd2b01ef6f2b16f021bbddfd | LucaSpanedda/Spanedda-PDlibraries | RTSG_Multiple_Instances.dsp | // ---------------------------------------------------------------------------------
/*
REAL TIME SYNCHRONOUS GRANULATOR with COUNTER:
100 Milliseconds grains with Envelope window shape control.
ON PARALLEL FIXED TABLES OF 1 SECOND (TAPES)
*/
// import Standard Faust library
// https://github.com/grame-cncm/faustlibraries/
import("stdfaust.lib");
counter = hslider("[0] Grains Rec",1,1,40,1);
ampguiin = hslider("[1] Grains Amp In",1,0,1,0.01);
windowgui = hslider("[4] Grains Window",1,1,200,1);
ampgui = hslider("[2] Grains Amp Out",0.1,0,10,0.1);
freqguiplus = hslider("[5] Grains Freq+",1,1,100,1);
freqguiminus = hslider("[6] Grains Freq/",1,1,100,1);
feedbackgui = hslider("[3] Rec Feedback",0,0,1,0.01);
// GRAIN
grain(numbpar,freq,seed,powwindow,amp) =
(rwtable(dimension,0.0,indexwrite,_,indexread)*envelope) <: panning
with{
// COUNTER
condpar = (counter == numbpar); // if counter match par then 1
condmaj = (condpar > 0.5);
condmin = (condpar < 0.5) : mem;
diracmatch = condmaj*condmin;
// GATE (FOR REC) - PEAK HOLD
peakcond(holdTime, x_) = loop ~ _ // hold the dirac impulse for 1000 ms
with {loop(pFB) = ba.if(pReset, abs(x_), pFB)
with {pReset = timerCond | peakCond;
peakCond = abs(x_) >= pFB;
timerCond = loop ~ _
with {loop(tFB) = fi.pole(tReset, tReset) >= (holdTime)
with {tReset = 1 - (peakCond | tFB);
};};};};
partrigger = peakcond(ma.SR, diracmatch); // out 1 for 1 second when match
// NOISE & PHASOR GENERATION
noise = (((+(seed)~*(1103515245))/2147483647.0)+1)*0.5;
noisepan1 = (((+(seed)~*(1443518942))/2147483647.0)+1)*0.5;
noisepan2 = (((+(seed)~*(1423515748))/2147483647.0)+1)*0.5;
decimale(step)=((step)-int(step));
decorrelation = ((((seed)*(1103515245)/2147483647.0)+1)*0.5)*ma.SR; // rand
fasore = (((freq*10)/ma.SR):(+:decimale)~ _) : _@(decorrelation);
// IMPULSE GENERATION
saw = (fasore*-1)+1;
phasemaj = (saw > 0.5);
phasemin = (saw < 0.5) : mem;
diracphase = phasemaj*phasemin;
// SAH THE NOISE FUNCTION (with the impulse)
sahrandom = (*(1 - diracphase) + noise * diracphase) ~ _;
sahrandompan1 = (*(1 - diracphase) + noisepan1 * diracphase) ~ _;
sahrandompan2 = (*(1 - diracphase) + noisepan2 * diracphase) ~ _;
sehout = (sahrandom +1)/2;
sehoutpan1 = (sahrandompan1 +1)/2;
sehoutpan2 = (sahrandompan2 +1)/2;
// READER
recstart = partrigger; // when match the i (par) instance then record
record = recstart : int; // record the memory with the int value of 1
dimension = 192000;
indexwrite = (+(1) : %(ma.SR : int))~ *(record);
indexread = ((fasore*(ma.SR*0.1)) + (sehout*(ma.SR*0.9))) : int;
// ENVELOPE & POW
envelope = ((sin(fasore*ma.PI)):pow(powwindow)*amp); // reder used for env
panning = _*(sehoutpan1), _*(sehoutpan2);
};
// GRANULATOR: PARALLEL PROCESS OF THE GRAIN FUNCTION
parallelgrains =
// granulator (with par on grain function)
// grain(==numbpar,Hz-read,seed-noise,window-shape(pow),amp)
_ <: par( i, 40, grain(i+1,freqguiplus/freqguiminus,219979*(i+1),windowgui,ampgui) );
routingranulator(a,b) = (a+b)*feedbackgui, a, b;
routeout(a,b,c) = b, c;
routegrains = _*ampguiin : (+ : parallelgrains :> routingranulator) ~ _ : routeout;
process = routegrains ;
// --------------------------------------------------------------------------------- | https://raw.githubusercontent.com/LucaSpanedda/Spanedda-PDlibraries/5b818fd8af0377d133505e240a8bf9de9ea05651/slll.pd-main/Win_PD_Externals_FAUST/RTSG_Multiple_Instances.dsp | faust | ---------------------------------------------------------------------------------
REAL TIME SYNCHRONOUS GRANULATOR with COUNTER:
100 Milliseconds grains with Envelope window shape control.
ON PARALLEL FIXED TABLES OF 1 SECOND (TAPES)
import Standard Faust library
https://github.com/grame-cncm/faustlibraries/
GRAIN
COUNTER
if counter match par then 1
GATE (FOR REC) - PEAK HOLD
hold the dirac impulse for 1000 ms
out 1 for 1 second when match
NOISE & PHASOR GENERATION
rand
IMPULSE GENERATION
SAH THE NOISE FUNCTION (with the impulse)
READER
when match the i (par) instance then record
record the memory with the int value of 1
ENVELOPE & POW
reder used for env
GRANULATOR: PARALLEL PROCESS OF THE GRAIN FUNCTION
granulator (with par on grain function)
grain(==numbpar,Hz-read,seed-noise,window-shape(pow),amp)
--------------------------------------------------------------------------------- |
import("stdfaust.lib");
counter = hslider("[0] Grains Rec",1,1,40,1);
ampguiin = hslider("[1] Grains Amp In",1,0,1,0.01);
windowgui = hslider("[4] Grains Window",1,1,200,1);
ampgui = hslider("[2] Grains Amp Out",0.1,0,10,0.1);
freqguiplus = hslider("[5] Grains Freq+",1,1,100,1);
freqguiminus = hslider("[6] Grains Freq/",1,1,100,1);
feedbackgui = hslider("[3] Rec Feedback",0,0,1,0.01);
grain(numbpar,freq,seed,powwindow,amp) =
(rwtable(dimension,0.0,indexwrite,_,indexread)*envelope) <: panning
with{
condmaj = (condpar > 0.5);
condmin = (condpar < 0.5) : mem;
diracmatch = condmaj*condmin;
with {loop(pFB) = ba.if(pReset, abs(x_), pFB)
with {pReset = timerCond | peakCond;
peakCond = abs(x_) >= pFB;
timerCond = loop ~ _
with {loop(tFB) = fi.pole(tReset, tReset) >= (holdTime)
with {tReset = 1 - (peakCond | tFB);
};};};};
noise = (((+(seed)~*(1103515245))/2147483647.0)+1)*0.5;
noisepan1 = (((+(seed)~*(1443518942))/2147483647.0)+1)*0.5;
noisepan2 = (((+(seed)~*(1423515748))/2147483647.0)+1)*0.5;
decimale(step)=((step)-int(step));
fasore = (((freq*10)/ma.SR):(+:decimale)~ _) : _@(decorrelation);
saw = (fasore*-1)+1;
phasemaj = (saw > 0.5);
phasemin = (saw < 0.5) : mem;
diracphase = phasemaj*phasemin;
sahrandom = (*(1 - diracphase) + noise * diracphase) ~ _;
sahrandompan1 = (*(1 - diracphase) + noisepan1 * diracphase) ~ _;
sahrandompan2 = (*(1 - diracphase) + noisepan2 * diracphase) ~ _;
sehout = (sahrandom +1)/2;
sehoutpan1 = (sahrandompan1 +1)/2;
sehoutpan2 = (sahrandompan2 +1)/2;
dimension = 192000;
indexwrite = (+(1) : %(ma.SR : int))~ *(record);
indexread = ((fasore*(ma.SR*0.1)) + (sehout*(ma.SR*0.9))) : int;
panning = _*(sehoutpan1), _*(sehoutpan2);
};
parallelgrains =
_ <: par( i, 40, grain(i+1,freqguiplus/freqguiminus,219979*(i+1),windowgui,ampgui) );
routingranulator(a,b) = (a+b)*feedbackgui, a, b;
routeout(a,b,c) = b, c;
routegrains = _*ampguiin : (+ : parallelgrains :> routingranulator) ~ _ : routeout;
process = routegrains ;
|
a0a56ba2adb5edbdd02bf3523d80fca700ea5064418236f1d6daf3a276f20315 | LucaSpanedda/Luca_Spanedda_St_Cecilia_Conservatory_Thesis | PeakHolderAdaptive.dsp | // import faust standard library
import("stdfaust.lib");
peakHolder(holdTime, x) = loop ~ si.bus(2) : ! , _
with {
loop(timerState, outState) = timer , output
with {
isNewPeak = abs(x) >= outState;
isTimeOut = timerState >= (holdTime * ma.SR - 1);
bypass = isNewPeak | isTimeOut;
timer = ba.if(bypass, 0, timerState + 1);
output = ba.if(bypass, abs(x), outState);
};
};
process = _ : peakHolder(1); | https://raw.githubusercontent.com/LucaSpanedda/Luca_Spanedda_St_Cecilia_Conservatory_Thesis/b73b60d9e0b45e09bbf72b1477c21202b895f1bb/ITA/codes/PeakHolderAdaptive.dsp | faust | import faust standard library | import("stdfaust.lib");
peakHolder(holdTime, x) = loop ~ si.bus(2) : ! , _
with {
loop(timerState, outState) = timer , output
with {
isNewPeak = abs(x) >= outState;
isTimeOut = timerState >= (holdTime * ma.SR - 1);
bypass = isNewPeak | isTimeOut;
timer = ba.if(bypass, 0, timerState + 1);
output = ba.if(bypass, abs(x), outState);
};
};
process = _ : peakHolder(1); |
6f2f724cc806acd0794e0b03fecfd3e68825941587f5d31e4ea97a03c184f468 | LucaSpanedda/Luca_Spanedda_St_Cecilia_Conservatory_Thesis | LorenzSystem.dsp | // import faust standard library
import("stdfaust.lib");
// Lorenz System
LorenzSystem(x0, y0, z0, dt, beta, rho, sigma) = LorenzSystemEquations ~ si.bus(3) :
par(i, 3, _ * 0.002)
with {
x_init = x0-x0'; y_init = y0-y0'; z_init = z0-z0';
LorenzSystemEquations(x, y, z) =
(x + (sigma * (y - x)) * dt + x_init),
(y + ((rho * x) - (x * z) - y) * dt + y_init),
(z + ((x * y) - (beta * z)) * dt + z_init);
};
// Lorenz System Parameters
X = 1.2;
Y = 1.3;
Z = 1.6;
DT = .002;
BETA = 8/3;
RHO = 100;
SIGMA = 10;
process = LorenzSystem(X, Y, Z, DT, BETA, RHO, SIGMA); | https://raw.githubusercontent.com/LucaSpanedda/Luca_Spanedda_St_Cecilia_Conservatory_Thesis/b73b60d9e0b45e09bbf72b1477c21202b895f1bb/ITA/codes/LorenzSystem.dsp | faust | import faust standard library
Lorenz System
Lorenz System Parameters
| import("stdfaust.lib");
LorenzSystem(x0, y0, z0, dt, beta, rho, sigma) = LorenzSystemEquations ~ si.bus(3) :
par(i, 3, _ * 0.002)
with {
x_init = x0-x0'; y_init = y0-y0'; z_init = z0-z0';
LorenzSystemEquations(x, y, z) =
(x + (sigma * (y - x)) * dt + x_init),
(y + ((rho * x) - (x * z) - y) * dt + y_init),
(z + ((x * y) - (beta * z)) * dt + z_init);
};
X = 1.2;
Y = 1.3;
Z = 1.6;
DT = .002;
BETA = 8/3;
RHO = 100;
SIGMA = 10;
process = LorenzSystem(X, Y, Z, DT, BETA, RHO, SIGMA); |
547ad1d9f05ba4e720ed80693521b95a504ab49a5181e4bc69ac758eaac12078 | LucaSpanedda/Luca_Spanedda_St_Cecilia_Conservatory_Thesis | LocalMax.dsp | // import faust standard library
import("stdfaust.lib");
localMax(seconds, x) = loop ~ si.bus(4) : _ , ! , ! , !
with {
loop(yState, timerState, peakState, timeInSamplesState) =
y , timer , peak , timeInSamples
with {
timeInSamples = ba.if(reset + 1 - 1', seconds *
ma.SR, timeInSamplesState);
reset = timerState >= (timeInSamplesState - 1);
timer = ba.if(reset, 1, timerState + 1);
peak = max(abs(x), peakState * (1.0 - reset));
y = ba.if(reset, peak', yState);
};
};
process = os.osc(.1245) : localMax(1); | https://raw.githubusercontent.com/LucaSpanedda/Luca_Spanedda_St_Cecilia_Conservatory_Thesis/b73b60d9e0b45e09bbf72b1477c21202b895f1bb/ITA/codes/LocalMax.dsp | faust | import faust standard library | import("stdfaust.lib");
localMax(seconds, x) = loop ~ si.bus(4) : _ , ! , ! , !
with {
loop(yState, timerState, peakState, timeInSamplesState) =
y , timer , peak , timeInSamples
with {
timeInSamples = ba.if(reset + 1 - 1', seconds *
ma.SR, timeInSamplesState);
reset = timerState >= (timeInSamplesState - 1);
timer = ba.if(reset, 1, timerState + 1);
peak = max(abs(x), peakState * (1.0 - reset));
y = ba.if(reset, peak', yState);
};
};
process = os.osc(.1245) : localMax(1); |
d4434286a088efa0029e2d40b51d07300f14a0b4347a94bfbf08b03c3cf95aad | LucaSpanedda/Musical_Studies_of_Chaotic_Systems | 0.00_Dynamic_Systems.dsp | // FAUST standard library
import("stdfaust.lib");
/*
Laplace's determinism finds its own mathematical formulation
in the modern definition of dynamic system.
A discrete-time dynamic system is given by the pair: X, f
where X indicates the phase space
f is a transformation that associates each point of X with another point.
The behavior of the system relative to study times
it is called the law of evolution, and it describes orbits
which are obtained by iterating the same one over and over again.
An infinite succession of points is associated with each starting point X0 of X
obtained by applying the law of evolution iteratively,
from X0 we then pass to point X1: X1 = f (X0).
If we denote by Xn the point of arrival, the next point of the orbit
will be: Xn + 1 = f (xn)
*/
/*
Il determinismo di Laplace trova una sua formulazione matematica
nella moderna definizione di sistema dinamico.
Un sistema dinamico a tempo discreto è dato dalla coppia: X, f
dove X indica lo spazio delle fasi
f è una trasformazione che associa ogni punto di X ad un altro punto.
Il comportamento del sistema rispetto ai tempi di studio
è chiamata la legge dell'evoluzione e descrive le orbite
che si ottengono ripetendo lo stesso più e più volte.
Ad ogni punto iniziale X0 di X è associata una successione infinita di punti
ottenuto applicando la legge dell'evoluzione in modo iterativo,
da X0 si passa quindi al punto X1: X1 = f (X0).
Se indichiamo con Xn il punto di arrivo, il prossimo punto dell'orbita
sarà: Xn + 1 = f (xn)
*/
Ramp = Xn
letrec{
'Xn = Xn+1;
};
Counter = Ramp / ma.SR : int;
Phasor(f) = Xn
letrec{
'Xn = (Xn+(f/ma.SR))-int(Xn);
};
process = Counter;
| https://raw.githubusercontent.com/LucaSpanedda/Musical_Studies_of_Chaotic_Systems/d8b78c011cc0b2b75f74643eba78306d6a3f92df/Tools/0.00_Dynamic_Systems.dsp | faust | FAUST standard library
Laplace's determinism finds its own mathematical formulation
in the modern definition of dynamic system.
A discrete-time dynamic system is given by the pair: X, f
where X indicates the phase space
f is a transformation that associates each point of X with another point.
The behavior of the system relative to study times
it is called the law of evolution, and it describes orbits
which are obtained by iterating the same one over and over again.
An infinite succession of points is associated with each starting point X0 of X
obtained by applying the law of evolution iteratively,
from X0 we then pass to point X1: X1 = f (X0).
If we denote by Xn the point of arrival, the next point of the orbit
will be: Xn + 1 = f (xn)
Il determinismo di Laplace trova una sua formulazione matematica
nella moderna definizione di sistema dinamico.
Un sistema dinamico a tempo discreto è dato dalla coppia: X, f
dove X indica lo spazio delle fasi
f è una trasformazione che associa ogni punto di X ad un altro punto.
Il comportamento del sistema rispetto ai tempi di studio
è chiamata la legge dell'evoluzione e descrive le orbite
che si ottengono ripetendo lo stesso più e più volte.
Ad ogni punto iniziale X0 di X è associata una successione infinita di punti
ottenuto applicando la legge dell'evoluzione in modo iterativo,
da X0 si passa quindi al punto X1: X1 = f (X0).
Se indichiamo con Xn il punto di arrivo, il prossimo punto dell'orbita
sarà: Xn + 1 = f (xn)
| import("stdfaust.lib");
Ramp = Xn
letrec{
'Xn = Xn+1;
};
Counter = Ramp / ma.SR : int;
Phasor(f) = Xn
letrec{
'Xn = (Xn+(f/ma.SR))-int(Xn);
};
process = Counter;
|
d9328a42a27435f178a184e29bbc9241ee729eddc84cd7f0442574ed262e4ed6 | LucaSpanedda/Sound_reading_and_writing_techniques_in_Faust | Timesplicing.dsp | // import Standard Faust library
// https://github.com/grame-cncm/faustlibraries/
import("stdfaust.lib");
/*
TIME SPLICING:
WRITING AND READING WITH SCATTERING
ON A FIXED TABLE OF 1 SECOND (TAPE)
*/
// 16 Primes Numbers List
somePrimes = (10487, 10499, 10501, 10513, 10529, 10531, 10559, 10567,
10589, 10597, 10601, 10607, 10613, 10627, 10631, 10639);
// index of the somePrimes numbers
primeI(index) = ba.take(index , list)
with{
list = somePrimes;
};
// only decimal pass
decimal(x) = x-int(x);
// only integer pass
integer(x) = int(x);
// binary selector 0 - 1
selector(sel,x,y) = ( x * (1-sel) + y * (sel) );
// noise with prime numbers
noise(seed) = ((+(primeI(seed))~ * (1103515245)) / 2147483647);
phsplice(seed) = ph, phTrigInv(fT), phTrig(fT)
with{
ph = (f/ma.SR): ( + :
\(x).(
selector( phTrig(fT),
x,
SAHnoise(phTrigInv(fT))
)
)
: decimal ) ~ _;
phTrig(f) = f/ma.SR : (+ : decimal)~_ : \(x).(x-(1-dim) > 0);
phTrigInv(f) = phTrig(f) : \(x).( (x*-1) + 1 );
ABSnoise = abs(noise(seed));
SAHnoise(x) = \(fb).(selector((x < x'),fb,ABSnoise))~_;
dim = hslider("scatter dimension",0,0,1,.001);
fT = hslider("scatter frequency",0,0,100,.001);
f = 1;
};
// TAPE-SPLICER max. lenght 1 second for every sample rate
tapesplicer(phspliceIN, silence, x) = rwtable( dimension,
0.0,
indexwrite,
x,
indexread) * (phspliceIN : !,_,!)
+ (phspliceIN : !,!,_) * silence
with{
rec = 1-checkbox("freeze") : int;
dimension = 192000;
indexwrite = (+(1) : %(ma.SR : int)) ~ *(rec);
indexread = (phspliceIN : _,!,!) : *(float(ma.SR)) : int;
};
process = _ <: tapesplicer( phsplice(1), 0 ),
tapesplicer( phsplice(2), 0 );
| https://raw.githubusercontent.com/LucaSpanedda/Sound_reading_and_writing_techniques_in_Faust/fe75a153d8e837ae4498b1cfd21ed311e3b62683/Timesplicing.dsp | faust | import Standard Faust library
https://github.com/grame-cncm/faustlibraries/
TIME SPLICING:
WRITING AND READING WITH SCATTERING
ON A FIXED TABLE OF 1 SECOND (TAPE)
16 Primes Numbers List
index of the somePrimes numbers
only decimal pass
only integer pass
binary selector 0 - 1
noise with prime numbers
TAPE-SPLICER max. lenght 1 second for every sample rate | import("stdfaust.lib");
somePrimes = (10487, 10499, 10501, 10513, 10529, 10531, 10559, 10567,
10589, 10597, 10601, 10607, 10613, 10627, 10631, 10639);
primeI(index) = ba.take(index , list)
with{
list = somePrimes;
};
decimal(x) = x-int(x);
integer(x) = int(x);
selector(sel,x,y) = ( x * (1-sel) + y * (sel) );
noise(seed) = ((+(primeI(seed))~ * (1103515245)) / 2147483647);
phsplice(seed) = ph, phTrigInv(fT), phTrig(fT)
with{
ph = (f/ma.SR): ( + :
\(x).(
selector( phTrig(fT),
x,
SAHnoise(phTrigInv(fT))
)
)
: decimal ) ~ _;
phTrig(f) = f/ma.SR : (+ : decimal)~_ : \(x).(x-(1-dim) > 0);
phTrigInv(f) = phTrig(f) : \(x).( (x*-1) + 1 );
ABSnoise = abs(noise(seed));
SAHnoise(x) = \(fb).(selector((x < x'),fb,ABSnoise))~_;
dim = hslider("scatter dimension",0,0,1,.001);
fT = hslider("scatter frequency",0,0,100,.001);
f = 1;
};
tapesplicer(phspliceIN, silence, x) = rwtable( dimension,
0.0,
indexwrite,
x,
indexread) * (phspliceIN : !,_,!)
+ (phspliceIN : !,!,_) * silence
with{
rec = 1-checkbox("freeze") : int;
dimension = 192000;
indexwrite = (+(1) : %(ma.SR : int)) ~ *(rec);
indexread = (phspliceIN : _,!,!) : *(float(ma.SR)) : int;
};
process = _ <: tapesplicer( phsplice(1), 0 ),
tapesplicer( phsplice(2), 0 );
|
584f6acd56dee0ae033fd6ad71b7e14972718c38cc7fd52023287c8de3e25191 | LucaSpanedda/Sound_reading_and_writing_techniques_in_Faust | Timestretching_OATO.dsp | import("stdfaust.lib");
// GRANULATOR Overlap Add To One
// Sample and Hold Function
SAH2(trig,x) = loop~_
with{
loop(y) = (y,x : select2(trig));
};
// Phasor Function
Phasor(f) = Xn
letrec{
'Xn = (Xn+(f/ma.SR))-int(Xn);
};
// tableMax = table Max Dimension
tableMax = 192000 * 3;
// L = buffer dimension in seconds
L = ma.SR * 3;
// Write index - ramp 0 to L
wIdx = (+(1) : %(L)) ~ _ : int;
buffer(p, x) = it.frwtable(3, tableMax, .0, wIdx, x, p);
// Hanning window Equation
hann(x) = sin(ma.frac(x) * ma.PI) ^ 2.0;
// Grain in Ms.
grainms = 1000/(hslider("[1] Grain in ms.", 80, 1, 1000, 1):si.smoo);
// stretchFactor - 0 Normal / 1 Extreme stretch (Freeze)
stretchFactor = (ma.SR / L) * (1-hslider("[2] Stretch Factor", 0, 0, 1, .001)) : si.smoo;
// Jitter Amount in the position for the reads
jitter = hslider("[3] Jitter", 0, 0, 1, .001) : si.smoo;
// Position of the grain in the Buffer
timePhase = (Phasor(stretchFactor)*L) * ((1 - jitter) + no.noise * jitter);
// two Heads for the read
// 0°
ph1 = Phasor(grainms);
// 180*
ph2 = ma.frac(.5 + ph1);
// Buffer positions = Position in the Buffer + Grain Read
pos1 = SAH2(ph1 < ph1', timePhase) + ph1*(ma.SR/grainms);
pos2 = SAH2(ph2 < ph2', timePhase) + ph2*(ma.SR/grainms);
// Windows + Buffer Reads
head1 = hann(ph1) * buffer(pos1);
head2 = hann(ph2) * buffer(pos2);
// Timestretcher - sum of the 2 Head Reads
timeStretcher(x) = (x <: head1 + head2) <: _,_;
process = timeStretcher;
| https://raw.githubusercontent.com/LucaSpanedda/Sound_reading_and_writing_techniques_in_Faust/bb01eff05a51424c16420a00b383441d8973d85e/0_work-in-progress/Timestretching_OATO.dsp | faust | GRANULATOR Overlap Add To One
Sample and Hold Function
Phasor Function
tableMax = table Max Dimension
L = buffer dimension in seconds
Write index - ramp 0 to L
Hanning window Equation
Grain in Ms.
stretchFactor - 0 Normal / 1 Extreme stretch (Freeze)
Jitter Amount in the position for the reads
Position of the grain in the Buffer
two Heads for the read
0°
180*
Buffer positions = Position in the Buffer + Grain Read
Windows + Buffer Reads
Timestretcher - sum of the 2 Head Reads | import("stdfaust.lib");
SAH2(trig,x) = loop~_
with{
loop(y) = (y,x : select2(trig));
};
Phasor(f) = Xn
letrec{
'Xn = (Xn+(f/ma.SR))-int(Xn);
};
tableMax = 192000 * 3;
L = ma.SR * 3;
wIdx = (+(1) : %(L)) ~ _ : int;
buffer(p, x) = it.frwtable(3, tableMax, .0, wIdx, x, p);
hann(x) = sin(ma.frac(x) * ma.PI) ^ 2.0;
grainms = 1000/(hslider("[1] Grain in ms.", 80, 1, 1000, 1):si.smoo);
stretchFactor = (ma.SR / L) * (1-hslider("[2] Stretch Factor", 0, 0, 1, .001)) : si.smoo;
jitter = hslider("[3] Jitter", 0, 0, 1, .001) : si.smoo;
timePhase = (Phasor(stretchFactor)*L) * ((1 - jitter) + no.noise * jitter);
ph1 = Phasor(grainms);
ph2 = ma.frac(.5 + ph1);
pos1 = SAH2(ph1 < ph1', timePhase) + ph1*(ma.SR/grainms);
pos2 = SAH2(ph2 < ph2', timePhase) + ph2*(ma.SR/grainms);
head1 = hann(ph1) * buffer(pos1);
head2 = hann(ph2) * buffer(pos2);
timeStretcher(x) = (x <: head1 + head2) <: _,_;
process = timeStretcher;
|
0843e8ba9c5185f3e845ffdcc0afc1a030cd0c64198ede391eec206fb06e7037 | LucaSpanedda/Guida_Primi_Codici_in_FAUST | 0.70_Noise_e_Random.dsp | // RUMORE BIANCO E RANDOM
/* per generare del rumore bianco in FAUST
occorre creare una retroazione come per un fasore,
ma invece che creare un processo di accumulazione,
bisogna creare un sistema che generi un numero casuale
per ogni campione.*/
// Importo la libreria standard
import("stdfaust.lib");
// NOISE
// in questo caso passiamo un valore di seed (seme)
// per generare sulla base di questo un numero casuale
noise(seed) = (+(seed)~*(1103515245))/2147483647.0;
// NOISE A FREQUENZA VARIABILE
// in questo caso invece oltre che al seed
// nella retroazione è stato aggiunto un valore di ritardo
// per controllare la frequenza di generazione dei valori casuali
varnoise(freq,seed) = ((seed) : (+ @(ma.SR/freq)~
*(1103515245))) /2147483647.0;
// Uscita del segnale con il process
process = noise(8960458042) <:_,_;
| https://raw.githubusercontent.com/LucaSpanedda/Guida_Primi_Codici_in_FAUST/90eef06a976f36347e1a4e48091ad1c7b109fdd9/0.70_Noise_e_Random.dsp | faust | RUMORE BIANCO E RANDOM
per generare del rumore bianco in FAUST
occorre creare una retroazione come per un fasore,
ma invece che creare un processo di accumulazione,
bisogna creare un sistema che generi un numero casuale
per ogni campione.
Importo la libreria standard
NOISE
in questo caso passiamo un valore di seed (seme)
per generare sulla base di questo un numero casuale
NOISE A FREQUENZA VARIABILE
in questo caso invece oltre che al seed
nella retroazione è stato aggiunto un valore di ritardo
per controllare la frequenza di generazione dei valori casuali
Uscita del segnale con il process |
import("stdfaust.lib");
noise(seed) = (+(seed)~*(1103515245))/2147483647.0;
varnoise(freq,seed) = ((seed) : (+ @(ma.SR/freq)~
*(1103515245))) /2147483647.0;
process = noise(8960458042) <:_,_;
|
4453a1f7bbfc0d5bd962ef857bd04d992662396e17a23b489b3b216423b10512 | LucaSpanedda/Audible-Ecosystemics-2 | Noise_Test_Speakers_Mics.dsp | // import faust standard library
import("stdfaust.lib");
Noise(initSeed) = LCG ~ _ : (_ / m)
with{
// variables
// initSeed = an initial seed value
a = 18446744073709551557; // a large prime number, such as 18446744073709551557
c = 12345; // a small prime number, such as 12345
m = 2 ^ 31; // 2.1 billion
// linear_congruential_generator
LCG(seed) = ((a * seed + c) + (initSeed-initSeed') % m);
};
dBMeters = hgroup("8 channels dB meter", par(i, 16, vgroup("%i", vmeter(i) : null)))
with{
null(x) = attach(0,x);
envelop = abs : max(ba.db2linear(-70)) : ba.linear2db : min(10) : max ~ -(80.0/ma.SR);
vmeter(i, x) = attach(x, envelop(x) : vbargraph("chan %i[unit:dB]", -70, 10));
hmeter(i, x) = attach(x, envelop(x) : hbargraph("chan %i[unit:dB]", -70, 10));
};
process = par(i, 16, Noise( (i+1) * 469762049)), dBMeters; | https://raw.githubusercontent.com/LucaSpanedda/Audible-Ecosystemics-2/c4be0f10b765b5466fe87fbe42afaab5cfd37793/Electroacoustic_chain_environmental_tests/Noise_Test_Speakers_Mics.dsp | faust | import faust standard library
variables
initSeed = an initial seed value
a large prime number, such as 18446744073709551557
a small prime number, such as 12345
2.1 billion
linear_congruential_generator | import("stdfaust.lib");
Noise(initSeed) = LCG ~ _ : (_ / m)
with{
LCG(seed) = ((a * seed + c) + (initSeed-initSeed') % m);
};
dBMeters = hgroup("8 channels dB meter", par(i, 16, vgroup("%i", vmeter(i) : null)))
with{
null(x) = attach(0,x);
envelop = abs : max(ba.db2linear(-70)) : ba.linear2db : min(10) : max ~ -(80.0/ma.SR);
vmeter(i, x) = attach(x, envelop(x) : vbargraph("chan %i[unit:dB]", -70, 10));
hmeter(i, x) = attach(x, envelop(x) : hbargraph("chan %i[unit:dB]", -70, 10));
};
process = par(i, 16, Noise( (i+1) * 469762049)), dBMeters; |
a7c729c76f6e46dbbbb75dc03b20eaf59ddcb9d65c420e0a030a71a59403ce0d | LucaSpanedda/Guida_Primi_Codici_in_FAUST | 0.71_Clicks_Generator_Samples.dsp | // ---------------------------------------------------------------------------------
// CLICKS GENERATOR - SAMPLES
/* quando il valore random generato
dal noise fra -1 e +1 corrisponde ad un numero
minore di 0. viene generato un impulso in fase negativa.
Quando corrisponde ad un numero maggiore di 0.
viene generato un impulso in fase positiva.
Il valore di ampiezza è costante per ogni impulso,
il rumore determina solo la fase
dell'impulso che verrà generato.
La lunghezza dell'impulso viene espressa
in campioni ed è variabile */
// import Standard Faust library
// https://github.com/grame-cncm/faustlibraries/
import("stdfaust.lib");
clicks(seed,f,samples,amp) = outimpulse
with{
varnoise = (((seed) : (+ @(ma.SR/f)~ *(1103515245)))/2147483647.0);
routeimpulse(a,b) = a : _@(samples), b :> - : _ > 0;
noisemaj = varnoise>0;
noisemin = varnoise<0;
majimpulse = noisemaj <: routeimpulse;
minimpulse = noisemin <: routeimpulse *-1;
outimpulse = majimpulse + minimpulse : _*amp;
};
// clicks(seed,f,samples,amp)
process = clicks(1020,10,3,0.5), clicks(1024,10,3,0.5);
// ---------------------------------------------------------------------------------
| https://raw.githubusercontent.com/LucaSpanedda/Guida_Primi_Codici_in_FAUST/636a4f14a312027eefb1f05303d4b2dc063ef5eb/0.71_Clicks_Generator_Samples.dsp | faust | ---------------------------------------------------------------------------------
CLICKS GENERATOR - SAMPLES
quando il valore random generato
dal noise fra -1 e +1 corrisponde ad un numero
minore di 0. viene generato un impulso in fase negativa.
Quando corrisponde ad un numero maggiore di 0.
viene generato un impulso in fase positiva.
Il valore di ampiezza è costante per ogni impulso,
il rumore determina solo la fase
dell'impulso che verrà generato.
La lunghezza dell'impulso viene espressa
in campioni ed è variabile
import Standard Faust library
https://github.com/grame-cncm/faustlibraries/
clicks(seed,f,samples,amp)
--------------------------------------------------------------------------------- |
import("stdfaust.lib");
clicks(seed,f,samples,amp) = outimpulse
with{
varnoise = (((seed) : (+ @(ma.SR/f)~ *(1103515245)))/2147483647.0);
routeimpulse(a,b) = a : _@(samples), b :> - : _ > 0;
noisemaj = varnoise>0;
noisemin = varnoise<0;
majimpulse = noisemaj <: routeimpulse;
minimpulse = noisemin <: routeimpulse *-1;
outimpulse = majimpulse + minimpulse : _*amp;
};
process = clicks(1020,10,3,0.5), clicks(1024,10,3,0.5);
|
810b4e0b1c2b8bc99e231908e1628a07f0ed7da7dda5ab850a638af4eacab018 | LucaSpanedda/Guida_Primi_Codici_in_FAUST | 0.60_Condizioni_Su_Segnale.dsp | // CONDIZIONI SU UN SEGNALE
/* In FAUST possiamo utilizzare dei Breakpoint
sul percorso del segnale per l'elaborazione,
e per determinare delle particolari condizioni.
In questo caso utilizzeremo i valori
di minimo e massimo per impostare un limite
oltre il quale il segnale diventa costante rispetto
a quella soglia di valore */
//Importo la libreria
import("stdfaust.lib");
// tutto il segnale sopra la soglia entra in clipping
// e viene dunque tagliato.
// (a) determina il livello di amplificazione dell'ingresso
// (v) determina la soglia minima e massima
clipz(a,v) = _*a : min(v) : max(-v);
// Generazione oscillatore sinusoidale:
due_pigreco = 6.2831853071795;
decimale(x) = x-int(x);
osc(frequenza,ampiezza) = sin((frequenza/ma.SR : (+ : decimale) ~ _ )
*due_pigreco) *ampiezza;
sine = osc(200,1);
// Uscita del segnale con il process: sine --> clipz
// clipz <: _,_; verso i due primi canali di out: 1,2;
process = sine : clipz(1,0.5) <: _,_;
| https://raw.githubusercontent.com/LucaSpanedda/Guida_Primi_Codici_in_FAUST/cca4cea8714997cd0fa8bb7f103a36c141e166e2/0.60_Condizioni_Su_Segnale.dsp | faust | CONDIZIONI SU UN SEGNALE
In FAUST possiamo utilizzare dei Breakpoint
sul percorso del segnale per l'elaborazione,
e per determinare delle particolari condizioni.
In questo caso utilizzeremo i valori
di minimo e massimo per impostare un limite
oltre il quale il segnale diventa costante rispetto
a quella soglia di valore
Importo la libreria
tutto il segnale sopra la soglia entra in clipping
e viene dunque tagliato.
(a) determina il livello di amplificazione dell'ingresso
(v) determina la soglia minima e massima
Generazione oscillatore sinusoidale:
Uscita del segnale con il process: sine --> clipz
clipz <: _,_; verso i due primi canali di out: 1,2; |
import("stdfaust.lib");
clipz(a,v) = _*a : min(v) : max(-v);
due_pigreco = 6.2831853071795;
decimale(x) = x-int(x);
osc(frequenza,ampiezza) = sin((frequenza/ma.SR : (+ : decimale) ~ _ )
*due_pigreco) *ampiezza;
sine = osc(200,1);
process = sine : clipz(1,0.5) <: _,_;
|
0d1ff77d212c6416300a6eeb89e1cf156d1b3ab429f426e4453e7f5bc159fe46 | LucaSpanedda/Luca_Spanedda_St_Cecilia_Conservatory_Thesis | CostrainedLorenzSystem.dsp | // import faust standard library
import("stdfaust.lib");
// Hyperbolic Tangent Saturator Parameter
THRESHOLD = 1000;
// Hyperbolic Tangent Saturator Function
saturator(lim, x) = lim * ma.tanh( x / (max(lim, ma.EPSILON)) );
// DC Blocker Parameters
ZERO = 1;
POLE = .995;
// DC Blocker Filter Function
dcblocker(zero, pole, x) = x : _ <: _, mem : _, * (zero) : - : + ~ * (pole);
// Costrained (Modified) Lorenz System
LorenzSystem(x0, y0, z0, dt, beta, rho, sigma, tanHrange) =
(LorenzSystemEquations : par(i, 3, dcblocker(ZERO, POLE)) : par(i, 3, saturator(tanHrange))) ~
si.bus(3) : par(i, 3, _ / (tanHrange)) :> (_ / 3)
with {
x_init = x0-x0'; y_init = y0-y0'; z_init = z0-z0';
LorenzSystemEquations(x, y, z) =
(x + (sigma * (y - x)) * dt + x_init),
(y + ((rho * x) - (x * z) - y) * dt + y_init),
(z + ((x * y) - (beta * z)) * dt + z_init);
};
process = LorenzSystem(1.2, 1.3, 1.6, .150, 2, 3.4, 1.9, THRESHOLD); | https://raw.githubusercontent.com/LucaSpanedda/Luca_Spanedda_St_Cecilia_Conservatory_Thesis/b73b60d9e0b45e09bbf72b1477c21202b895f1bb/ITA/codes/CostrainedLorenzSystem.dsp | faust | import faust standard library
Hyperbolic Tangent Saturator Parameter
Hyperbolic Tangent Saturator Function
DC Blocker Parameters
DC Blocker Filter Function
Costrained (Modified) Lorenz System
| import("stdfaust.lib");
THRESHOLD = 1000;
saturator(lim, x) = lim * ma.tanh( x / (max(lim, ma.EPSILON)) );
ZERO = 1;
POLE = .995;
dcblocker(zero, pole, x) = x : _ <: _, mem : _, * (zero) : - : + ~ * (pole);
LorenzSystem(x0, y0, z0, dt, beta, rho, sigma, tanHrange) =
(LorenzSystemEquations : par(i, 3, dcblocker(ZERO, POLE)) : par(i, 3, saturator(tanHrange))) ~
si.bus(3) : par(i, 3, _ / (tanHrange)) :> (_ / 3)
with {
x_init = x0-x0'; y_init = y0-y0'; z_init = z0-z0';
LorenzSystemEquations(x, y, z) =
(x + (sigma * (y - x)) * dt + x_init),
(y + ((rho * x) - (x * z) - y) * dt + y_init),
(z + ((x * y) - (beta * z)) * dt + z_init);
};
process = LorenzSystem(1.2, 1.3, 1.6, .150, 2, 3.4, 1.9, THRESHOLD); |
083b17c2cb15a84269fcff2efadfd0de29d330ef008d8d44211b27cec5245073 | LucaSpanedda/Luca_Spanedda_St_Cecilia_Conservatory_Thesis | Sampler.dsp | // import faust standard library
import("stdfaust.lib");
// hard-coded: change this to match your samplerate
SampleRate = 44100;
sampler(lengthSec, memChunk, ratio, x) =
it.frwtable(3, bufferLen, .0, writePtr, x, readPtr) * window
with {
memChunkLimited = max(0.100, min(1, memChunk));
bufferLen = lengthSec * SampleRate;
writePtr = ba.period(bufferLen);
grainLen = max(1, ba.if(writePtr > memChunkLimited * bufferLen,
memChunkLimited * bufferLen, 1));
readPtr = y
letrec {
'y = (ratio + y) % grainLen;
};
window = min(1, abs(((readPtr + grainLen / 2) % grainLen) -
grainLen / 2) / 200);
};
process = sampler(4, hslider("memChunkLimited", 0.100, 0, 1, .001),
hslider("ratio", 5, .1, 10, .001), os.osc(100)) <: _, _; | https://raw.githubusercontent.com/LucaSpanedda/Luca_Spanedda_St_Cecilia_Conservatory_Thesis/b73b60d9e0b45e09bbf72b1477c21202b895f1bb/ITA/codes/Sampler.dsp | faust | import faust standard library
hard-coded: change this to match your samplerate | import("stdfaust.lib");
SampleRate = 44100;
sampler(lengthSec, memChunk, ratio, x) =
it.frwtable(3, bufferLen, .0, writePtr, x, readPtr) * window
with {
memChunkLimited = max(0.100, min(1, memChunk));
bufferLen = lengthSec * SampleRate;
writePtr = ba.period(bufferLen);
grainLen = max(1, ba.if(writePtr > memChunkLimited * bufferLen,
memChunkLimited * bufferLen, 1));
readPtr = y
letrec {
'y = (ratio + y) % grainLen;
};
window = min(1, abs(((readPtr + grainLen / 2) % grainLen) -
grainLen / 2) / 200);
};
process = sampler(4, hslider("memChunkLimited", 0.100, 0, 1, .001),
hslider("ratio", 5, .1, 10, .001), os.osc(100)) <: _, _; |
255d7fdb1ec827b59916f717af8a26f5ad415190d39d00f133febb0bda485675 | LucaSpanedda/Guida_Primi_Codici_in_FAUST | 0.05_Par.dsp | // IL PAR
//Importo la libreria standard di FAUST
import("stdfaust.lib");
// OSCILLATORE SAW (ARGOMENTO DA RICHIAMARE NEL PAR)
decimale(x) = x-int(x);
saw(frequenza) = ((frequenza/ma.SR : (+ : decimale)~_)*2-1);
/* in faust l'ietrazione PAR può essere usata per duplicare
le espressioni in parallelo
- il primo argomento è la variabile che deve essere richiamata
in seguito per designare le iterazioni
starting at 0.
- il secondo argomento è il numero delle iterazioni necessario
( nell'ide web se ne possono utilizzare max. 32)
- il terzo argomento è la funzione che deve essere duplicata
( con la variabile e il disegno dello step incrementale) */
// in questo caso la variabile di saw è 100,
// e gli incrementi sono lasciati per default a 1 (i).
// se moltiplicassi ad esempio il mio (i*100)
// otterrei uno step incrementale di 100 per ogni copia della funzione
iteration = par(i,8,saw(100+i)) :> *(0.1);
process = iteration <: _,_;
| https://raw.githubusercontent.com/LucaSpanedda/Guida_Primi_Codici_in_FAUST/d5a5335c5a04b5b45a04f69a15ede02036c5be6c/0.05_Par.dsp | faust | IL PAR
Importo la libreria standard di FAUST
OSCILLATORE SAW (ARGOMENTO DA RICHIAMARE NEL PAR)
in faust l'ietrazione PAR può essere usata per duplicare
le espressioni in parallelo
- il primo argomento è la variabile che deve essere richiamata
in seguito per designare le iterazioni
starting at 0.
- il secondo argomento è il numero delle iterazioni necessario
( nell'ide web se ne possono utilizzare max. 32)
- il terzo argomento è la funzione che deve essere duplicata
( con la variabile e il disegno dello step incrementale)
in questo caso la variabile di saw è 100,
e gli incrementi sono lasciati per default a 1 (i).
se moltiplicassi ad esempio il mio (i*100)
otterrei uno step incrementale di 100 per ogni copia della funzione |
import("stdfaust.lib");
decimale(x) = x-int(x);
saw(frequenza) = ((frequenza/ma.SR : (+ : decimale)~_)*2-1);
iteration = par(i,8,saw(100+i)) :> *(0.1);
process = iteration <: _,_;
|
9bc12d4a075ab261e4b782d505308df7c5c93edbe3ae1c314869d672ac098f98 | LucaSpanedda/Guida_Primi_Codici_in_FAUST | 0.02_Argomento_di_Funzione.dsp | // ARGOMENTO DI FUNZIONE
//Importo la libreria standard di FAUST
import("stdfaust.lib");
//creo una funzione che sottragga i numeri interi lasciando i decimali
decimale(x) = x-int(x);
/* In Faust oltre alle funzioni possiamo usare
gli argomenti di una funzione.
Posso mettere un argomento alla funzione quando la scrivo
in questo modo:
funzione(argomento di funzione 1, argomento 2, ecc.) =
argomento di funzione 1, argomento2, ecc. ;
posso a seguito o a priori definire gli argomenti di una funzione:
argomento di funzione 1 = 100.;
questo vorrà dire che ognivolta che nel codice ho utilizzato
un "argomento di funzione 1" sarà uguale al contenuto della funzione
cioè = 100. */
fasore(frequenza) = (frequenza/ma.SR : (+ : decimale)~_);
/* in questo caso all'output della funzione, quando la richiamo,
posso dunque dichiarare l'argomento esprimendo il valore
tra le parentesi, come nel process qui per la frequenza */
// out del segnale sul canale 1,2 del DAC
process = fasore(100)*2-1 <:_,_;
| https://raw.githubusercontent.com/LucaSpanedda/Guida_Primi_Codici_in_FAUST/20e1a9a763b26c410948fe376eece02901f7cae2/0.02_Argomento_di_Funzione.dsp | faust | ARGOMENTO DI FUNZIONE
Importo la libreria standard di FAUST
creo una funzione che sottragga i numeri interi lasciando i decimali
In Faust oltre alle funzioni possiamo usare
gli argomenti di una funzione.
Posso mettere un argomento alla funzione quando la scrivo
in questo modo:
funzione(argomento di funzione 1, argomento 2, ecc.) =
argomento di funzione 1, argomento2, ecc. ;
posso a seguito o a priori definire gli argomenti di una funzione:
argomento di funzione 1 = 100.;
questo vorrà dire che ognivolta che nel codice ho utilizzato
un "argomento di funzione 1" sarà uguale al contenuto della funzione
cioè = 100.
in questo caso all'output della funzione, quando la richiamo,
posso dunque dichiarare l'argomento esprimendo il valore
tra le parentesi, come nel process qui per la frequenza
out del segnale sul canale 1,2 del DAC
|
import("stdfaust.lib");
decimale(x) = x-int(x);
fasore(frequenza) = (frequenza/ma.SR : (+ : decimale)~_);
process = fasore(100)*2-1 <:_,_;
|
84c25f0508442a2baf75d4653d9b2dd34ef0879458d830039905f4e1cf6e5559 | LucaSpanedda/Guida_Primi_Codici_in_FAUST | 0.04_Routing.dsp | // IL ROUTING DI UN SEGNALE
// Importo libreria standard di FAUST
import("stdfaust.lib");
/* in FAUST di base, non è un processo scontato gestire il routing
di un segnale che superi le due entrate o uscite di collegamento
in catena.
Con la tecnica della funzione router illustrata a seguito
si rende possibile la gestione di più canali indipendenti
nello sviluppo del nostro algoritmo DSP */
// con la funzione router
// definisco gli input che mi devo passare dentro il codice
// ad esempio: in questo caso 7 input (a,b,c,d,e,f,g)
router(a,b,c,d,e,f,g) = a, b, c, d, e, f, g;
// e gestisco le operazioni desiderate tra i canali,
// in questo caso sommo tutti i canali in un unica uscita
out_router(a,b,c,d,e,f,g) = a+b+c+d+e+f+g;
// infine definisco la funzione
// dove esplico il percorso del segnale
process = _ <: router :> out_router;
// avrò dunque creato un percorso di un singolo canale
// che si ramifica in 7 ingressi nella funzione router
// e che si sommano in un unica uscita con la funzione out_router
| https://raw.githubusercontent.com/LucaSpanedda/Guida_Primi_Codici_in_FAUST/b4fa55da275813b2cb8e5cf6215b024c8feadde4/0.04_Routing.dsp | faust | IL ROUTING DI UN SEGNALE
Importo libreria standard di FAUST
in FAUST di base, non è un processo scontato gestire il routing
di un segnale che superi le due entrate o uscite di collegamento
in catena.
Con la tecnica della funzione router illustrata a seguito
si rende possibile la gestione di più canali indipendenti
nello sviluppo del nostro algoritmo DSP
con la funzione router
definisco gli input che mi devo passare dentro il codice
ad esempio: in questo caso 7 input (a,b,c,d,e,f,g)
e gestisco le operazioni desiderate tra i canali,
in questo caso sommo tutti i canali in un unica uscita
infine definisco la funzione
dove esplico il percorso del segnale
avrò dunque creato un percorso di un singolo canale
che si ramifica in 7 ingressi nella funzione router
e che si sommano in un unica uscita con la funzione out_router |
import("stdfaust.lib");
router(a,b,c,d,e,f,g) = a, b, c, d, e, f, g;
out_router(a,b,c,d,e,f,g) = a+b+c+d+e+f+g;
process = _ <: router :> out_router;
|
0658097062be451aed619ab3a658e22a90f0470c2bb41ce391acbe7d8e7bfe62 | LucaSpanedda/Guida_Primi_Codici_in_FAUST | 0.09_Argomento_di_Funzione.dsp | // ARGOMENTO DI FUNZIONE
//Importo la libreria standard di FAUST
import("stdfaust.lib");
//creo una funzione che sottragga i numeri interi lasciando i decimali
decimale(x) = x-int(x);
/* In Faust oltre alle funzioni possiamo usare
gli argomenti di una funzione.
Posso mettere un argomento alla funzione quando la scrivo
in questo modo:
funzione(argomento di funzione 1, argomento 2, ecc.) =
argomento di funzione 1, argomento2, ecc. ;
posso a seguito o a priori definire gli argomenti di una funzione:
argomento di funzione 1 = 100.;
questo vorrà dire che ognivolta che nel codice ho utilizzato
un "argomento di funzione 1" sarà uguale al contenuto della funzione
cioè = 100.
esempio:
Ampiezza controllata dallo slider.*/
fasore(frequenza) = ((frequenza/ma.SR : (+ : decimale) ~ _ ) *2 -1 )
*hslider("ampiezza segnale", 0, 0, 1, 0.01);
/* in questo caso all'output della funzione, quando la richiamo,
posso dunque dichiarare l'argomento esprimendo il valore
tra le parentesi, come nel process qui per la frequenza */
process = fasore(100), fasore(101);
| https://raw.githubusercontent.com/LucaSpanedda/Guida_Primi_Codici_in_FAUST/fe7fba2be6ccb8b83efc1367d4565777af8cdef5/0.09_Argomento_di_Funzione.dsp | faust | ARGOMENTO DI FUNZIONE
Importo la libreria standard di FAUST
creo una funzione che sottragga i numeri interi lasciando i decimali
In Faust oltre alle funzioni possiamo usare
gli argomenti di una funzione.
Posso mettere un argomento alla funzione quando la scrivo
in questo modo:
funzione(argomento di funzione 1, argomento 2, ecc.) =
argomento di funzione 1, argomento2, ecc. ;
posso a seguito o a priori definire gli argomenti di una funzione:
argomento di funzione 1 = 100.;
questo vorrà dire che ognivolta che nel codice ho utilizzato
un "argomento di funzione 1" sarà uguale al contenuto della funzione
cioè = 100.
esempio:
Ampiezza controllata dallo slider.
in questo caso all'output della funzione, quando la richiamo,
posso dunque dichiarare l'argomento esprimendo il valore
tra le parentesi, come nel process qui per la frequenza |
import("stdfaust.lib");
decimale(x) = x-int(x);
fasore(frequenza) = ((frequenza/ma.SR : (+ : decimale) ~ _ ) *2 -1 )
*hslider("ampiezza segnale", 0, 0, 1, 0.01);
process = fasore(100), fasore(101);
|
4976e7918fd88b2ea097926ce9043f2ebb58d6ca18cdc1c4f3c9aad6dc1d704d | LucaSpanedda/RITI-Room-Is-The-Instrument | byHandModel.dsp | // Faust standard libraries
import("stdfaust.lib");
// Spectral Modeling Synthesis
// https://en.wikipedia.org/wiki/Spectral_modeling_synthesis
// INSTRUMENT SPECTRE --------------------------------------
// index of the lists
Flist(index) = ba.take(index + 1, ( 66, 129, 196, 261, 325, 390, 457, 520 ));
Alist(index) = ba.take(index + 1, ( .8, 1.2, .50, .60, .30, .20, .04, .18 ));
BWlist(index) = ba.take(index + 1, ( 10, 8.0, 8.0, 6.0, 6.0, 10., 2.0, 10. ));
Voices = 8;
// BP FILTER ----------------------------------------------
// optimized BP from the TPT version of the SVF Filter by Vadim Zavalishin
// reference : (by Will Pirkle)
// http://www.willpirkle.com/Downloads/AN-4VirtualAnalogFilters.2.0.pdf
BPSVF(glin, bw, cf, x) = loop ~ si.bus(2) : (! , ! , _)
with {
g = tan(cf * ma.PI * ma.T);
Q = cf / max(1.0, bw);
R = 1.0 / (Q + Q);
G = 1.0 / (1.0 + 2.0 * R * g + g * g);
loop(s1, s2) = u1 , u2 , bp * glin
with {
bp = (g * (x - s2) + s1) * G;
bp2 = bp + bp;
v2 = bp2 * g;
u1 = bp2 - s1;
u2 = v2 + s2;
};
};
// Spectre BP Filter Bank
filterbanks(cascade, parallel, gglob, bwglob, fsglob, x) =
x <: par(i, parallel,
seq(r, cascade, BPSVF(
Alist(i) * gglob,
BWlist(i) * bwglob,
Flist(i) * fsglob
)
)
):> (+/parallel);
// SMS Out
// Import limiter
normalize(treshold, x) = component("limiters.dsp").normalization(treshold, x);
// 1st Order
pulsexcit = ba.pulse(hslider("fpulse",10000,100,10000,.01)) : si.smoo * 200;
noisexcit = no.noise * .1;
process = (noisexcit : filterbanks(2, Voices, 1, 1, 1))
<: _,_;
| https://raw.githubusercontent.com/LucaSpanedda/RITI-Room-Is-The-Instrument/dc7497f7621a32b070c9f983f75a120d486a5c46/Audio-Analysis/FAUST-SpectralModel/byHandModel.dsp | faust | Faust standard libraries
Spectral Modeling Synthesis
https://en.wikipedia.org/wiki/Spectral_modeling_synthesis
INSTRUMENT SPECTRE --------------------------------------
index of the lists
BP FILTER ----------------------------------------------
optimized BP from the TPT version of the SVF Filter by Vadim Zavalishin
reference : (by Will Pirkle)
http://www.willpirkle.com/Downloads/AN-4VirtualAnalogFilters.2.0.pdf
Spectre BP Filter Bank
SMS Out
Import limiter
1st Order
| import("stdfaust.lib");
Flist(index) = ba.take(index + 1, ( 66, 129, 196, 261, 325, 390, 457, 520 ));
Alist(index) = ba.take(index + 1, ( .8, 1.2, .50, .60, .30, .20, .04, .18 ));
BWlist(index) = ba.take(index + 1, ( 10, 8.0, 8.0, 6.0, 6.0, 10., 2.0, 10. ));
Voices = 8;
BPSVF(glin, bw, cf, x) = loop ~ si.bus(2) : (! , ! , _)
with {
g = tan(cf * ma.PI * ma.T);
Q = cf / max(1.0, bw);
R = 1.0 / (Q + Q);
G = 1.0 / (1.0 + 2.0 * R * g + g * g);
loop(s1, s2) = u1 , u2 , bp * glin
with {
bp = (g * (x - s2) + s1) * G;
bp2 = bp + bp;
v2 = bp2 * g;
u1 = bp2 - s1;
u2 = v2 + s2;
};
};
filterbanks(cascade, parallel, gglob, bwglob, fsglob, x) =
x <: par(i, parallel,
seq(r, cascade, BPSVF(
Alist(i) * gglob,
BWlist(i) * bwglob,
Flist(i) * fsglob
)
)
):> (+/parallel);
normalize(treshold, x) = component("limiters.dsp").normalization(treshold, x);
pulsexcit = ba.pulse(hslider("fpulse",10000,100,10000,.01)) : si.smoo * 200;
noisexcit = no.noise * .1;
process = (noisexcit : filterbanks(2, Voices, 1, 1, 1))
<: _,_;
|
f63899cff506130e377d35680b9e9938447d3df0ead7ee557e1bd698b48556ac | LucaSpanedda/Sound_reading_and_writing_techniques_in_Faust | TimestretchingWRONG.dsp | declare name "Timestretching";
declare author "Luca Spanedda";
// FAUST standard library
import("stdfaust.lib");
GRec = checkbox("[0]Cyclic Recording");
GBuffer = hslider("[1]Buffer Dimension",1000,120,8000,1):si.smoo;
GStretch = hslider("[2]Stretch Factor",1,1,100,0.01):si.smoo;
GGraindim = hslider("[3]Grain Dimension",80,1,100,0.01):si.smoo;
GFreq = hslider("[4]Reading Frequency",1,1,10,0.001):si.smoo;
timestretching(MSbuffer,MSgraindim,record,Stretchfactor,Freq) = _ <: A_grain+B_grain
with{
// Sample and Hold: input --> sah(control sig)
sah(x) = sahf
with{trigger = (((x*-1+1)-0.5)>0)-((((x*-1+1)-0.5)>0):mem)>0;
sahf(y) = (*(1-trigger) + (y*trigger))~ _;};
// Phasor
phasor(f) = (f/ma.SR):(+ <: (_-int(_)) )~_ ;
// Gaussian Windowing: phasor input, power
gaussian(x,powv) = sin(x*ma.PI),powv:pow;
// offset for the index write and read
offset = 2;
// buffer dynamic dimension
dimension = (ma.SR/1000)*MSbuffer:int;
// graindim = dimension of the grain in ms.
graindim = (ma.SR/1000)*MSgraindim:int;
// indexwrite = cyclic constant writing on all the buffer + offset
indexwrite = ((+(1):%(dimension-offset))~_*(record))+(offset*record):int;
// wrap reset the int
wrap(x)=x-int(x);
Grainphasor = phasor((dimension/graindim)*Freq);
Positionphasor = phasor(1/Stretchfactor);
// X_bufferpos = Buffer index position, offset for the read
A_bufferpos = (Positionphasor : sah(Grainphasor))*(dimension-(graindim));
B_bufferpos = (Positionphasor : sah(Grainphasor+0.5:wrap))*(dimension-(graindim));
A_indexread = ((Grainphasor)*(graindim))+A_bufferpos+offset:int;
B_indexread = ((Grainphasor+0.5:wrap)*(graindim))+B_bufferpos+offset:int;
buffer_A = rwtable(1920000+offset:int,0.0,indexwrite,_,A_indexread);
buffer_B = rwtable(1920000+offset:int,0.0,indexwrite,_,B_indexread);
A_grain = buffer_A*gaussian(Grainphasor,2);
B_grain = buffer_B*gaussian(Grainphasor+0.5:wrap,2);
};
process = os.osc(400):timestretching(1000,GGraindim,GRec,GStretch,GFreq) <: _,_;
| https://raw.githubusercontent.com/LucaSpanedda/Sound_reading_and_writing_techniques_in_Faust/bb01eff05a51424c16420a00b383441d8973d85e/0_work-in-progress/TimestretchingWRONG.dsp | faust | FAUST standard library
Sample and Hold: input --> sah(control sig)
Phasor
Gaussian Windowing: phasor input, power
offset for the index write and read
buffer dynamic dimension
graindim = dimension of the grain in ms.
indexwrite = cyclic constant writing on all the buffer + offset
wrap reset the int
X_bufferpos = Buffer index position, offset for the read | declare name "Timestretching";
declare author "Luca Spanedda";
import("stdfaust.lib");
GRec = checkbox("[0]Cyclic Recording");
GBuffer = hslider("[1]Buffer Dimension",1000,120,8000,1):si.smoo;
GStretch = hslider("[2]Stretch Factor",1,1,100,0.01):si.smoo;
GGraindim = hslider("[3]Grain Dimension",80,1,100,0.01):si.smoo;
GFreq = hslider("[4]Reading Frequency",1,1,10,0.001):si.smoo;
timestretching(MSbuffer,MSgraindim,record,Stretchfactor,Freq) = _ <: A_grain+B_grain
with{
sah(x) = sahf
with{trigger = (((x*-1+1)-0.5)>0)-((((x*-1+1)-0.5)>0):mem)>0;
sahf(y) = (*(1-trigger) + (y*trigger))~ _;};
phasor(f) = (f/ma.SR):(+ <: (_-int(_)) )~_ ;
gaussian(x,powv) = sin(x*ma.PI),powv:pow;
offset = 2;
dimension = (ma.SR/1000)*MSbuffer:int;
graindim = (ma.SR/1000)*MSgraindim:int;
indexwrite = ((+(1):%(dimension-offset))~_*(record))+(offset*record):int;
wrap(x)=x-int(x);
Grainphasor = phasor((dimension/graindim)*Freq);
Positionphasor = phasor(1/Stretchfactor);
A_bufferpos = (Positionphasor : sah(Grainphasor))*(dimension-(graindim));
B_bufferpos = (Positionphasor : sah(Grainphasor+0.5:wrap))*(dimension-(graindim));
A_indexread = ((Grainphasor)*(graindim))+A_bufferpos+offset:int;
B_indexread = ((Grainphasor+0.5:wrap)*(graindim))+B_bufferpos+offset:int;
buffer_A = rwtable(1920000+offset:int,0.0,indexwrite,_,A_indexread);
buffer_B = rwtable(1920000+offset:int,0.0,indexwrite,_,B_indexread);
A_grain = buffer_A*gaussian(Grainphasor,2);
B_grain = buffer_B*gaussian(Grainphasor+0.5:wrap,2);
};
process = os.osc(400):timestretching(1000,GGraindim,GRec,GStretch,GFreq) <: _,_;
|
41da584d44878d6cff630749be5c0b88a9fea82a9fd35818c600ba73f55a8dc6 | LucaSpanedda/RITI-Room-Is-The-Instrument | SMSoptimizedBPSVFTPT.dsp | // Faust standard libraries
import("stdfaust.lib");
// Spectral Modeling Synthesis
// https://en.wikipedia.org/wiki/Spectral_modeling_synthesis
// INSTRUMENT SPECTRE --------------------------------------
// Import lists: Frequencies, Amps, Bandwidth
spectrefreq = component("frequencies.dsp").frequencieslist;
spectreamps = component("amplitudes.dsp").amplitudeslist;
spectreband = component("bandwidths.dsp").bandwidthslist;
// index of the lists
Flist(index) = ba.take(index, spectrefreq) * .500 ;
Alist(index) = ba.take(index, spectreamps) * 1.00 ;
BWlist(index) = ba.take(1, spectreband) * 1/10 ;
// process = Flist(11), Flist(11), BWlist(11);
// BP FILTER ----------------------------------------------
// optimized BP from the TPT version of the SVF Filter by Vadim Zavalishin
// reference : (by Will Pirkle)
// http://www.willpirkle.com/Downloads/AN-4VirtualAnalogFilters.2.0.pdf
BPSVF(glin, bw, cf, x) = loop ~ si.bus(2) : (! , ! , _)
with {
g = tan(cf * ma.PI * ma.T);
Q = cf / max(ma.EPSILON, bw);
R = 1.0 / (Q + Q);
G = 1.0 / (1.0 + 2.0 * R * g + g * g);
loop(s1, s2) = u1 , u2 , bp * glin
with {
bp = (g * (x - s2) + s1) * G;
bp2 = bp + bp;
v2 = bp2 * g;
u1 = bp2 - s1;
u2 = v2 + s2;
};
};
// Spectre BP Filter Bank
filterbanks(cascade, parallel, x) =
x <: par(i, parallel,
seq(r, cascade, BPSVF(
Alist(i + 1),
BWlist(i + 1),
Flist(i + 1)
)
)
):> (+/parallel);
// SMS Out
// Import limiter
normalize(treshold, x) = component("limiters.dsp").normalization(treshold, x);
slidertest = si.smoo( ba.db2linear( hslider("Amp [unit:db]", -80, -80, 0, .001) ) );
process = no.noise * slidertest * 10 : filterbanks(1, 128) <: _,_; | https://raw.githubusercontent.com/LucaSpanedda/RITI-Room-Is-The-Instrument/dc7497f7621a32b070c9f983f75a120d486a5c46/Audio-Analysis/FAUST-SpectralModel/SMSoptimizedBPSVFTPT.dsp | faust | Faust standard libraries
Spectral Modeling Synthesis
https://en.wikipedia.org/wiki/Spectral_modeling_synthesis
INSTRUMENT SPECTRE --------------------------------------
Import lists: Frequencies, Amps, Bandwidth
index of the lists
process = Flist(11), Flist(11), BWlist(11);
BP FILTER ----------------------------------------------
optimized BP from the TPT version of the SVF Filter by Vadim Zavalishin
reference : (by Will Pirkle)
http://www.willpirkle.com/Downloads/AN-4VirtualAnalogFilters.2.0.pdf
Spectre BP Filter Bank
SMS Out
Import limiter | import("stdfaust.lib");
spectrefreq = component("frequencies.dsp").frequencieslist;
spectreamps = component("amplitudes.dsp").amplitudeslist;
spectreband = component("bandwidths.dsp").bandwidthslist;
Flist(index) = ba.take(index, spectrefreq) * .500 ;
Alist(index) = ba.take(index, spectreamps) * 1.00 ;
BWlist(index) = ba.take(1, spectreband) * 1/10 ;
BPSVF(glin, bw, cf, x) = loop ~ si.bus(2) : (! , ! , _)
with {
g = tan(cf * ma.PI * ma.T);
Q = cf / max(ma.EPSILON, bw);
R = 1.0 / (Q + Q);
G = 1.0 / (1.0 + 2.0 * R * g + g * g);
loop(s1, s2) = u1 , u2 , bp * glin
with {
bp = (g * (x - s2) + s1) * G;
bp2 = bp + bp;
v2 = bp2 * g;
u1 = bp2 - s1;
u2 = v2 + s2;
};
};
filterbanks(cascade, parallel, x) =
x <: par(i, parallel,
seq(r, cascade, BPSVF(
Alist(i + 1),
BWlist(i + 1),
Flist(i + 1)
)
)
):> (+/parallel);
normalize(treshold, x) = component("limiters.dsp").normalization(treshold, x);
slidertest = si.smoo( ba.db2linear( hslider("Amp [unit:db]", -80, -80, 0, .001) ) );
process = no.noise * slidertest * 10 : filterbanks(1, 128) <: _,_; |
63f96913ada36a084ebcad215212b6543c6b471052d8bd2f577afe17a3910b25 | LucaSpanedda/Luca_Spanedda_St_Cecilia_Conservatory_Thesis | LookaheadLimiter.dsp | // import faust standard library
import("stdfaust.lib");
// Peak Max IIR filter with max comparison and RT60 Decay
peakenvelope(t, x) = abs(x) <: loop ~ _ * rt60(t)
with{
loop(y, z) = ( (y, z) : max);
rt60(t) = 0.001^((1/ma.SR) / t);
};
// process = _ : peakenvelope(decayFactor);
// PeakHolder with Timer
peakHolder(holdTime, x) = loop ~ si.bus(2) : ! , _
with {
loop(timerState, outState) = timer , output
with {
isNewPeak = abs(x) >= outState;
isTimeOut = timerState >= (holdTime * ma.SR - 1);
bypass = isNewPeak | isTimeOut;
timer = ba.if(bypass, 0, timerState + 1);
output = ba.if(bypass, abs(x), outState);
};
};
// process = _ : peakHolder(1);
// PeakHold module with an exponential decay curve
peakHoldwDecay(holdSeconds, frequencyCut, decayT60, x) = x :
peakHolder(holdSeconds) : LPTPT(frequencyCut) : peakenvelope(decayT60);
// Zavalishin's Onepole TPT Filter
onePoleTPT(cf, x) = loop ~ _ : ! , si.bus(3) // Outs: lp , hp , ap
with {
g = tan(cf * ma.PI * (1.0/ma.SR));
G = g / (1.0 + g);
loop(s) = u , lp , hp , ap
with {
v = (x - s) * G; u = v + lp; lp = v + s; hp = x - lp; ap = lp - hp;
};
};
// Lowpass TPT
LPTPT(cf, x) = onePoleTPT(cf, x) : (_ , ! , !);
// Highpass TPT
HPTPT(cf, x) = onePoleTPT(cf, x) : (! , _ , !);
// Lookahead Limiter
LookaheadLimiter(threshold, x) = ( x : peakHoldwDecay(.1, 500, 10) ) :
( threshold / max(ma.EPSILON, _) : min(1.0) ) *
( x @ (ms2samp(1)));
process = _ : LookaheadLimiter(1); | https://raw.githubusercontent.com/LucaSpanedda/Luca_Spanedda_St_Cecilia_Conservatory_Thesis/b73b60d9e0b45e09bbf72b1477c21202b895f1bb/ITA/codes/LookaheadLimiter.dsp | faust | import faust standard library
Peak Max IIR filter with max comparison and RT60 Decay
process = _ : peakenvelope(decayFactor);
PeakHolder with Timer
process = _ : peakHolder(1);
PeakHold module with an exponential decay curve
Zavalishin's Onepole TPT Filter
Outs: lp , hp , ap
Lowpass TPT
Highpass TPT
Lookahead Limiter | import("stdfaust.lib");
peakenvelope(t, x) = abs(x) <: loop ~ _ * rt60(t)
with{
loop(y, z) = ( (y, z) : max);
rt60(t) = 0.001^((1/ma.SR) / t);
};
peakHolder(holdTime, x) = loop ~ si.bus(2) : ! , _
with {
loop(timerState, outState) = timer , output
with {
isNewPeak = abs(x) >= outState;
isTimeOut = timerState >= (holdTime * ma.SR - 1);
bypass = isNewPeak | isTimeOut;
timer = ba.if(bypass, 0, timerState + 1);
output = ba.if(bypass, abs(x), outState);
};
};
peakHoldwDecay(holdSeconds, frequencyCut, decayT60, x) = x :
peakHolder(holdSeconds) : LPTPT(frequencyCut) : peakenvelope(decayT60);
with {
g = tan(cf * ma.PI * (1.0/ma.SR));
G = g / (1.0 + g);
loop(s) = u , lp , hp , ap
with {
v = (x - s) * G; u = v + lp; lp = v + s; hp = x - lp; ap = lp - hp;
};
};
LPTPT(cf, x) = onePoleTPT(cf, x) : (_ , ! , !);
HPTPT(cf, x) = onePoleTPT(cf, x) : (! , _ , !);
LookaheadLimiter(threshold, x) = ( x : peakHoldwDecay(.1, 500, 10) ) :
( threshold / max(ma.EPSILON, _) : min(1.0) ) *
( x @ (ms2samp(1)));
process = _ : LookaheadLimiter(1); |
90866ddc6b5aa93653bddb94125100f338d518e88d181a4f90d36e707102e525 | LucaSpanedda/Guida_Primi_Codici_in_FAUST | 0.91_dBConversions_and_GUI.dsp | //Importo la libreria standard di Faust
import("stdfaust.lib");
/*
Logaritmo:
potenza = numero alla base, e risultato del numero alla base per la potenza.
ex. potenza di 4 = logaritmo in base 4 di 16 (16 = risultato base 4 alla ^4).
Decibel :
Il decibel (simbolo ㏈) è la decima parte del bel (simbolo B): 10 ㏈ =
1 B ed è un'unità di misura logaritmica del rapporto fra due grandezze omogenee (di potenze).
Il valore ottenuto da un logaritmo è per definizione un numero puro (adimensionale),
ma vi può essere associata un'unità di misura per indicare la base del logaritmo utilizzato.
Logarithm:
power = number at the base, and result of the number at the base for the power.
EX. power of 4 = log base 4 of 16 (16 = result base 4 to ^ 4).
Decibel:
The decibel (symbol ㏈) is the tenth part of the bel (symbol B): 10 ㏈ =
1 B and is a logarithmic unit of measurement of the ratio between two homogeneous quantities (of powers).
The value obtained from a logarithm is by definition a pure (dimensionless) number,
but a unit of measurement can be associated with it to indicate the base of the logarithm used.
*/
// smooth function (Onepole Filter)
Smooth(G) = *(1-G) : +~*(G);
// Conversions Formula: dB to a linear gain (0-1) and linear to dB
lineartodB(g) = 20.0*log10(max(ma.MIN, g));
dBtolinear(l) = pow(10.0, l/20.0);
// GUI Slider in dB = -80 to 0 dB
SliderdB = hslider("Slider in dB",-80,-80,0,0.001) : Smooth(0.98) : dBtoline
with{
dBtoline(G) = pow(10.0, G/20.0);
};
process = no.noise*SliderdB;
| https://raw.githubusercontent.com/LucaSpanedda/Guida_Primi_Codici_in_FAUST/60c39e6cbda295d6eeb82a21af9811f6752ca090/0.91_dBConversions_and_GUI.dsp | faust | Importo la libreria standard di Faust
Logaritmo:
potenza = numero alla base, e risultato del numero alla base per la potenza.
ex. potenza di 4 = logaritmo in base 4 di 16 (16 = risultato base 4 alla ^4).
Decibel :
Il decibel (simbolo ㏈) è la decima parte del bel (simbolo B): 10 ㏈ =
1 B ed è un'unità di misura logaritmica del rapporto fra due grandezze omogenee (di potenze).
Il valore ottenuto da un logaritmo è per definizione un numero puro (adimensionale),
ma vi può essere associata un'unità di misura per indicare la base del logaritmo utilizzato.
Logarithm:
power = number at the base, and result of the number at the base for the power.
EX. power of 4 = log base 4 of 16 (16 = result base 4 to ^ 4).
Decibel:
The decibel (symbol ㏈) is the tenth part of the bel (symbol B): 10 ㏈ =
1 B and is a logarithmic unit of measurement of the ratio between two homogeneous quantities (of powers).
The value obtained from a logarithm is by definition a pure (dimensionless) number,
but a unit of measurement can be associated with it to indicate the base of the logarithm used.
smooth function (Onepole Filter)
Conversions Formula: dB to a linear gain (0-1) and linear to dB
GUI Slider in dB = -80 to 0 dB | import("stdfaust.lib");
Smooth(G) = *(1-G) : +~*(G);
lineartodB(g) = 20.0*log10(max(ma.MIN, g));
dBtolinear(l) = pow(10.0, l/20.0);
SliderdB = hslider("Slider in dB",-80,-80,0,0.001) : Smooth(0.98) : dBtoline
with{
dBtoline(G) = pow(10.0, G/20.0);
};
process = no.noise*SliderdB;
|
2cfc4e2299bc1943f77fa4d3a7616e326df4eb83f6a834bb499c91283e2083bb | LucaSpanedda/Guida_Primi_Codici_in_FAUST | 0.40_Sinusoide.dsp | // SINUSOIDE
//Importo la libreria
import("stdfaust.lib");
//creo una funzione che sottragga i numeri interi lasciando i decimali
decimale(x) = x-int(x);
//creo una funzione in cui stabilisco la frequenza da utilizzare
// e da richiamare a seguito all'occorrenza
frequenza = 440;
//stabilisco la frequenza del fasore:
//dividendola per il Sample Rate,
//e creo il fasore generando il loop dei soli numeri decimali
fasore = frequenza/ma.SR : (+ : decimale) ~ _;
/* ora dobbiamo generare la sinusoide partendo dal fasore:
per creare una sinusoide partendo dal fasore
dobbiamo innanzitutto riscalare questi valori che nel tempo
si muovono tra 0. e 1. (del fasore) per far si che si muovano
per un valore espresso in radianti,
che ci permette di calcolare una circonferenza, e che sappiamo essere
di 2 volte PI GRECO.
il valore di PI GRECO approssimato che useremo è di 3.1415926535897932385
moltiplicato per due è di : 6.2831853071795, e quindi: */
due_pigreco = 6.2831853071795;
// ora dobbiamo creare una funzione per dire al fasore di percorrere
// tutta la lunghezza della circonferenza (6.283185...)
// non andrà più quindi da 0. a 1. ma da 0. a 6.283185... (due pi)
fasore_pi = fasore * due_pigreco;
// ed infine il nostro sin ci restituirà i valori di ampiezza
// che il nostro fasore ora della lunghezza della circonferenza
// deve seguire per restituirci un onda sinusoidale
sinusoide = sin(fasore_pi) ;
//process sono le nostre 2 uscite per la sinusoide generata
process = sinusoide, sinusoide;
/* la nostra sinusoide viene automaticamente assegnata in uscita
a due canali 1 & 2.
(segnale mono, per sorgenti di ascolto L & R). */
| https://raw.githubusercontent.com/LucaSpanedda/Guida_Primi_Codici_in_FAUST/98bc34b89046605d1283cb8fd22574e538b5d03b/0.40_Sinusoide.dsp | faust | SINUSOIDE
Importo la libreria
creo una funzione che sottragga i numeri interi lasciando i decimali
creo una funzione in cui stabilisco la frequenza da utilizzare
e da richiamare a seguito all'occorrenza
stabilisco la frequenza del fasore:
dividendola per il Sample Rate,
e creo il fasore generando il loop dei soli numeri decimali
ora dobbiamo generare la sinusoide partendo dal fasore:
per creare una sinusoide partendo dal fasore
dobbiamo innanzitutto riscalare questi valori che nel tempo
si muovono tra 0. e 1. (del fasore) per far si che si muovano
per un valore espresso in radianti,
che ci permette di calcolare una circonferenza, e che sappiamo essere
di 2 volte PI GRECO.
il valore di PI GRECO approssimato che useremo è di 3.1415926535897932385
moltiplicato per due è di : 6.2831853071795, e quindi:
ora dobbiamo creare una funzione per dire al fasore di percorrere
tutta la lunghezza della circonferenza (6.283185...)
non andrà più quindi da 0. a 1. ma da 0. a 6.283185... (due pi)
ed infine il nostro sin ci restituirà i valori di ampiezza
che il nostro fasore ora della lunghezza della circonferenza
deve seguire per restituirci un onda sinusoidale
process sono le nostre 2 uscite per la sinusoide generata
la nostra sinusoide viene automaticamente assegnata in uscita
a due canali 1 & 2.
(segnale mono, per sorgenti di ascolto L & R). |
import("stdfaust.lib");
decimale(x) = x-int(x);
frequenza = 440;
fasore = frequenza/ma.SR : (+ : decimale) ~ _;
due_pigreco = 6.2831853071795;
fasore_pi = fasore * due_pigreco;
sinusoide = sin(fasore_pi) ;
process = sinusoide, sinusoide;
|
d4bd776d61023c59d4cacfb33ec00f832f5ddfb030e5428105cc956c70281fe5 | LucaSpanedda/Guida_Primi_Codici_in_FAUST | 0.50_Sintesi_Additiva.dsp | // SINTESI ADDITIVA
/* La sintesi additiva è una tecnica di sintesi sonora
utilizzata nella musica elettronica che crea timbriche,
quindi forme d'onda comunque complesse, sommando insieme singole onde,
generalmente sinusoidali.
In base alla teoria di Fourier, la forma d'onda di un segnale
e il suo inviluppo nel tempo possono essere ottenuti matematicamente
come combinazione di onde sinusoidali di frequenza multipla
di una frequenza fondamentale (armoniche) e di onde sinusoidali
parziali di frequenza, fase e ampiezza diversa che, entrambe,
possono crescere, mantenersi e decadere nel tempo.
Questa teoria si può applicare anche alle forme d'onda
generate da uno strumento musicale,
consentendo così di scomporne il timbro e
il suono in onde sinusoidali elementari.
La sintesi additiva sfrutta esattamente questo meccanismo
per imitare il suono di qualsiasi strumento musicale,
sommando l'uscita di più oscillatori usati come generatori di forme d'onda,
modulati e regolati secondo le caratteristiche
risultanti dalla scomposizione di Fourier.
In questo modo è possibile riprodurre la forma d'onda corrispondente
al timbro dello specifico strumento, emulandone quindi il suono. */
// Importo la libreria
import("stdfaust.lib");
//dichiaro 2PI
due_pigreco = 6.2831853071795;
// creo una funzione che sottragga i numeri interi lasciando i decimali
decimale(x) = x-int(x);
// uso un argomento alla funzione per stabilire la frequenza nel process
// e uso un secondo argomento per stabilire l'ampiezza
// e creo la funzione dell'oscillatore sinusoidale
osc(frequenza, ampiezza) = sin((frequenza/ma.SR : (+ : decimale) ~ _ )
*due_pigreco) *ampiezza;
// ora richiamo la funzione più volte per sommare le varie componenti
// (onde sinusoidali) all'interno dello spettro.
// per ognuna: (frequenza, ampiezza).
// Uscita del segnale con il process:
process =
osc(300.5, 0.500) +osc(450, 0.200) +osc(500, 0.100) +osc(600, 0.060);
| https://raw.githubusercontent.com/LucaSpanedda/Guida_Primi_Codici_in_FAUST/1e7dadd7071be6974d9bcba1b7dc8beee435b77e/0.50_Sintesi_Additiva.dsp | faust | SINTESI ADDITIVA
La sintesi additiva è una tecnica di sintesi sonora
utilizzata nella musica elettronica che crea timbriche,
quindi forme d'onda comunque complesse, sommando insieme singole onde,
generalmente sinusoidali.
In base alla teoria di Fourier, la forma d'onda di un segnale
e il suo inviluppo nel tempo possono essere ottenuti matematicamente
come combinazione di onde sinusoidali di frequenza multipla
di una frequenza fondamentale (armoniche) e di onde sinusoidali
parziali di frequenza, fase e ampiezza diversa che, entrambe,
possono crescere, mantenersi e decadere nel tempo.
Questa teoria si può applicare anche alle forme d'onda
generate da uno strumento musicale,
consentendo così di scomporne il timbro e
il suono in onde sinusoidali elementari.
La sintesi additiva sfrutta esattamente questo meccanismo
per imitare il suono di qualsiasi strumento musicale,
sommando l'uscita di più oscillatori usati come generatori di forme d'onda,
modulati e regolati secondo le caratteristiche
risultanti dalla scomposizione di Fourier.
In questo modo è possibile riprodurre la forma d'onda corrispondente
al timbro dello specifico strumento, emulandone quindi il suono.
Importo la libreria
dichiaro 2PI
creo una funzione che sottragga i numeri interi lasciando i decimali
uso un argomento alla funzione per stabilire la frequenza nel process
e uso un secondo argomento per stabilire l'ampiezza
e creo la funzione dell'oscillatore sinusoidale
ora richiamo la funzione più volte per sommare le varie componenti
(onde sinusoidali) all'interno dello spettro.
per ognuna: (frequenza, ampiezza).
Uscita del segnale con il process: |
import("stdfaust.lib");
due_pigreco = 6.2831853071795;
decimale(x) = x-int(x);
osc(frequenza, ampiezza) = sin((frequenza/ma.SR : (+ : decimale) ~ _ )
*due_pigreco) *ampiezza;
process =
osc(300.5, 0.500) +osc(450, 0.200) +osc(500, 0.100) +osc(600, 0.060);
|
4633149246b37a4450467bd90ce3ad3a15c90dc34ac90b83c81d63077bdc2a46 | LucaSpanedda/Guida_Primi_Codici_in_FAUST | 0.90_GUI.dsp | // GUI - GRAPHIC USER INTERFACE
// importo la libreria standard e
// del rumore bianco come sorgente da controllare
import("stdfaust.lib");
noise = no.noise;
/* In FAUST è possibile creare delle interfacce grafiche
per il controllo visuale all'interno del proprio codice.
L'interfaccia grafica, nota anche come GUI
(dall'inglese Graphical User Interface),
in informatica è un tipo di interfaccia utente che consente l'interazione
uomo-macchina in modo visuale utilizzando rappresentazioni grafiche
(es. widget) piuttosto che utilizzando i comandi tipici di un'interfaccia
a riga di comando (vedi shell e front end):
cominciata ad apparire negli anni 1980, tra i primi esempi
il Macintosh 128K di Apple, anche se limitata dal monitor in bianco e nero,
nel gennaio del 1985 Atari Corporation aveva presentato l'Atari ST,
anche se l'interfaccia grafica era monocromatica.
In FAUST per il disegno e controllo tramite delle GUI
Sono presenti varie categorie di oggetti. */
// ad esempio il gate è un semplice tasto ON/OFF
// input moltiplicati per il gate di segnale (0. e 1.)
// process = noise*button("[1]gate segnale");
/* In questo esempio useremo degli slider orizzontali
Per il controllo dell'ampiezza di due noise.
Per assegnare uno slider per il controllo visuale di un parametro,
bisogna richiamarlo tramite il suo comando: hslider.
Dunque: */
// process = noise* hslider("ampiezza noise 1",0,0,1, 0.01),
// noise* hslider("ampiezza noise 2",0,0,1, 0.01);
// Quando viene richiamato un controllo grafico
// la disposizione del suo codice è la seguente:
// oggetto("nome visualizzazione", val.partenza, val.min, val.max, step tra min.max.)
/* Gli oggetti grafici sono divisi in due macrocategorie:
hslider - SLIDER ORIZZONTALE
vslider - SLIDER VERTICALE
di questi si può definire lo stile:
[style:slider] se si vuole un controllo SLIDER
[style:knob] se si vuole un controllo KNOB
Li utilizzeremo ora come KNOB */
process = noise* hslider("Ampiezza knob [style:knob]",0,0,1, 0.01);
| https://raw.githubusercontent.com/LucaSpanedda/Guida_Primi_Codici_in_FAUST/66186175e1dc79e12d2b0773d20b1e15c9f37bb9/0.90_GUI.dsp | faust | GUI - GRAPHIC USER INTERFACE
importo la libreria standard e
del rumore bianco come sorgente da controllare
In FAUST è possibile creare delle interfacce grafiche
per il controllo visuale all'interno del proprio codice.
L'interfaccia grafica, nota anche come GUI
(dall'inglese Graphical User Interface),
in informatica è un tipo di interfaccia utente che consente l'interazione
uomo-macchina in modo visuale utilizzando rappresentazioni grafiche
(es. widget) piuttosto che utilizzando i comandi tipici di un'interfaccia
a riga di comando (vedi shell e front end):
cominciata ad apparire negli anni 1980, tra i primi esempi
il Macintosh 128K di Apple, anche se limitata dal monitor in bianco e nero,
nel gennaio del 1985 Atari Corporation aveva presentato l'Atari ST,
anche se l'interfaccia grafica era monocromatica.
In FAUST per il disegno e controllo tramite delle GUI
Sono presenti varie categorie di oggetti.
ad esempio il gate è un semplice tasto ON/OFF
input moltiplicati per il gate di segnale (0. e 1.)
process = noise*button("[1]gate segnale");
In questo esempio useremo degli slider orizzontali
Per il controllo dell'ampiezza di due noise.
Per assegnare uno slider per il controllo visuale di un parametro,
bisogna richiamarlo tramite il suo comando: hslider.
Dunque:
process = noise* hslider("ampiezza noise 1",0,0,1, 0.01),
noise* hslider("ampiezza noise 2",0,0,1, 0.01);
Quando viene richiamato un controllo grafico
la disposizione del suo codice è la seguente:
oggetto("nome visualizzazione", val.partenza, val.min, val.max, step tra min.max.)
Gli oggetti grafici sono divisi in due macrocategorie:
hslider - SLIDER ORIZZONTALE
vslider - SLIDER VERTICALE
di questi si può definire lo stile:
[style:slider] se si vuole un controllo SLIDER
[style:knob] se si vuole un controllo KNOB
Li utilizzeremo ora come KNOB |
import("stdfaust.lib");
noise = no.noise;
process = noise* hslider("Ampiezza knob [style:knob]",0,0,1, 0.01);
|
78507279fe23e5cfeec022613e93f2200a953dba450ed81ae699520d18f395ba | LucaSpanedda/Guida_Primi_Codici_in_FAUST | 0.03_Funzioni_with.dsp | // LA FUNZIONE CON WITH
//Importo la libreria standard di FAUST
import("stdfaust.lib");
// Una Funzione contiene le istruzioni che specificano
// le operazioni da effettuare al suo interno.
// In FAUST una funzione può essere creata specificando
// un nome da dare alle istruzioni che seguono,
// e scrivendo nel caso in cui sia necessario,
// una lista di argomenti tra le parantesi tonda (),
// ad esempio:
// nome_funzione(argomento_1, argomento_2)
// a seguito della funzione
// bisogna eseguire un uguale che indica
// quale variabile contenuta nella funzione rappresenta
// la funzione stessa, senza ;
// ad esempio:
// nome_funzione(argomento_1, argomento_2) = argomento_1+argomento_2;
// infine le istruzioni di una funzione possono venire
// racchiuse tra due parentesi graffa,
// e nella parentesi in apertura il with,
// with{};
// ad esempio:
// nome_funzione(argomento_1, argomento_2) = variabile_1
// with{
// variabile_1 = argomento_1*10 + argomento_2*20;
// };
// il process è seguito della funzione
// per determinare quale funzione è in uscita,
// ad esempio:
// process = nome_funzione(100, 20);
// dove 100, e 20, assumono il ruolo di argomento_1 e 2.
// utilizziamo ora una funzione per creare un segnale rampa,
// con un controllo della frequenza e dell'ampiezza
// in uscita.
// Funzione osc1 con 2 argomenti.
// Richiama la variabile della funzione: fasore_out.
osc1(frequency, amplitude) = fasore_out
with{
// decimale e argomento step, (reset intero).
decimale(step)= step-int(step);
// genero il fasore utilizzando il reset int,
// e impostando un loop.
// Uso la prima variabile frequency
// per cambiare il periodo del fasore.
fasore = (frequency/ma.SR) : (+ : decimale) ~ _;
// sposto l'adc offset: il mio fasore era da +0. a +1,
// ora è da -0.5 a +0.5.
riscalamento_fasi = fasore-0.5;
// uso la variabile 2 per definire l'ampiezza.
// fasore out è la mia variabile richiamata dalla funzione,
// è dunque ciò che la funzione esegue.
fasore_out = amplitude * riscalamento_fasi;
};
// infine il process con in uscita la funzione
// e i suoi argomenti (frequenza, e ampiezza)
process = osc1(200, 1.), osc1(301, 1.);
| https://raw.githubusercontent.com/LucaSpanedda/Guida_Primi_Codici_in_FAUST/0c35091ef7d2e354d82fa9d75efb15d7947df058/0.03_Funzioni_with.dsp | faust | LA FUNZIONE CON WITH
Importo la libreria standard di FAUST
Una Funzione contiene le istruzioni che specificano
le operazioni da effettuare al suo interno.
In FAUST una funzione può essere creata specificando
un nome da dare alle istruzioni che seguono,
e scrivendo nel caso in cui sia necessario,
una lista di argomenti tra le parantesi tonda (),
ad esempio:
nome_funzione(argomento_1, argomento_2)
a seguito della funzione
bisogna eseguire un uguale che indica
quale variabile contenuta nella funzione rappresenta
la funzione stessa, senza ;
ad esempio:
nome_funzione(argomento_1, argomento_2) = argomento_1+argomento_2;
infine le istruzioni di una funzione possono venire
racchiuse tra due parentesi graffa,
e nella parentesi in apertura il with,
with{};
ad esempio:
nome_funzione(argomento_1, argomento_2) = variabile_1
with{
variabile_1 = argomento_1*10 + argomento_2*20;
};
il process è seguito della funzione
per determinare quale funzione è in uscita,
ad esempio:
process = nome_funzione(100, 20);
dove 100, e 20, assumono il ruolo di argomento_1 e 2.
utilizziamo ora una funzione per creare un segnale rampa,
con un controllo della frequenza e dell'ampiezza
in uscita.
Funzione osc1 con 2 argomenti.
Richiama la variabile della funzione: fasore_out.
decimale e argomento step, (reset intero).
genero il fasore utilizzando il reset int,
e impostando un loop.
Uso la prima variabile frequency
per cambiare il periodo del fasore.
sposto l'adc offset: il mio fasore era da +0. a +1,
ora è da -0.5 a +0.5.
uso la variabile 2 per definire l'ampiezza.
fasore out è la mia variabile richiamata dalla funzione,
è dunque ciò che la funzione esegue.
infine il process con in uscita la funzione
e i suoi argomenti (frequenza, e ampiezza) |
import("stdfaust.lib");
osc1(frequency, amplitude) = fasore_out
with{
decimale(step)= step-int(step);
fasore = (frequency/ma.SR) : (+ : decimale) ~ _;
riscalamento_fasi = fasore-0.5;
fasore_out = amplitude * riscalamento_fasi;
};
process = osc1(200, 1.), osc1(301, 1.);
|
fa2b0f75d5213e6601d36d0c43c3b3907ff141f3297fb34a7913ee75e84d49fa | LucaSpanedda/RITI-Room-Is-The-Instrument | limiters.dsp | // Faust standard libraries
import("stdfaust.lib");
//------------------------------------------------------------------ FILTERS ---
// Zavalishin Onepole TPT Filter
onePoleTPT(cf, x) = loop ~ _ : ! , si.bus(3) // Outs: lp , hp , ap
with {
g = tan(cf * ma.PI * ma.T);
G = g / (1.0 + g);
loop(s) = u , lp , hp , ap
with {
v = (x - s) * G; u = v + lp; lp = v + s; hp = x - lp; ap = lp - hp;
};
};
// Lowpass TPT
LPTPT(cf, x) = onePoleTPT(cf, x) : (_ , ! , !);
// Highpass TPT
HPTPT(cf, x) = onePoleTPT(cf, x) : (! , _ , !);
//---------------------------------------------------------------- FUNCTIONS ---
ms2samp(t) = (t/1000) * ma.SR;
sec2samp(t) = t * ma.SR;
limit(maxl,minl,x) = x : max(minl, min(maxl));
//---------------------------------------------------------------- ANALIZERS ---
peakHolder(holdTime, x) = loop ~ si.bus(2) : ! , _
with {
loop(timerState, outState) = timer , output
with {
isNewPeak = abs(x) >= outState;
isTimeOut = timerState >= (holdTime * ma.SR - 1);
bypass = isNewPeak | isTimeOut;
timer = ba.if(bypass, 0, timerState + 1);
output = ba.if(bypass, abs(x), outState);
};
};
// RMS with indipendent attack and release time:
// reference:
// Udo Zölzer - Digital Audio Signal Processing Second Edition
// reference :
// https://fmipa.umri.ac.id/wp-content/uploads/2016/03/
// Udo-Zolzer-digital-audio-signal-processing.9780470997857.40435.pdf
RMS(att,rel,x) = loop ~ _ : sqrt
with {
loop(y) = (1.0 - coeff) * x * x + coeff * y
with {
attCoeff = exp(-2.0 * ma.PI * ma.T / att);
relCoeff = exp(-2.0 * ma.PI * ma.T / rel);
coeff = ba.if(abs(x) > y, attCoeff, relCoeff);
};
};
// Moving Average RMS
movingAverage(seconds, x) = x - (x @ N) : fi.pole(1.0) / N
with {
N = seconds * ma.SR;
};
RMSRectangular(seconds, x) = sqrt(max(0, movingAverage(seconds, x * x)));
// Peak Envelope (envelope follower)
// reference :
// https://www.dariosanfilippo.com/blog/2017/
// lookahead-limiting-in-pure-data/
// reference :
// https://www.cs.princeton.edu/courses/archive/spr05/cos579/DSP/DSP.html
peakenvelope(t,x) = abs(x) <: loop ~ _ * rt60(t)
with{
loop(y,z) = ( (y,z) : max);
rt60(t) = 0.001^((1/ma.SR)/t);
};
//------------------------------------------------------- LOOKAHEAD LIMITERS ---
// reference :
// https://www.dariosanfilippo.com/blog/2017/
// lookahead-limiting-in-pure-data/
// reference :
// https://users.iem.at/zmoelnig/publications/limiter/
// Peak normalization
// reference :
// https://www.hackaudio.com/digital-signal-processing/amplitude/peak-normalization/
normalization(treshold, x) = treshold /
( x : peakHolder(.1) : LPTPT(500) : peakenvelope(10)) *
x @ (( 2/1000 ) * ma.SR);
limitation(threshold, x) =
( x : peakHolder(.1) : LPTPT(500) : peakenvelope(10)) :
( threshold / max(ma.EPSILON, _) : min(1.0) ) *
( x @ (ms2samp(1))); | https://raw.githubusercontent.com/LucaSpanedda/RITI-Room-Is-The-Instrument/dc7497f7621a32b070c9f983f75a120d486a5c46/Audio-Analysis/FAUST-SpectralModel/limiters.dsp | faust | Faust standard libraries
------------------------------------------------------------------ FILTERS ---
Zavalishin Onepole TPT Filter
Outs: lp , hp , ap
Lowpass TPT
Highpass TPT
---------------------------------------------------------------- FUNCTIONS ---
---------------------------------------------------------------- ANALIZERS ---
RMS with indipendent attack and release time:
reference:
Udo Zölzer - Digital Audio Signal Processing Second Edition
reference :
https://fmipa.umri.ac.id/wp-content/uploads/2016/03/
Udo-Zolzer-digital-audio-signal-processing.9780470997857.40435.pdf
Moving Average RMS
Peak Envelope (envelope follower)
reference :
https://www.dariosanfilippo.com/blog/2017/
lookahead-limiting-in-pure-data/
reference :
https://www.cs.princeton.edu/courses/archive/spr05/cos579/DSP/DSP.html
------------------------------------------------------- LOOKAHEAD LIMITERS ---
reference :
https://www.dariosanfilippo.com/blog/2017/
lookahead-limiting-in-pure-data/
reference :
https://users.iem.at/zmoelnig/publications/limiter/
Peak normalization
reference :
https://www.hackaudio.com/digital-signal-processing/amplitude/peak-normalization/
| import("stdfaust.lib");
with {
g = tan(cf * ma.PI * ma.T);
G = g / (1.0 + g);
loop(s) = u , lp , hp , ap
with {
v = (x - s) * G; u = v + lp; lp = v + s; hp = x - lp; ap = lp - hp;
};
};
LPTPT(cf, x) = onePoleTPT(cf, x) : (_ , ! , !);
HPTPT(cf, x) = onePoleTPT(cf, x) : (! , _ , !);
ms2samp(t) = (t/1000) * ma.SR;
sec2samp(t) = t * ma.SR;
limit(maxl,minl,x) = x : max(minl, min(maxl));
peakHolder(holdTime, x) = loop ~ si.bus(2) : ! , _
with {
loop(timerState, outState) = timer , output
with {
isNewPeak = abs(x) >= outState;
isTimeOut = timerState >= (holdTime * ma.SR - 1);
bypass = isNewPeak | isTimeOut;
timer = ba.if(bypass, 0, timerState + 1);
output = ba.if(bypass, abs(x), outState);
};
};
RMS(att,rel,x) = loop ~ _ : sqrt
with {
loop(y) = (1.0 - coeff) * x * x + coeff * y
with {
attCoeff = exp(-2.0 * ma.PI * ma.T / att);
relCoeff = exp(-2.0 * ma.PI * ma.T / rel);
coeff = ba.if(abs(x) > y, attCoeff, relCoeff);
};
};
movingAverage(seconds, x) = x - (x @ N) : fi.pole(1.0) / N
with {
N = seconds * ma.SR;
};
RMSRectangular(seconds, x) = sqrt(max(0, movingAverage(seconds, x * x)));
peakenvelope(t,x) = abs(x) <: loop ~ _ * rt60(t)
with{
loop(y,z) = ( (y,z) : max);
rt60(t) = 0.001^((1/ma.SR)/t);
};
normalization(treshold, x) = treshold /
( x : peakHolder(.1) : LPTPT(500) : peakenvelope(10)) *
x @ (( 2/1000 ) * ma.SR);
limitation(threshold, x) =
( x : peakHolder(.1) : LPTPT(500) : peakenvelope(10)) :
( threshold / max(ma.EPSILON, _) : min(1.0) ) *
( x @ (ms2samp(1))); |
e49fb6ec47943148af53cbc16f1fb1be83c530ef271ec327af7ea69601b6c627 | LucaSpanedda/Guida_Primi_Codici_in_FAUST | 0.61_Oscillatori_Virtual_Analog.dsp | // OSCILLATORI VIRTUAL ANALOG
/* Come appurato, in FAUST è possibile elaborare
la forma d'onda di un segnale imponendo determinate
condizioni matematiche.
Proprio come nel mondo Elettrotecnico è quindi
possibile procedere alla creazione di Oscillatori
matematici, imponendo un determinato tipo di condizioni
di funzionamento in fase di generazione del segnale.
Gli oscillatori Virtual Analog sfruttano tutta la
frequenza di campionamento */
//Importo la libreria standard
import("stdfaust.lib");
// genero un Fasore:
decimale(x) = x-int(x);
phase(f) = f/ma.SR : (+ : decimale) ~ _;
// ONDA TRIANGOLARE
// A Partire dal Fasore generato:
// Il fasore si muove tra i valori di 0. e 1.
// sottraendo 0.5 si muoverà tra -0.5 e +0.5.
scale_phasortr(f) = phase(f) - 0.5;
// con < 0. Passa della rampa solo il segnale minore di 0.5
// Ma mantenendo la sua curva originale grazie alla moltiplicazione
negative_parttr(f) = (scale_phasortr(f) < 0) * scale_phasortr(f);
// con > 0. Passa della rampa solo il segnale maggiore di 0.5
// Ma mantenendo la sua curva originale grazie alla moltiplicazione
positive_parttr(f) = (scale_phasortr(f) > 0) * scale_phasortr(f);
// riporto in negativo la parte positiva facendo in modo che
// la seconda metà del segnale non vada da 0. a 0.5
// ma da 0. a -0.5
transposed_positivetr(f) = positive_parttr(f) * -1;
// sommo le due metà per riformare il segnale:
//la prima parte e la seconda parte transposta in negativo
full_triangletr(f) = negative_parttr(f) + transposed_positivetr(f);
// in questo momento il segnale si muoverà tra -0.5 e 0.
// dunque per rimetterlo in fase aggiungo 0.25 così da
// farlo oscillare tra -0.25 e +0.25
triangle_negativetr(f) = full_triangletr(f) + 0.25;
// Infine controllo l'ampiezza con a
tri(f,a) = triangle_negativetr(f) * a;
// DENTE DI SEGA
// Per l'onda a dente di sega basta riscalare la corsa del fasore
// *-1 inverte e +0.5 reimposta la fase eliminando l'offset
saw(f,a) = (phase(f)*-1+0.5)*a;
// ONDA QUADRA
// A Partire dal Fasore generato imposta una condizione:
// Passa della rampa solo il segnale maggiore di 0.5 divenendo 1.
// ed il minore diventa 0.
// infine il segnale viene riscalato tra fase positiva e negativa
// (-1. e +1.)
square(f,a) = (((phase(f) > 0.5) -0.5) *2) * a;
// Uscita del segnale con il process
process =
square(200,0.2)+saw(250.5,0.3)+tri(300,0.2) <:_,_;
| https://raw.githubusercontent.com/LucaSpanedda/Guida_Primi_Codici_in_FAUST/558be7918684616389e600e3de019534c87588eb/0.61_Oscillatori_Virtual_Analog.dsp | faust | OSCILLATORI VIRTUAL ANALOG
Come appurato, in FAUST è possibile elaborare
la forma d'onda di un segnale imponendo determinate
condizioni matematiche.
Proprio come nel mondo Elettrotecnico è quindi
possibile procedere alla creazione di Oscillatori
matematici, imponendo un determinato tipo di condizioni
di funzionamento in fase di generazione del segnale.
Gli oscillatori Virtual Analog sfruttano tutta la
frequenza di campionamento
Importo la libreria standard
genero un Fasore:
ONDA TRIANGOLARE
A Partire dal Fasore generato:
Il fasore si muove tra i valori di 0. e 1.
sottraendo 0.5 si muoverà tra -0.5 e +0.5.
con < 0. Passa della rampa solo il segnale minore di 0.5
Ma mantenendo la sua curva originale grazie alla moltiplicazione
con > 0. Passa della rampa solo il segnale maggiore di 0.5
Ma mantenendo la sua curva originale grazie alla moltiplicazione
riporto in negativo la parte positiva facendo in modo che
la seconda metà del segnale non vada da 0. a 0.5
ma da 0. a -0.5
sommo le due metà per riformare il segnale:
la prima parte e la seconda parte transposta in negativo
in questo momento il segnale si muoverà tra -0.5 e 0.
dunque per rimetterlo in fase aggiungo 0.25 così da
farlo oscillare tra -0.25 e +0.25
Infine controllo l'ampiezza con a
DENTE DI SEGA
Per l'onda a dente di sega basta riscalare la corsa del fasore
*-1 inverte e +0.5 reimposta la fase eliminando l'offset
ONDA QUADRA
A Partire dal Fasore generato imposta una condizione:
Passa della rampa solo il segnale maggiore di 0.5 divenendo 1.
ed il minore diventa 0.
infine il segnale viene riscalato tra fase positiva e negativa
(-1. e +1.)
Uscita del segnale con il process |
import("stdfaust.lib");
decimale(x) = x-int(x);
phase(f) = f/ma.SR : (+ : decimale) ~ _;
scale_phasortr(f) = phase(f) - 0.5;
negative_parttr(f) = (scale_phasortr(f) < 0) * scale_phasortr(f);
positive_parttr(f) = (scale_phasortr(f) > 0) * scale_phasortr(f);
transposed_positivetr(f) = positive_parttr(f) * -1;
full_triangletr(f) = negative_parttr(f) + transposed_positivetr(f);
triangle_negativetr(f) = full_triangletr(f) + 0.25;
tri(f,a) = triangle_negativetr(f) * a;
saw(f,a) = (phase(f)*-1+0.5)*a;
square(f,a) = (((phase(f) > 0.5) -0.5) *2) * a;
process =
square(200,0.2)+saw(250.5,0.3)+tri(300,0.2) <:_,_;
|
35a36e29aab4f53a0edf9840507ccf052b78f6b39fa436473a4abea84a501e23 | LucaSpanedda/Luca_Spanedda_St_Cecilia_Conservatory_Thesis | Granulator.dsp | // import faust standard library
import("stdfaust.lib");
// hard-coded: change this to match your samplerate
SampleRate = 44100;
//------------------------------------------------ GRANULAR SAMPLING --
grain(L, position, duration, x, trigger) = hann(phase) *
buffer(readPtr, x)
with {
maxLength = L * SampleRate;
length = L * SampleRate;
hann(ph) = sin(ma.PI * ph) ^ 2.0;
lineSegment = loop ~ si.bus(2) : _ , ! , _
with {
loop(yState, incrementState) = y , increment , ready
with {
ready = ((yState == 0.0) | (yState == 1.0)) & trigger;
y = ba.if(ready, increment, min(1.0, yState + increment));
increment = ba.if(ready, ma.T / max(ma.T, duration),
incrementState);
};
};
phase = lineSegment : _ , !;
unlocking = lineSegment : ! , _;
lock(param) = ba.sAndH(unlocking, param);
grainPosition = lock(position);
grainDuration = lock(duration);
readPtr = grainPosition * length + phase * grainDuration * ma.SR;
buffer(readPtr, x) =
it.frwtable(3, maxLength, .0, writePtr, x, readPtrWrapped)
with {
writePtr = ba.period(length);
readPtrWrapped = ma.modulo(readPtr, length);
};
};
// works for N >= 2
triggerArray(N, rate) = loop ~ si.bus(3) : (! , ! , _) <:
par(i, N, == (i)) : par(i, N, \(x).(x > x'))
with {
loop(incrState, phState, counterState) = incr , ph , counter
with {
init = 1 - 1';
trigger = (phState < phState') + init;
incr = ba.if(trigger, rate * ma.T, incrState);
ph = ma.frac(incr + phState);
counter = (trigger + counterState) % N;
};
};
grainN(voices, L, position, rate, duration, x) =
triggerArray(voices, rate) :
par(i, voices, grain(L, position, duration, x));
process = os.osc(200) * .5 <: grainN(10, 4,
hslider("Grain Position", -1, -1, 1, .001),
hslider("Grain Rate", 1, 1, 100, .001),
hslider("Grain Duration", 0.100, 0, 1, .001)) :> _;
// in the full system this this is the granular sampling function
granular_sampling(var1, timeIndex, memWriteDel, cntrlLev, divDur, x) =
grainN(10, var1, position, rate, duration, x) :> _
with {
rnd = no.noise;
memPointerJitter = rnd * (1.0 - memWriteDel) * .01;
position = timeIndex * (1.0 - ((1.0 - memWriteDel) * .01)) +
memPointerJitter;
density = 1.0 - cntrlLev;
rate = 50 ^ (density * 2.0 - 1.0);
grainDuration = .023 + (1.0 - memWriteDel) / divDur;
duration = grainDuration + grainDuration * .1 * rnd;
}; | https://raw.githubusercontent.com/LucaSpanedda/Luca_Spanedda_St_Cecilia_Conservatory_Thesis/b73b60d9e0b45e09bbf72b1477c21202b895f1bb/ITA/codes/Granulator.dsp | faust | import faust standard library
hard-coded: change this to match your samplerate
------------------------------------------------ GRANULAR SAMPLING --
works for N >= 2
in the full system this this is the granular sampling function | import("stdfaust.lib");
SampleRate = 44100;
grain(L, position, duration, x, trigger) = hann(phase) *
buffer(readPtr, x)
with {
maxLength = L * SampleRate;
length = L * SampleRate;
hann(ph) = sin(ma.PI * ph) ^ 2.0;
lineSegment = loop ~ si.bus(2) : _ , ! , _
with {
loop(yState, incrementState) = y , increment , ready
with {
ready = ((yState == 0.0) | (yState == 1.0)) & trigger;
y = ba.if(ready, increment, min(1.0, yState + increment));
increment = ba.if(ready, ma.T / max(ma.T, duration),
incrementState);
};
};
phase = lineSegment : _ , !;
unlocking = lineSegment : ! , _;
lock(param) = ba.sAndH(unlocking, param);
grainPosition = lock(position);
grainDuration = lock(duration);
readPtr = grainPosition * length + phase * grainDuration * ma.SR;
buffer(readPtr, x) =
it.frwtable(3, maxLength, .0, writePtr, x, readPtrWrapped)
with {
writePtr = ba.period(length);
readPtrWrapped = ma.modulo(readPtr, length);
};
};
triggerArray(N, rate) = loop ~ si.bus(3) : (! , ! , _) <:
par(i, N, == (i)) : par(i, N, \(x).(x > x'))
with {
loop(incrState, phState, counterState) = incr , ph , counter
with {
init = 1 - 1';
trigger = (phState < phState') + init;
incr = ba.if(trigger, rate * ma.T, incrState);
ph = ma.frac(incr + phState);
counter = (trigger + counterState) % N;
};
};
grainN(voices, L, position, rate, duration, x) =
triggerArray(voices, rate) :
par(i, voices, grain(L, position, duration, x));
process = os.osc(200) * .5 <: grainN(10, 4,
hslider("Grain Position", -1, -1, 1, .001),
hslider("Grain Rate", 1, 1, 100, .001),
hslider("Grain Duration", 0.100, 0, 1, .001)) :> _;
granular_sampling(var1, timeIndex, memWriteDel, cntrlLev, divDur, x) =
grainN(10, var1, position, rate, duration, x) :> _
with {
rnd = no.noise;
memPointerJitter = rnd * (1.0 - memWriteDel) * .01;
position = timeIndex * (1.0 - ((1.0 - memWriteDel) * .01)) +
memPointerJitter;
density = 1.0 - cntrlLev;
rate = 50 ^ (density * 2.0 - 1.0);
grainDuration = .023 + (1.0 - memWriteDel) / divDur;
duration = grainDuration + grainDuration * .1 * rnd;
}; |
cbd91ed72e76c9279ddf329bc06ce393a96482dfa5e070580fbd4119218ddc2a | LucaSpanedda/RITI-Room-Is-The-Instrument | autolorenz2.dsp | // Faust standard libraries
import("stdfaust.lib");
Ktf = ( hslider("Tangent", 1, 1, 100, .001) ) : si.smoo;
Fbf = ( hslider("Feedback", 1, -1, 1, .001) + 1)/2 : si.smoo;
// INSTRUMENT SPECTRE --------------------------------------
// Import lists: Frequencies, Amps, Bandwidth
spectrefreq = component("frequencies.dsp").frequencieslist;
spectreamps = component("amplitudes.dsp").amplitudeslist;
spectreband = component("bandwidths.dsp").bandwidthslist;
// index of the lists
Flist(index) = ba.take(index, spectrefreq) * 1.00 ;
Alist(index) = ba.take(index, spectreamps) * 1.00 ;
BWlist(index) = ba.take(1, spectreband) * 1 ;
// process = Flist(11), Flist(11), BWlist(11);
// BP FILTER ----------------------------------------------
// optimized BP from the TPT version of the SVF Filter by Vadim Zavalishin
// reference : (by Will Pirkle)
// http://www.willpirkle.com/Downloads/AN-4VirtualAnalogFilters.2.0.pdf
BPSVF(glin, bw, cf, x) = loop ~ si.bus(2) : (! , ! , _)
with {
g = tan(cf * ma.PI * ma.T);
Q = cf / max(ma.EPSILON, bw);
R = 1.0 / (Q + Q);
G = 1.0 / (1.0 + 2.0 * R * g + g * g);
loop(s1, s2) = u1 , u2 , bp * glin
with {
bp = (g * (x - s2) + s1) * G;
bp2 = bp + bp;
v2 = bp2 * g;
u1 = bp2 - s1;
u2 = v2 + s2;
};
};
// Spectre BP Filter Bank
filterbanks(cascade, parallel, x) =
x <: par(i, parallel,
seq(r, cascade, BPSVF(
Alist(i + 1),
BWlist(i + 1),
Flist(i + 1)
)
)
):> (+/parallel);
// SMS Out
// Import limiter
normalize(treshold, x) = component("limiters.dsp").normalization(treshold, x);
slidertest = si.smoo( ba.db2linear( hslider("Amp [unit:db]", -80, -80, 0, .001) ) );
//process = no.noise * slidertest * 10 : filterbanks(1, 128) <: _,_;
// Autoregulating Lorenz System
autolorenzL(in, dcfc, l) =
( loop : par(i, 7, _/(Fbf)) ) ~ si.bus(7) :
par(i, 7, /(l * 2)): mixer
with {
// saturator(lim,x) = lim*ma.tanh(x);
saturator(lim,x) = lim * ma.tanh(x/(max(lim,ma.EPSILON)));
dcblock(dcfc,x) = fi.highpass(1, dcfc, x);
loop(x, y, z, sigma, dt, rho, beta) =
filterbanks(1, 64, saturator(l, dcblock(10,((x+in) + sigma * ((y+in) - (x+in)) * dt))) ) ,
filterbanks(1, 64, saturator(l, dcblock(10,((y+in) + (rho * (x+in) - (x+in) * z - (y+in)) * dt ))) ) ,
filterbanks(1, 64, saturator(l, dcblock(10,((z+in) + ((x+in) * (y+in) - beta * (z+in)) * dt ))) ) ,
(((x+y+z)/3 : ba.ba.peakholder(64))*8.2),
(((x+y+z)/3 : ba.ba.peakholder(64))*0.60),
(((x+y+z)/3 : ba.ba.peakholder(64))*0.001),
(((x+y+z)/3 : ba.ba.peakholder(64))*0.10);
mixer(a,b,c,d,e,f,g) = (a+b+c)/3;
};
autolorenzR(in, dcfc, l) =
( loop : par(i, 7, _/(Fbf)) ) ~ si.bus(7) :
par(i, 7, /(l * 2)): mixer
with {
// saturator(lim,x) = lim * ma.tanh(x);
saturator(lim,x) = lim*ma.tanh(x/(max(lim,ma.EPSILON)));
dcblock(dcfc,x) = fi.highpass(1, dcfc, x);
loop(x, y, z, sigma, dt, rho, beta) =
filterbanks(1, 64, saturator(l, dcblock(10,((x+in) + sigma * ((y+in) - (x+in)) * dt))) ) ,
filterbanks(1, 64, saturator(l, dcblock(10,((y+in) + (rho * (x+in) - (x+in) * z - (y+in)) * dt ))) ) ,
filterbanks(1, 64, saturator(l, dcblock(10,((z+in) + ((x+in) * (y+in) - beta * (z+in)) * dt ))) ) ,
(((x+y+z)/3 : ba.ba.peakholder(64))*8.0),
(((x+y+z)/3 : ba.ba.peakholder(64))*0.62),
(((x+y+z)/3 : ba.ba.peakholder(64))*0.001),
(((x+y+z)/3 : ba.ba.peakholder(64))*0.10);
mixer(a,b,c,d,e,f,g) = (a+b+c)/3;
};
chain(gainin,gainout) = (_*gainin <: autolorenzL(_,10,Ktf)*gainout), (_*gainin <: autolorenzR(_,10,Ktf)*gainout)@ma.SR;
process = chain(1,1); | https://raw.githubusercontent.com/LucaSpanedda/RITI-Room-Is-The-Instrument/dc7497f7621a32b070c9f983f75a120d486a5c46/Audio-Analysis/FAUST-SpectralModel/autolorenz2.dsp | faust | Faust standard libraries
INSTRUMENT SPECTRE --------------------------------------
Import lists: Frequencies, Amps, Bandwidth
index of the lists
process = Flist(11), Flist(11), BWlist(11);
BP FILTER ----------------------------------------------
optimized BP from the TPT version of the SVF Filter by Vadim Zavalishin
reference : (by Will Pirkle)
http://www.willpirkle.com/Downloads/AN-4VirtualAnalogFilters.2.0.pdf
Spectre BP Filter Bank
SMS Out
Import limiter
process = no.noise * slidertest * 10 : filterbanks(1, 128) <: _,_;
Autoregulating Lorenz System
saturator(lim,x) = lim*ma.tanh(x);
saturator(lim,x) = lim * ma.tanh(x); | import("stdfaust.lib");
Ktf = ( hslider("Tangent", 1, 1, 100, .001) ) : si.smoo;
Fbf = ( hslider("Feedback", 1, -1, 1, .001) + 1)/2 : si.smoo;
spectrefreq = component("frequencies.dsp").frequencieslist;
spectreamps = component("amplitudes.dsp").amplitudeslist;
spectreband = component("bandwidths.dsp").bandwidthslist;
Flist(index) = ba.take(index, spectrefreq) * 1.00 ;
Alist(index) = ba.take(index, spectreamps) * 1.00 ;
BWlist(index) = ba.take(1, spectreband) * 1 ;
BPSVF(glin, bw, cf, x) = loop ~ si.bus(2) : (! , ! , _)
with {
g = tan(cf * ma.PI * ma.T);
Q = cf / max(ma.EPSILON, bw);
R = 1.0 / (Q + Q);
G = 1.0 / (1.0 + 2.0 * R * g + g * g);
loop(s1, s2) = u1 , u2 , bp * glin
with {
bp = (g * (x - s2) + s1) * G;
bp2 = bp + bp;
v2 = bp2 * g;
u1 = bp2 - s1;
u2 = v2 + s2;
};
};
filterbanks(cascade, parallel, x) =
x <: par(i, parallel,
seq(r, cascade, BPSVF(
Alist(i + 1),
BWlist(i + 1),
Flist(i + 1)
)
)
):> (+/parallel);
normalize(treshold, x) = component("limiters.dsp").normalization(treshold, x);
slidertest = si.smoo( ba.db2linear( hslider("Amp [unit:db]", -80, -80, 0, .001) ) );
autolorenzL(in, dcfc, l) =
( loop : par(i, 7, _/(Fbf)) ) ~ si.bus(7) :
par(i, 7, /(l * 2)): mixer
with {
saturator(lim,x) = lim * ma.tanh(x/(max(lim,ma.EPSILON)));
dcblock(dcfc,x) = fi.highpass(1, dcfc, x);
loop(x, y, z, sigma, dt, rho, beta) =
filterbanks(1, 64, saturator(l, dcblock(10,((x+in) + sigma * ((y+in) - (x+in)) * dt))) ) ,
filterbanks(1, 64, saturator(l, dcblock(10,((y+in) + (rho * (x+in) - (x+in) * z - (y+in)) * dt ))) ) ,
filterbanks(1, 64, saturator(l, dcblock(10,((z+in) + ((x+in) * (y+in) - beta * (z+in)) * dt ))) ) ,
(((x+y+z)/3 : ba.ba.peakholder(64))*8.2),
(((x+y+z)/3 : ba.ba.peakholder(64))*0.60),
(((x+y+z)/3 : ba.ba.peakholder(64))*0.001),
(((x+y+z)/3 : ba.ba.peakholder(64))*0.10);
mixer(a,b,c,d,e,f,g) = (a+b+c)/3;
};
autolorenzR(in, dcfc, l) =
( loop : par(i, 7, _/(Fbf)) ) ~ si.bus(7) :
par(i, 7, /(l * 2)): mixer
with {
saturator(lim,x) = lim*ma.tanh(x/(max(lim,ma.EPSILON)));
dcblock(dcfc,x) = fi.highpass(1, dcfc, x);
loop(x, y, z, sigma, dt, rho, beta) =
filterbanks(1, 64, saturator(l, dcblock(10,((x+in) + sigma * ((y+in) - (x+in)) * dt))) ) ,
filterbanks(1, 64, saturator(l, dcblock(10,((y+in) + (rho * (x+in) - (x+in) * z - (y+in)) * dt ))) ) ,
filterbanks(1, 64, saturator(l, dcblock(10,((z+in) + ((x+in) * (y+in) - beta * (z+in)) * dt ))) ) ,
(((x+y+z)/3 : ba.ba.peakholder(64))*8.0),
(((x+y+z)/3 : ba.ba.peakholder(64))*0.62),
(((x+y+z)/3 : ba.ba.peakholder(64))*0.001),
(((x+y+z)/3 : ba.ba.peakholder(64))*0.10);
mixer(a,b,c,d,e,f,g) = (a+b+c)/3;
};
chain(gainin,gainout) = (_*gainin <: autolorenzL(_,10,Ktf)*gainout), (_*gainin <: autolorenzR(_,10,Ktf)*gainout)@ma.SR;
process = chain(1,1); |
f40117f0f81761b5f094f24b365c30727886ea8846ac9ba38782e76663e29034 | LucaSpanedda/Guida_Primi_Codici_in_FAUST | 0.01_Funzione.dsp | // FUNZIONE
/* FAUST (Functional AUdio STream) è un linguaggio di programmazione
puramente funzionale di dominio specifico per l'implementazione
di algoritmi di elaborazione del segnale sotto forma di librerie,
plug-in audio o applicazioni standalone. Un programma FAUST
denota un processore di segnale: una funzione matematica
che viene applicata a un segnale in ingresso e quindi emessa.
FAUST è un linguaggio testuale ma orientato allo schema a blocchi.
Combina due approcci:
programmazione funzionale e diagrammi a blocchi algebrici,
che sono costruiti tramite la composizione di funzioni.
Per questo, FAUST si basa su un'algebra
del diagramma a blocchi di cinque operazioni di composizione. */
// La libreria standard di FAUST è chiamata "stdfaust.lib"
// e si importa così:
import("stdfaust.lib");
/* Il modello di programmazione FAUST combina un approccio
di programmazione funzionale con una sintassi del diagramma a blocchi:
l'approccio di programmazione funzionale fornisce un quadro naturale
per l'elaborazione del segnale.
I segnali digitali sono modellati come funzioni discrete del tempo,
i processori di segnale come funzioni del secondo ordine che operano
su di essi
e gli operatori di composizione del diagramma a blocchi di FAUST,
utilizzati per combinare insieme i processori di segnale,
come funzioni del terzo ordine, ecc.
I diagrammi a blocchi, anche se puramente testuali come in FAUST,
promuovono un approccio modulare all'elaborazione del segnale conforme
alle abitudini degli ingegneri del suono e degli sviluppatori audio.
Un programma FAUST non descrive un suono o un gruppo di suoni,
ma un processore di segnale.
Il sorgente del programma è organizzato come un insieme di definizioni
con almeno la definizione della parola chiave process
(l'equivalente di main in C): */
process = no.noise;
/* Il compilatore FAUST traduce il codice FAUST in un oggetto C++,
che può quindi interfacciarsi con altro codice C++
per produrre un programma completo.
Il codice generato funziona a livello di singoli campioni.
È quindi adatto per implementare funzioni Digital Signal Processing
di basso livello come i filtri ricorsivi.
Il codice può anche essere incorporato.
È autonomo e non dipende da alcuna libreria DSP o sistema runtime.
Ha un comportamento molto deterministico e una dimensione di memoria costante.
La semantica di FAUST vuole essere semplice e ben definita.
Consente al compilatore FAUST di essere guidato semanticamente.
Invece di compilare letteralmente un programma,
compila la funzione matematica che denota.
Ciò può favorire il riutilizzo dei componenti.
Inoltre, avere accesso alla semantica esatta di un programma FAUST
può semplificare i problemi di conservazione. */
| https://raw.githubusercontent.com/LucaSpanedda/Guida_Primi_Codici_in_FAUST/a852872573158e0c2d48003274317113678e167d/0.01_Funzione.dsp | faust | FUNZIONE
FAUST (Functional AUdio STream) è un linguaggio di programmazione
puramente funzionale di dominio specifico per l'implementazione
di algoritmi di elaborazione del segnale sotto forma di librerie,
plug-in audio o applicazioni standalone. Un programma FAUST
denota un processore di segnale: una funzione matematica
che viene applicata a un segnale in ingresso e quindi emessa.
FAUST è un linguaggio testuale ma orientato allo schema a blocchi.
Combina due approcci:
programmazione funzionale e diagrammi a blocchi algebrici,
che sono costruiti tramite la composizione di funzioni.
Per questo, FAUST si basa su un'algebra
del diagramma a blocchi di cinque operazioni di composizione.
La libreria standard di FAUST è chiamata "stdfaust.lib"
e si importa così:
Il modello di programmazione FAUST combina un approccio
di programmazione funzionale con una sintassi del diagramma a blocchi:
l'approccio di programmazione funzionale fornisce un quadro naturale
per l'elaborazione del segnale.
I segnali digitali sono modellati come funzioni discrete del tempo,
i processori di segnale come funzioni del secondo ordine che operano
su di essi
e gli operatori di composizione del diagramma a blocchi di FAUST,
utilizzati per combinare insieme i processori di segnale,
come funzioni del terzo ordine, ecc.
I diagrammi a blocchi, anche se puramente testuali come in FAUST,
promuovono un approccio modulare all'elaborazione del segnale conforme
alle abitudini degli ingegneri del suono e degli sviluppatori audio.
Un programma FAUST non descrive un suono o un gruppo di suoni,
ma un processore di segnale.
Il sorgente del programma è organizzato come un insieme di definizioni
con almeno la definizione della parola chiave process
(l'equivalente di main in C):
Il compilatore FAUST traduce il codice FAUST in un oggetto C++,
che può quindi interfacciarsi con altro codice C++
per produrre un programma completo.
Il codice generato funziona a livello di singoli campioni.
È quindi adatto per implementare funzioni Digital Signal Processing
di basso livello come i filtri ricorsivi.
Il codice può anche essere incorporato.
È autonomo e non dipende da alcuna libreria DSP o sistema runtime.
Ha un comportamento molto deterministico e una dimensione di memoria costante.
La semantica di FAUST vuole essere semplice e ben definita.
Consente al compilatore FAUST di essere guidato semanticamente.
Invece di compilare letteralmente un programma,
compila la funzione matematica che denota.
Ciò può favorire il riutilizzo dei componenti.
Inoltre, avere accesso alla semantica esatta di un programma FAUST
può semplificare i problemi di conservazione. |
import("stdfaust.lib");
process = no.noise;
|
75e71dbbe5053d82e81bb85817ee32cbea09616632746e809832c3e43dbf303d | LucaSpanedda/RITI-Room-Is-The-Instrument | spectral_modeling_synthesis.dsp | // Faust standard libraries
import("stdfaust.lib");
// Import lists: Frequencies, Amps, Bandwidth
import("chunk1ch1D2_Cello.lib");
import("chunk2ch1D2_Cello.lib");
import("chunk3ch1D2_Cello.lib");
import("chunk4ch1D2_Cello.lib");
// import list example:
// chunk_1_ch1_D2_Cello_frequencies
// chunk_2_ch1_D2_Cello_amplitudes
// chunk_4_ch1_D2_Cello_bandwidths
// Spectral Modeling Synthesis
// https://en.wikipedia.org/wiki/Spectral_modeling_synthesis
// INSTRUMENT SPECTRE --------------------------------------
// index of the lists
Flist(index) = ba.take(index, chunk_1_ch1_D2_Cello_frequencies) * 1 ;
Alist(index) = ba.take(index, chunk_1_ch1_D2_Cello_amplitudes) * 1 ;
BWlist(index) = ba.take(1, chunk_1_ch1_D2_Cello_bandwidths) * 1/100 ;
// process = Flist(11), Flist(11), BWlist(11);
Flist2(index) = ba.take(index, chunk_2_ch1_D2_Cello_frequencies) * 1 ;
Alist2(index) = ba.take(index, chunk_2_ch1_D2_Cello_amplitudes) * 1 ;
BWlist2(index) = ba.take(1, chunk_2_ch1_D2_Cello_bandwidths) * 1/100 ;
// process = Flist(11), Flist(11), BWlist(11);
Flist3(index) = ba.take(index, chunk_3_ch1_D2_Cello_frequencies) * 1 ;
Alist3(index) = ba.take(index, chunk_3_ch1_D2_Cello_amplitudes) * 1 ;
BWlist3(index) = ba.take(1, chunk_3_ch1_D2_Cello_bandwidths) * 1/100 ;
// process = Flist(11), Flist(11), BWlist(11);
Flist4(index) = ba.take(index, chunk_4_ch1_D2_Cello_frequencies) * 1 ;
Alist4(index) = ba.take(index, chunk_4_ch1_D2_Cello_amplitudes) * 1 ;
BWlist4(index) = ba.take(1, chunk_4_ch1_D2_Cello_bandwidths) * 1/100 ;
// process = Flist(11), Flist(11), BWlist(11);
linInterpolate(x0, x1, delta) = x0 + delta * (x1-x0);
siglinInterpol(order, x) = x : seq(r, order, interpolate)
with{
interpolate(y) = y + .5 * (y' - y);
};
//process = os.phasor(1,100) : siglinInterpol(10) <: _,_;
bilinInterpolate(x0, x1, x0b, x1b, dt1, dt2) =
linInterpolate(
linInterpolate(x0, x1, dt1),
linInterpolate(x0b, x1b, dt1),
dt2)
with{
linInterpolate(x0, x1, delta) = x0 + delta * (x1-x0);
};
InterpolatedAlist(i, dt1, dt2) =
bilinInterpolate(Alist(i + 1), Alist2(i + 1), Alist3(i + 1), Alist4(i + 1), dt1, dt2);
InterpolatedBWlist(i, dt1, dt2) =
bilinInterpolate(BWlist(i + 1), BWlist2(i + 1), BWlist3(i + 1), BWlist4(i + 1), dt1, dt2);
InterpolatedFlist(i, dt1, dt2) =
bilinInterpolate(Flist(i + 1), Flist2(i + 1), Flist3(i + 1), Flist4(i + 1), dt1, dt2);
// BP FILTER ----------------------------------------------
// optimized BP from the TPT version of the SVF Filter by Vadim Zavalishin
// reference : (by Will Pirkle)
// http://www.willpirkle.com/Downloads/AN-4VirtualAnalogFilters.2.0.pdf
BPSVF(glin, bw, cf, x) = loop ~ si.bus(2) : (! , ! , _)
with {
g = tan(cf * ma.PI * ma.T);
Q = cf / max(ma.EPSILON, bw);
R = 1.0 / (Q + Q);
G = 1.0 / (1.0 + 2.0 * R * g + g * g);
loop(s1, s2) = u1 , u2 , bp * glin
with {
bp = (g * (x - s2) + s1) * G;
bp2 = bp + bp;
v2 = bp2 * g;
u1 = bp2 - s1;
u2 = v2 + s2;
};
};
// Spectre BP Filter Bank
filterbanks(cascade, parallel, dt1, dt2, x) =
x <: par(i, parallel,
seq(r, cascade, BPSVF(
InterpolatedAlist(i, dt1, dt2),
InterpolatedBWlist(i, dt1, dt2),
InterpolatedFlist(i, dt1, dt2)
)
)
):> (+/parallel);
// SMS Out
pulsexcit = ba.pulse(hslider("fpulse",10000,100,10000,.01)) : si.smoo * 200;
slidertest = si.smoo( ba.db2linear( hslider("Amp [unit:db]", -80, -80, 0, .001) ) );
Dt1 = si.smoo( hslider("dt1", 0, 0, 1, .001) );
Dt2 = si.smoo( hslider("dt2", 0, 0, 1, .001) );
process = no.noise * slidertest * 10 : filterbanks(1, 128, Dt1, Dt2) <: _,_; | https://raw.githubusercontent.com/LucaSpanedda/RITI-Room-Is-The-Instrument/690a472535c921d55f104fb83a849a675a63dc49/Audio-Analysis/Lists/spectral_modeling_synthesis.dsp | faust | Faust standard libraries
Import lists: Frequencies, Amps, Bandwidth
import list example:
chunk_1_ch1_D2_Cello_frequencies
chunk_2_ch1_D2_Cello_amplitudes
chunk_4_ch1_D2_Cello_bandwidths
Spectral Modeling Synthesis
https://en.wikipedia.org/wiki/Spectral_modeling_synthesis
INSTRUMENT SPECTRE --------------------------------------
index of the lists
process = Flist(11), Flist(11), BWlist(11);
process = Flist(11), Flist(11), BWlist(11);
process = Flist(11), Flist(11), BWlist(11);
process = Flist(11), Flist(11), BWlist(11);
process = os.phasor(1,100) : siglinInterpol(10) <: _,_;
BP FILTER ----------------------------------------------
optimized BP from the TPT version of the SVF Filter by Vadim Zavalishin
reference : (by Will Pirkle)
http://www.willpirkle.com/Downloads/AN-4VirtualAnalogFilters.2.0.pdf
Spectre BP Filter Bank
SMS Out | import("stdfaust.lib");
import("chunk1ch1D2_Cello.lib");
import("chunk2ch1D2_Cello.lib");
import("chunk3ch1D2_Cello.lib");
import("chunk4ch1D2_Cello.lib");
Flist(index) = ba.take(index, chunk_1_ch1_D2_Cello_frequencies) * 1 ;
Alist(index) = ba.take(index, chunk_1_ch1_D2_Cello_amplitudes) * 1 ;
BWlist(index) = ba.take(1, chunk_1_ch1_D2_Cello_bandwidths) * 1/100 ;
Flist2(index) = ba.take(index, chunk_2_ch1_D2_Cello_frequencies) * 1 ;
Alist2(index) = ba.take(index, chunk_2_ch1_D2_Cello_amplitudes) * 1 ;
BWlist2(index) = ba.take(1, chunk_2_ch1_D2_Cello_bandwidths) * 1/100 ;
Flist3(index) = ba.take(index, chunk_3_ch1_D2_Cello_frequencies) * 1 ;
Alist3(index) = ba.take(index, chunk_3_ch1_D2_Cello_amplitudes) * 1 ;
BWlist3(index) = ba.take(1, chunk_3_ch1_D2_Cello_bandwidths) * 1/100 ;
Flist4(index) = ba.take(index, chunk_4_ch1_D2_Cello_frequencies) * 1 ;
Alist4(index) = ba.take(index, chunk_4_ch1_D2_Cello_amplitudes) * 1 ;
BWlist4(index) = ba.take(1, chunk_4_ch1_D2_Cello_bandwidths) * 1/100 ;
linInterpolate(x0, x1, delta) = x0 + delta * (x1-x0);
siglinInterpol(order, x) = x : seq(r, order, interpolate)
with{
interpolate(y) = y + .5 * (y' - y);
};
bilinInterpolate(x0, x1, x0b, x1b, dt1, dt2) =
linInterpolate(
linInterpolate(x0, x1, dt1),
linInterpolate(x0b, x1b, dt1),
dt2)
with{
linInterpolate(x0, x1, delta) = x0 + delta * (x1-x0);
};
InterpolatedAlist(i, dt1, dt2) =
bilinInterpolate(Alist(i + 1), Alist2(i + 1), Alist3(i + 1), Alist4(i + 1), dt1, dt2);
InterpolatedBWlist(i, dt1, dt2) =
bilinInterpolate(BWlist(i + 1), BWlist2(i + 1), BWlist3(i + 1), BWlist4(i + 1), dt1, dt2);
InterpolatedFlist(i, dt1, dt2) =
bilinInterpolate(Flist(i + 1), Flist2(i + 1), Flist3(i + 1), Flist4(i + 1), dt1, dt2);
BPSVF(glin, bw, cf, x) = loop ~ si.bus(2) : (! , ! , _)
with {
g = tan(cf * ma.PI * ma.T);
Q = cf / max(ma.EPSILON, bw);
R = 1.0 / (Q + Q);
G = 1.0 / (1.0 + 2.0 * R * g + g * g);
loop(s1, s2) = u1 , u2 , bp * glin
with {
bp = (g * (x - s2) + s1) * G;
bp2 = bp + bp;
v2 = bp2 * g;
u1 = bp2 - s1;
u2 = v2 + s2;
};
};
filterbanks(cascade, parallel, dt1, dt2, x) =
x <: par(i, parallel,
seq(r, cascade, BPSVF(
InterpolatedAlist(i, dt1, dt2),
InterpolatedBWlist(i, dt1, dt2),
InterpolatedFlist(i, dt1, dt2)
)
)
):> (+/parallel);
pulsexcit = ba.pulse(hslider("fpulse",10000,100,10000,.01)) : si.smoo * 200;
slidertest = si.smoo( ba.db2linear( hslider("Amp [unit:db]", -80, -80, 0, .001) ) );
Dt1 = si.smoo( hslider("dt1", 0, 0, 1, .001) );
Dt2 = si.smoo( hslider("dt2", 0, 0, 1, .001) );
process = no.noise * slidertest * 10 : filterbanks(1, 128, Dt1, Dt2) <: _,_; |
fcd54733ed79acb3271f2161df880414eead57475e52eab0bbee6e0429467c6e | LucaSpanedda/Sound_reading_and_writing_techniques_in_Faust | 2.01_Realtime_Granulator_PDB.dsp | // ---------------------------------------------------------------------------------
declare name "PDB_Realtime_Granulator";
declare version "1.0";
declare author "Luca Spanedda";
declare reference "http://www.granularsynthesis.com/guide.php";
/*
RTSG - REAL TIME SYNCHRONOUS GRANULATOR with COUNTER:
100 to 100^-1000 Milliseconds grains - with Envelope window shape control.
PDB - ON PARALLEL FIXED TABLES OF 1 SECOND (TAPES): Parallel Data Buffers.
*/
// import Standard Faust library
// https://github.com/grame-cncm/faustlibraries/
import("stdfaust.lib");
// NUMBER OF PDB FOR GRAINS (INSTANCES)
graininstances = 80;
// GUI
ampguiin = hslider("[3] Grains Amp In",1,0,10,0.01) : si.smoo;
windowgui = hslider("[5] Grains Window",1,1,100,0.1) : si.smoo;
ampgui = hslider("[4] Grains Amp Out",1,0,10,0.01) : si.smoo;
freqguiplus = hslider("[7] Grains Freq+",1,1,100,0.1) : si.smoo;
freqguiminus = hslider("[8] Grains Freq/",1,1,100,0.1): si.smoo;
feedbackgui = hslider("[5] Rec Feedback",0,0,10,0.01) : si.smoo;
panningui = hslider("[6] Panning Speed",1,0,4,0.01) : si.smoo;
// COUNTER
buttoncount = os.osc(hslider("[0] Rec Grain",0,0,graininstances,0.1) : int) > 0;
buttontopulse(x)= x <: _,(_:mem) :> - : max(0);
deccountscale(x)= x%(graininstances);
counter = buttoncount : buttontopulse : +~_ : deccountscale+1
: hbargraph("[2] Rec Grain Instance:[style:numerical]",1,graininstances);
// GRAIN
grain(numbpar,freq,seed,powwindow,amp,panspeed) =
(rwtable(tablesize,0.0,indexwrite,_,indexread)*envelope) <: panning
with{
// COUNTER
condpar = (counter == numbpar); // if counter match par then 1
condmaj = (condpar > 0.5);
condmin = (condpar < 0.5) : mem;
diracmatch = condmaj*condmin;
// GATE (FOR REC) - PEAK HOLD
peakcond(holdTime, x_) = loop ~ _ // hold the dirac impulse for 1000 ms
with {loop(pFB) = ba.if(pReset, abs(x_), pFB)
with {pReset = timerCond | peakCond;
peakCond = abs(x_) >= pFB;
timerCond = loop ~ _
with {loop(tFB) = fi.pole(tReset, tReset) >= (holdTime)
with {tReset = 1 - (peakCond | tFB);
};};};};
partrigger = peakcond(ma.SR, diracmatch); // out 1 for 1 second when match
rampnoise(frequency,seedx) = phasorout
with{
// NOISE GENERATION
noise = (+(seedx)~*(1103515245))/2147483647.0;
// IMPULSE GENERATION
// reset to 0 when int
decimal(x)= x-int(x);
phase = frequency/ma.SR : (+ : decimal) ~ _;
saw = phase-0.5;
ifpos = (saw > 0);
trig = ( ifpos - ( ifpos:mem ) ) > 0;
// SAH THE NOISE FUNCTION (with the impulse)
sahrandom = (*(1 - trig) + noise * trig) ~ _;
sehout = ((sahrandom>0)*2)-1;
// PHASOR GENERATION
phasor = (sehout/ma.SR) : (+ : decimal) ~ _;
// PHASOR TO TRIANGLE
triconditionpos(x) = (x<0.5)*(x) + ((x>0.5)*((x*-1)+1));
trifunctionpos(x) = (x>0)*(x) : triconditionpos;
triconditionneg(x) = (x>-0.5)*(x) + ((x<-0.5)*((x*-1)-1));
trifunctionneg(x) = (x<0)*(x) : triconditionneg;
phasorout = phasor <: trifunctionpos,trifunctionneg :> + : _+0.5;
};
noisepan = rampnoise(panspeed,seed);
// NOISE & PHASOR GENERATION
noise = (((+(seed)~*(1103515245))/2147483647.0)+1)*0.5;
decimale(step)=((step)-int(step));
decorrelation = ((((seed)*(1103515245)/2147483647.0)+1)*0.5)*ma.SR; // rand
fasore = (((freq*10)/ma.SR):(+:decimale)~ _) : _@(decorrelation);
// IMPULSE GENERATION
saw = (fasore*-1)+1;
phasemaj = (saw > 0.5);
phasemin = (saw < 0.5) : mem;
diracphase = phasemaj*phasemin;
// SAH THE NOISE FUNCTION (with the impulse)
sahrandom = (*(1 - diracphase) + noise * diracphase) ~ _;
sehout = (sahrandom +1)/2;
// READER
offset = 2 : int; // Offset for write and read. For point the write index at 0 when stopped.
recstart = partrigger; // when match the i (par) instance then record
record = recstart : int; // record the memory with the int value of 1
tablesize = 192000+offset : int; // dimension in samples of the buffer
dimension = ma.SR : int; // dimension in samples the memory table
indexwrite = (+(1) : %((ma.SR-offset) : int))~ *(record):_+(offset*recstart):int;
indexread = ((fasore*(dimension*0.1)) + (sehout*(dimension*0.9))):_+offset:int;
// ENVELOPE & POW
envelope = ((sin(fasore*ma.PI)):pow(powwindow)*amp); // reder used for env
panning = _*(noisepan), _*(1-noisepan);
};
// GRANULATOR: PARALLEL PROCESS OF THE GRAIN FUNCTION
parallelgrains =
// granulator (with par on grain function)
// grain(==numbpar,Hz-read,seed-noise,window-shape(pow),amp)
_ <: par( i, graininstances, grain(i+1,freqguiplus/freqguiminus,219979*(i+1),
windowgui,1/graininstances,panningui) );
// ROUTING
clipz(a,v) = _*a : min(v) : max(-v);
routingranulator(a,b) = (a+b)*feedbackgui, a, b;
routeout(a,b,c) = b*ampgui, c*ampgui;
routegrains = _*ampguiin : (+ : fi.dcblocker : clipz(1,1) : parallelgrains :>
routingranulator ) ~ _ : routeout;
process = routegrains;
// ---------------------------------------------------------------------------------
| https://raw.githubusercontent.com/LucaSpanedda/Sound_reading_and_writing_techniques_in_Faust/bb01eff05a51424c16420a00b383441d8973d85e/0_work-in-progress/2.01_Realtime_Granulator_PDB.dsp | faust | ---------------------------------------------------------------------------------
RTSG - REAL TIME SYNCHRONOUS GRANULATOR with COUNTER:
100 to 100^-1000 Milliseconds grains - with Envelope window shape control.
PDB - ON PARALLEL FIXED TABLES OF 1 SECOND (TAPES): Parallel Data Buffers.
import Standard Faust library
https://github.com/grame-cncm/faustlibraries/
NUMBER OF PDB FOR GRAINS (INSTANCES)
GUI
COUNTER
GRAIN
COUNTER
if counter match par then 1
GATE (FOR REC) - PEAK HOLD
hold the dirac impulse for 1000 ms
out 1 for 1 second when match
NOISE GENERATION
IMPULSE GENERATION
reset to 0 when int
SAH THE NOISE FUNCTION (with the impulse)
PHASOR GENERATION
PHASOR TO TRIANGLE
NOISE & PHASOR GENERATION
rand
IMPULSE GENERATION
SAH THE NOISE FUNCTION (with the impulse)
READER
Offset for write and read. For point the write index at 0 when stopped.
when match the i (par) instance then record
record the memory with the int value of 1
dimension in samples of the buffer
dimension in samples the memory table
ENVELOPE & POW
reder used for env
GRANULATOR: PARALLEL PROCESS OF THE GRAIN FUNCTION
granulator (with par on grain function)
grain(==numbpar,Hz-read,seed-noise,window-shape(pow),amp)
ROUTING
--------------------------------------------------------------------------------- | declare name "PDB_Realtime_Granulator";
declare version "1.0";
declare author "Luca Spanedda";
declare reference "http://www.granularsynthesis.com/guide.php";
import("stdfaust.lib");
graininstances = 80;
ampguiin = hslider("[3] Grains Amp In",1,0,10,0.01) : si.smoo;
windowgui = hslider("[5] Grains Window",1,1,100,0.1) : si.smoo;
ampgui = hslider("[4] Grains Amp Out",1,0,10,0.01) : si.smoo;
freqguiplus = hslider("[7] Grains Freq+",1,1,100,0.1) : si.smoo;
freqguiminus = hslider("[8] Grains Freq/",1,1,100,0.1): si.smoo;
feedbackgui = hslider("[5] Rec Feedback",0,0,10,0.01) : si.smoo;
panningui = hslider("[6] Panning Speed",1,0,4,0.01) : si.smoo;
buttoncount = os.osc(hslider("[0] Rec Grain",0,0,graininstances,0.1) : int) > 0;
buttontopulse(x)= x <: _,(_:mem) :> - : max(0);
deccountscale(x)= x%(graininstances);
counter = buttoncount : buttontopulse : +~_ : deccountscale+1
: hbargraph("[2] Rec Grain Instance:[style:numerical]",1,graininstances);
grain(numbpar,freq,seed,powwindow,amp,panspeed) =
(rwtable(tablesize,0.0,indexwrite,_,indexread)*envelope) <: panning
with{
condmaj = (condpar > 0.5);
condmin = (condpar < 0.5) : mem;
diracmatch = condmaj*condmin;
with {loop(pFB) = ba.if(pReset, abs(x_), pFB)
with {pReset = timerCond | peakCond;
peakCond = abs(x_) >= pFB;
timerCond = loop ~ _
with {loop(tFB) = fi.pole(tReset, tReset) >= (holdTime)
with {tReset = 1 - (peakCond | tFB);
};};};};
rampnoise(frequency,seedx) = phasorout
with{
noise = (+(seedx)~*(1103515245))/2147483647.0;
decimal(x)= x-int(x);
phase = frequency/ma.SR : (+ : decimal) ~ _;
saw = phase-0.5;
ifpos = (saw > 0);
trig = ( ifpos - ( ifpos:mem ) ) > 0;
sahrandom = (*(1 - trig) + noise * trig) ~ _;
sehout = ((sahrandom>0)*2)-1;
phasor = (sehout/ma.SR) : (+ : decimal) ~ _;
triconditionpos(x) = (x<0.5)*(x) + ((x>0.5)*((x*-1)+1));
trifunctionpos(x) = (x>0)*(x) : triconditionpos;
triconditionneg(x) = (x>-0.5)*(x) + ((x<-0.5)*((x*-1)-1));
trifunctionneg(x) = (x<0)*(x) : triconditionneg;
phasorout = phasor <: trifunctionpos,trifunctionneg :> + : _+0.5;
};
noisepan = rampnoise(panspeed,seed);
noise = (((+(seed)~*(1103515245))/2147483647.0)+1)*0.5;
decimale(step)=((step)-int(step));
fasore = (((freq*10)/ma.SR):(+:decimale)~ _) : _@(decorrelation);
saw = (fasore*-1)+1;
phasemaj = (saw > 0.5);
phasemin = (saw < 0.5) : mem;
diracphase = phasemaj*phasemin;
sahrandom = (*(1 - diracphase) + noise * diracphase) ~ _;
sehout = (sahrandom +1)/2;
indexwrite = (+(1) : %((ma.SR-offset) : int))~ *(record):_+(offset*recstart):int;
indexread = ((fasore*(dimension*0.1)) + (sehout*(dimension*0.9))):_+offset:int;
panning = _*(noisepan), _*(1-noisepan);
};
parallelgrains =
_ <: par( i, graininstances, grain(i+1,freqguiplus/freqguiminus,219979*(i+1),
windowgui,1/graininstances,panningui) );
clipz(a,v) = _*a : min(v) : max(-v);
routingranulator(a,b) = (a+b)*feedbackgui, a, b;
routeout(a,b,c) = b*ampgui, c*ampgui;
routegrains = _*ampguiin : (+ : fi.dcblocker : clipz(1,1) : parallelgrains :>
routingranulator ) ~ _ : routeout;
process = routegrains;
|
6ac877d667f4ed7bf68c1bbc7031f2ac733a95d8ceb74f8c0140d29ddd9db2c3 | LucaSpanedda/Guida_Primi_Codici_in_FAUST | 0.51_Sintesi_Additiva_Onde_Elementari.dsp | // SINTESI ADDITIVA FORME D'ONDA ELEMENTARI
// Importo la libreria
import("stdfaust.lib");
//dichiaro 2PI
due_pigreco = 6.2831853071795;
// Generazione oscillatore sinusoidale:
// creo una funzione che sottragga i numeri interi lasciando i decimali
decimale(x) = x-int(x);
// uso un argomento alla funzione per stabilire la frequenza nel process
// e uso un secondo argomento per stabilire l'ampiezza
// e creo la funzione dell'oscillatore sinusoidale
osc(frequenza, ampiezza) = sin((frequenza/ma.SR : (+ : decimale) ~ _ )
*due_pigreco) *ampiezza;
// Generazione delle forme d'onda elementari
// a partire dalla sintesi additiva.
// definisco due funzioni: una per la frequenza fondamentale
// ed una per l'ampiezza fondamentale:
// COSTANTI OSCILLATORI
f = 200;
a = 0.5;
// applico poi le formule per ricavare le differenti parziali
// che designano il timbro della mia forma d'onda:
// SINUSOIDE
sine =
osc(f,a);
// QUADRA
/* A square wave takes a few more added harmonics to get close
to its ideal mathematical shape. This waveform is created also
using only the odd-numbered harmonics (1, 3, 5, 9...), and zero
is also used for the amplitude of the even
harmonics (2, 4, 6, 8...). Then 1 is divided by the number of the
harmonic to get its amplitude (i.e. 1/h). As illustrated below,
a square wave made up of only four harmonics isn't very square,
but when more harmonics are added its shape becomes very clear.*/
square =
osc(f,a) +
osc(f*3,a/3) +
osc(f*5,a/5) +
osc(f*7,a/7) +
osc(f*9,a/9) +
osc(f*11,a/11) +
osc(f*13,a/13) +
osc(f*15,a/15) +
osc(f*17,a/17) +
osc(f*19,a/19) +
osc(f*21,a/21) +
osc(f*23,a/23) +
osc(f*25,a/25) +
osc(f*27,a/27) +
osc(f*29,a/29) +
osc(f*31,a/31) ;
// TRIANGOLARE
/* A triangle wave can also be quite simply generated with only
a few harmonics.
The shape of a triangle wave is made using only the odd harmonics
(1, 3, 5, 7, etc). Zeros are used for the amplitude
of the even harmonics (2, 4, 6, 8, etc).
Then 1 is divided by the square of each of those harmonics
(i.e. 1/h2). Finally, the amplitude of every other harmonic
is multiplied by -1 (i.e. the amplitudes of
the third, seventh, ninth, etc harmonics).
The triangle wave takes shape very quickly with only four harmonics,
and as more harmonics are added,
the points of the triangle become sharper. */
triangle =
osc(f,a) +
osc(f*3,a*-0.111111) +
osc(f*5,a*0.04) +
osc(f*7,a*-0.0204082) +
osc(f*9,a*0.0123457) +
osc(f*11,a*-0.00826446) ;
// DENTE DI SEGA
/* A sawtooth wave is the simplest, as it uses the formula 1/h
(where "h" indicates the number of the harmonic) to compute
the amplitudes. Therefore, the amplitude of the first harmonic
is 1/1 = 1, the second is 1/2 = 0.5, the third
is 1/3 = 0.33333, etc etc. */
saw =
osc(f,a) +
osc(f*2,a/2) +
osc(f*3,a/3) +
osc(f*4,a/4) +
osc(f*5,a/5) +
osc(f*6,a/6) +
osc(f*7,a/7) +
osc(f*8,a/8) +
osc(f*9,a/9) +
osc(f*10,a/10) +
osc(f*11,a/11) +
osc(f*12,a/12) +
osc(f*13,a/13) +
osc(f*14,a/14) +
osc(f*15,a/15) +
osc(f*16,a/16) ;
// Uscita del segnale con il process:
process = saw;
| https://raw.githubusercontent.com/LucaSpanedda/Guida_Primi_Codici_in_FAUST/3acb04097b6b5eca2c16cced17ce0de6d3c5da44/0.51_Sintesi_Additiva_Onde_Elementari.dsp | faust | SINTESI ADDITIVA FORME D'ONDA ELEMENTARI
Importo la libreria
dichiaro 2PI
Generazione oscillatore sinusoidale:
creo una funzione che sottragga i numeri interi lasciando i decimali
uso un argomento alla funzione per stabilire la frequenza nel process
e uso un secondo argomento per stabilire l'ampiezza
e creo la funzione dell'oscillatore sinusoidale
Generazione delle forme d'onda elementari
a partire dalla sintesi additiva.
definisco due funzioni: una per la frequenza fondamentale
ed una per l'ampiezza fondamentale:
COSTANTI OSCILLATORI
applico poi le formule per ricavare le differenti parziali
che designano il timbro della mia forma d'onda:
SINUSOIDE
QUADRA
A square wave takes a few more added harmonics to get close
to its ideal mathematical shape. This waveform is created also
using only the odd-numbered harmonics (1, 3, 5, 9...), and zero
is also used for the amplitude of the even
harmonics (2, 4, 6, 8...). Then 1 is divided by the number of the
harmonic to get its amplitude (i.e. 1/h). As illustrated below,
a square wave made up of only four harmonics isn't very square,
but when more harmonics are added its shape becomes very clear.
TRIANGOLARE
A triangle wave can also be quite simply generated with only
a few harmonics.
The shape of a triangle wave is made using only the odd harmonics
(1, 3, 5, 7, etc). Zeros are used for the amplitude
of the even harmonics (2, 4, 6, 8, etc).
Then 1 is divided by the square of each of those harmonics
(i.e. 1/h2). Finally, the amplitude of every other harmonic
is multiplied by -1 (i.e. the amplitudes of
the third, seventh, ninth, etc harmonics).
The triangle wave takes shape very quickly with only four harmonics,
and as more harmonics are added,
the points of the triangle become sharper.
DENTE DI SEGA
A sawtooth wave is the simplest, as it uses the formula 1/h
(where "h" indicates the number of the harmonic) to compute
the amplitudes. Therefore, the amplitude of the first harmonic
is 1/1 = 1, the second is 1/2 = 0.5, the third
is 1/3 = 0.33333, etc etc.
Uscita del segnale con il process: |
import("stdfaust.lib");
due_pigreco = 6.2831853071795;
decimale(x) = x-int(x);
osc(frequenza, ampiezza) = sin((frequenza/ma.SR : (+ : decimale) ~ _ )
*due_pigreco) *ampiezza;
f = 200;
a = 0.5;
sine =
osc(f,a);
square =
osc(f,a) +
osc(f*3,a/3) +
osc(f*5,a/5) +
osc(f*7,a/7) +
osc(f*9,a/9) +
osc(f*11,a/11) +
osc(f*13,a/13) +
osc(f*15,a/15) +
osc(f*17,a/17) +
osc(f*19,a/19) +
osc(f*21,a/21) +
osc(f*23,a/23) +
osc(f*25,a/25) +
osc(f*27,a/27) +
osc(f*29,a/29) +
osc(f*31,a/31) ;
triangle =
osc(f,a) +
osc(f*3,a*-0.111111) +
osc(f*5,a*0.04) +
osc(f*7,a*-0.0204082) +
osc(f*9,a*0.0123457) +
osc(f*11,a*-0.00826446) ;
saw =
osc(f,a) +
osc(f*2,a/2) +
osc(f*3,a/3) +
osc(f*4,a/4) +
osc(f*5,a/5) +
osc(f*6,a/6) +
osc(f*7,a/7) +
osc(f*8,a/8) +
osc(f*9,a/9) +
osc(f*10,a/10) +
osc(f*11,a/11) +
osc(f*12,a/12) +
osc(f*13,a/13) +
osc(f*14,a/14) +
osc(f*15,a/15) +
osc(f*16,a/16) ;
process = saw;
|
19a2aa215432ec8d8dbea100a4831d8c8f43212c97405da1c3f2da8ccafd9bc2 | LucaSpanedda/RITI-Room-Is-The-Instrument | RITILorenzNetwork.dsp | // import faust standard library
import("stdfaust.lib");
// import audible ecosystemics objects library
import("ritilib.lib");
// Import lists: Frequencies, Amps, Bandwidth
import("Cello_D2.lib");
// SYSTEM VARIABLES ----------------------------------------
SystemSpaceVar = meterstoSamps(10);
FilterOrder = 1;
FilterPartials = 32;
Voices = 4;
NonLFreq = hslider("Nonlinearities Frequency", .1, 0., 1, .001) : si.smoo;
NonLAmps = hslider("Nonlinearities Amplitude", 0., 0., 1, .001) : si.smoo;
// Filterbanks Controls
DT1Interpolations = si.smoo( hslider("DT1Interpolations", 0, 0, 1, .001) );
DT2Interpolations = si.smoo( hslider("DT2Interpolations", 0, 0, 1, .001) );
BANDWIDTHf = 10 ^ hslider("BANDWIDTH", 0, -1, 1, .001) : si.smoo;
FREQUENCYf = 16 ^ hslider("FREQUENCY", 0, -1, 1, .001) : si.smoo;
FBf = hslider("Network Feedback / Lorenz Feedback", 10, 0, 10, .001) : si.smoo;
NetworkGlobalFBGain = 10 - FBf;
MicsGain = hslider("MicsGain",0,0,1000,.001) : si.smoo;
FreqShift = hslider("FreqShift",1,0.001,2,.001) : si.smoo;
Bandwidth = hslider("Bandwidth",1,1,10,.001) : si.smoo;
SingleUnitInternalFBGain = hslider("SingleUnitInternalFBGain", 1, 0, 1, .001): si.smoo;
MUf = hslider("mu", .08, 0.01, 1.0, .001);
DTf = ( hslider("DT", 0.62, 0, 1, .001)) : si.smoo;
SIGMAf = ( hslider("SIGMA", 8.2, 0, 100, .001)) : si.smoo;
RHOf = ( hslider("RHO", 0.010, 0, .1, .001)) : si.smoo;
BETAf = ( hslider("BETA", 0.10, 0, 10, .001)) : si.smoo;
DIRECTEQUATIONSf = ( hslider("DIRECTEQUATIONS", 0, 0, 1, .001)) : si.smoo;
FILTEREDf = 1 - DIRECTEQUATIONSf;
// Spectre BP Filter Banks
BandpassFiltersBank(x) = x <:
par(i, FilterPartials,
seq(r, FilterOrder,
BPSVF(
AmplitudesListinterpolate( (i + 1), DT1Interpolations, DT2Interpolations),
BandwidthsListinterpolate( (i + 1), DT1Interpolations, DT2Interpolations) * BANDWIDTHf,
FrequenciesListinterpolate( (i + 1), DT1Interpolations, DT2Interpolations) * FREQUENCYf
)
)
):> (+/FilterPartials) * FILTEREDf + x * DIRECTEQUATIONSf;
lorenz(SaturationFactor, ExternalSignal) = loop ~ si.bus(3) : par(i, 3, /(SaturationFactor)) :> _/3
with {
x0 = 1.2;
y0 = 1.3;
z0 = 1.6;
x_init = x0-x0';
y_init = y0-y0';
z_init = z0-z0';
saturator(lim, x) = lim * ma.tanh( x / ( max(lim, ma.EPSILON) ) );
dcblocker(zero,pole,x) = x : dcblockerout
with{
onezero = _ <: _,mem : _,*(zero) : -;
onepole = + ~ *(pole);
dcblockerout = _ : onezero : onepole;
};
dt = DTf;
beta = BETAf;
rho = RHOf;
sigma = SIGMAf;
loop(x, y, z) =
(( (ExternalSignal / 3) + x + sigma * (y - x) * dt + x_init) : dcblocker(1, 0.995) : saturator(SaturationFactor) : BandpassFiltersBank) * FBf,
(( (ExternalSignal / 3) + y + (rho * x - x * z - y) * dt + y_init) : dcblocker(1, 0.995) : saturator(SaturationFactor) : BandpassFiltersBank) * FBf,
(( (ExternalSignal / 3) + z + (x * y - beta * z) * dt + z_init) : dcblocker(1, 0.995) : saturator(SaturationFactor) : BandpassFiltersBank) * FBf;
};
Network(NetV, Mic1, Mic2, Mic3, Mic4) = ( loop ~ _ : (si.block(1), si.bus(NetV)) ) :
par(i, Voices, _ : normalization(1)) : par(i, Voices, _ * OutputGain * cntrlMicSum)
with{
loop(fb) = par(i, NetV,
( ((Mic1/NetV) * MicsGain) + ((fb * NetworkGlobalFBGain)@(SystemSpaceVar*(i + 1))) <:
lorenz(nonLinearSaturation + 1) )
) <: (si.bus(NetV) :> +/NetV), (si.bus(NetV));
cntrlMicSum = (1 - ((Mic1, Mic2, Mic3, Mic4) :> _ : peakHoldwDecay(.1, .1, 10) : _ * CntrlMicGain)) :
limit(1, 0);
nonLinearSaturation = ( ( ( nonLinearity((Mic1 + Mic3) / 2) + 1 ) / 2 ) * NonLinearSaturationGain) :
hgroup( "Mixer", hgroup( "Non Linear Saturation Gain", vmeter(100, 1, 10) ) );
NonLinearSaturationGain =
hgroup( "Mixer",
hgroup( "Non Linear Saturation Gain",
( si.smoo( vslider("Non Linear Saturation Gain", 0, 0, 10, .001) ) )
)
);
OutputGain =
hgroup( "Mixer",
hgroup( "Global Output Gain",
( si.smoo( ba.db2linear( vslider("Global Output Gain [unit:db]", 0, -80, 80, .001) ) ) <:
attach(_, VHmetersEnvelope(_) :vbargraph("VMGOG [unit:dB]", -80, 80 ) ) )
)
);
CntrlMicGain =
hgroup( "Mixer",
hgroup( "Automated Control Gain",
( si.smoo( ba.db2linear( vslider("Automated Control Gain [unit:db]", -80, -80, 80, .001) ) ) <:
attach(_, VHmetersEnvelope(_) :vbargraph("VMACG [unit:dB]", -80, 80 ) ) )
)
);
};
process = (_,_) : \(m1,m2).(m1, m2, m1@(meterstoSamps(2.0432)), m2@(meterstoSamps(2.4132))) : Network(Voices); | https://raw.githubusercontent.com/LucaSpanedda/RITI-Room-Is-The-Instrument/8c49f5b5ea699577e5c0b50a92b680b0173aaea9/Code_Drafts/RITILorenzNetwork.dsp | faust | import faust standard library
import audible ecosystemics objects library
Import lists: Frequencies, Amps, Bandwidth
SYSTEM VARIABLES ----------------------------------------
Filterbanks Controls
Spectre BP Filter Banks
| import("stdfaust.lib");
import("ritilib.lib");
import("Cello_D2.lib");
SystemSpaceVar = meterstoSamps(10);
FilterOrder = 1;
FilterPartials = 32;
Voices = 4;
NonLFreq = hslider("Nonlinearities Frequency", .1, 0., 1, .001) : si.smoo;
NonLAmps = hslider("Nonlinearities Amplitude", 0., 0., 1, .001) : si.smoo;
DT1Interpolations = si.smoo( hslider("DT1Interpolations", 0, 0, 1, .001) );
DT2Interpolations = si.smoo( hslider("DT2Interpolations", 0, 0, 1, .001) );
BANDWIDTHf = 10 ^ hslider("BANDWIDTH", 0, -1, 1, .001) : si.smoo;
FREQUENCYf = 16 ^ hslider("FREQUENCY", 0, -1, 1, .001) : si.smoo;
FBf = hslider("Network Feedback / Lorenz Feedback", 10, 0, 10, .001) : si.smoo;
NetworkGlobalFBGain = 10 - FBf;
MicsGain = hslider("MicsGain",0,0,1000,.001) : si.smoo;
FreqShift = hslider("FreqShift",1,0.001,2,.001) : si.smoo;
Bandwidth = hslider("Bandwidth",1,1,10,.001) : si.smoo;
SingleUnitInternalFBGain = hslider("SingleUnitInternalFBGain", 1, 0, 1, .001): si.smoo;
MUf = hslider("mu", .08, 0.01, 1.0, .001);
DTf = ( hslider("DT", 0.62, 0, 1, .001)) : si.smoo;
SIGMAf = ( hslider("SIGMA", 8.2, 0, 100, .001)) : si.smoo;
RHOf = ( hslider("RHO", 0.010, 0, .1, .001)) : si.smoo;
BETAf = ( hslider("BETA", 0.10, 0, 10, .001)) : si.smoo;
DIRECTEQUATIONSf = ( hslider("DIRECTEQUATIONS", 0, 0, 1, .001)) : si.smoo;
FILTEREDf = 1 - DIRECTEQUATIONSf;
BandpassFiltersBank(x) = x <:
par(i, FilterPartials,
seq(r, FilterOrder,
BPSVF(
AmplitudesListinterpolate( (i + 1), DT1Interpolations, DT2Interpolations),
BandwidthsListinterpolate( (i + 1), DT1Interpolations, DT2Interpolations) * BANDWIDTHf,
FrequenciesListinterpolate( (i + 1), DT1Interpolations, DT2Interpolations) * FREQUENCYf
)
)
):> (+/FilterPartials) * FILTEREDf + x * DIRECTEQUATIONSf;
lorenz(SaturationFactor, ExternalSignal) = loop ~ si.bus(3) : par(i, 3, /(SaturationFactor)) :> _/3
with {
x0 = 1.2;
y0 = 1.3;
z0 = 1.6;
x_init = x0-x0';
y_init = y0-y0';
z_init = z0-z0';
saturator(lim, x) = lim * ma.tanh( x / ( max(lim, ma.EPSILON) ) );
dcblocker(zero,pole,x) = x : dcblockerout
with{
onezero = _ <: _,mem : _,*(zero) : -;
onepole = + ~ *(pole);
dcblockerout = _ : onezero : onepole;
};
dt = DTf;
beta = BETAf;
rho = RHOf;
sigma = SIGMAf;
loop(x, y, z) =
(( (ExternalSignal / 3) + x + sigma * (y - x) * dt + x_init) : dcblocker(1, 0.995) : saturator(SaturationFactor) : BandpassFiltersBank) * FBf,
(( (ExternalSignal / 3) + y + (rho * x - x * z - y) * dt + y_init) : dcblocker(1, 0.995) : saturator(SaturationFactor) : BandpassFiltersBank) * FBf,
(( (ExternalSignal / 3) + z + (x * y - beta * z) * dt + z_init) : dcblocker(1, 0.995) : saturator(SaturationFactor) : BandpassFiltersBank) * FBf;
};
Network(NetV, Mic1, Mic2, Mic3, Mic4) = ( loop ~ _ : (si.block(1), si.bus(NetV)) ) :
par(i, Voices, _ : normalization(1)) : par(i, Voices, _ * OutputGain * cntrlMicSum)
with{
loop(fb) = par(i, NetV,
( ((Mic1/NetV) * MicsGain) + ((fb * NetworkGlobalFBGain)@(SystemSpaceVar*(i + 1))) <:
lorenz(nonLinearSaturation + 1) )
) <: (si.bus(NetV) :> +/NetV), (si.bus(NetV));
cntrlMicSum = (1 - ((Mic1, Mic2, Mic3, Mic4) :> _ : peakHoldwDecay(.1, .1, 10) : _ * CntrlMicGain)) :
limit(1, 0);
nonLinearSaturation = ( ( ( nonLinearity((Mic1 + Mic3) / 2) + 1 ) / 2 ) * NonLinearSaturationGain) :
hgroup( "Mixer", hgroup( "Non Linear Saturation Gain", vmeter(100, 1, 10) ) );
NonLinearSaturationGain =
hgroup( "Mixer",
hgroup( "Non Linear Saturation Gain",
( si.smoo( vslider("Non Linear Saturation Gain", 0, 0, 10, .001) ) )
)
);
OutputGain =
hgroup( "Mixer",
hgroup( "Global Output Gain",
( si.smoo( ba.db2linear( vslider("Global Output Gain [unit:db]", 0, -80, 80, .001) ) ) <:
attach(_, VHmetersEnvelope(_) :vbargraph("VMGOG [unit:dB]", -80, 80 ) ) )
)
);
CntrlMicGain =
hgroup( "Mixer",
hgroup( "Automated Control Gain",
( si.smoo( ba.db2linear( vslider("Automated Control Gain [unit:db]", -80, -80, 80, .001) ) ) <:
attach(_, VHmetersEnvelope(_) :vbargraph("VMACG [unit:dB]", -80, 80 ) ) )
)
);
};
process = (_,_) : \(m1,m2).(m1, m2, m1@(meterstoSamps(2.0432)), m2@(meterstoSamps(2.4132))) : Network(Voices); |
28a211c2dc2d9c55daa7f8f2a3d6608911851cfdd4f842f51a4ff450d7511869 | LucaSpanedda/RITI-Room-Is-The-Instrument | RITILorenz.dsp | // import faust standard library
import("stdfaust.lib");
// import audible ecosystemics objects library
import("ritilib.lib");
// Import lists: Frequencies, Amps, Bandwidth
import("Cello_D2.lib");
// INSTRUMENT SPECTRES --------------------------------------
// index of the lists
// FlistCH1(index) = ba.take(index, Cello1_D2_frequencies) * FREQUENCYf ;
// AlistCH1(index) = ba.take(index, Cello1_D2_amplitudes) * 1 ;
// QlistCH1(index) = ba.take(1, Cello1_D2_bandwidths) * BANDWIDTHf ;
// FlistCH1(index) = ba.take(index, Cello2_D2_frequencies) * FREQUENCYf ;
// AlistCH1(index) = ba.take(index, Cello2_D2_amplitudes) * 1 ;
// QlistCH1(index) = ba.take(1, Cello2_D2_bandwidths) * BANDWIDTHf ;
// FlistCH1(index) = ba.take(index, Cello3_D2_frequencies) * FREQUENCYf ;
// AlistCH1(index) = ba.take(index, Cello3_D2_amplitudes) * 1 ;
// QlistCH1(index) = ba.take(1, Cello3_D2_bandwidths) * BANDWIDTHf ;
// FlistCH1(index) = ba.take(index, Cello4_D2_frequencies) * FREQUENCYf ;
// AlistCH1(index) = ba.take(index, Cello4_D2_amplitudes) * 1 ;
// QlistCH1(index) = ba.take(1, Cello4_D2_bandwidths) * BANDWIDTHf ;
// sliders for control the system
TANHf = ( hslider("TANH", 1, 1, 100, .001) ) : si.smoo;
FBf = 2 ^ hslider("EQ FEEDBACK", 0, -1, 1, .001) : si.smoo;
DTf = ( hslider("DT", 0.62, 0, 10, .001)) : si.smoo;
SIGMAf = ( hslider("SIGMA", 8.2, 0, 100, .001)) : si.smoo;
RHOf = ( hslider("RHO", 0.010, 0, .1, .001)) : si.smoo;
BETAf = ( hslider("BETA", 0.10, 0, 1, .001)) : si.smoo;
BANDWIDTHf = 10 ^ hslider("BANDWIDTH", 0, -1, 1, .001) : si.smoo;
FREQUENCYf = 16 ^ hslider("FREQUENCY", 0, -1, 1, .001) : si.smoo;
//process = BANDWIDTHf;
// BP FILTER ----------------------------------------------
// optimized BP from the TPT version of the SVF Filter by Vadim Zavalishin
// reference : (by Will Pirkle)
// http://www.willpirkle.com/Downloads/AN-4VirtualAnalogFilters.2.0.pdf
BPSVF(glin, bw, cf, x) = loop ~ si.bus(2) : (! , ! , _)
with {
g = tan(cf * ma.PI * ma.T);
Q = cf / max(ma.EPSILON, bw);
R = 1.0 / (Q + Q);
G = 1.0 / (1.0 + 2.0 * R * g + g * g);
loop(s1, s2) = u1 , u2 , bp * glin
with {
bp = (g * (x - s2) + s1) * G;
bp2 = bp + bp;
v2 = bp2 * g;
u1 = bp2 - s1;
u2 = v2 + s2;
};
};
// Spectre BP Filter Banks
filterbank1(cascade, parallel, x) =
x <: par(i, parallel,
seq(r, cascade,
BPSVF( AlistCH1(i + 1), QlistCH1(i + 1), FlistCH1(i + 1) )
)
):> (+/parallel);
// Autoregulating Lorenz System
autolorenzL(in) =
( loop : (( si.bus(3) : par(i, 3, _ * FBf) ), si.bus(4)) ) ~ si.bus(7) :
par(i, 7, /(TANHf * 2)) : (si.bus(3) :> _ / 3 : normalization(1) ), si.bus(4)
with {
// saturator(lim,x) = lim*ma.tanh(x);
saturator(lim,x) = lim * ma.tanh(x/(max(lim,ma.EPSILON)));
dcblock(dcfc,x) = fi.highpass(1, dcfc, x);
loop(x, y, z, sigma, dt, rho, beta) =
filterbank1(1, 32, saturator(TANHf, dcblock(10,((x+in) + sigma * ((y+in) - (x+in)) * dt))) ),
filterbank1(1, 32, saturator(TANHf, dcblock(10,((y+in) + (rho * (x+in) - (x+in) * z - (y+in)) * dt ))) ),
filterbank1(1, 32, saturator(TANHf, dcblock(10,((z+in) + ((x+in) * (y+in) - beta * (z+in)) * dt ))) ),
(SIGMAf),
(DTf),
(RHOf),
(BETAf);
};
autolorenzR(in) =
( loop : (( si.bus(3) : par(i, 3, _ * FBf) ), si.bus(4)) ) ~ si.bus(7) :
par(i, 7, /(TANHf * 2)) : (si.bus(3) :> _ / 3 : normalization(1) ), si.bus(4)
with {
// saturator(lim,x) = lim * ma.tanh(x);
saturator(lim,x) = lim*ma.tanh(x/(max(lim,ma.EPSILON)));
dcblock(dcfc,x) = fi.highpass(1, dcfc, x);
loop(x, y, z, sigma, dt, rho, beta) =
filterbank1(1, 32, saturator(TANHf, dcblock(10,((x+in) + sigma * ((y+in) - (x+in)) * dt))) ),
filterbank1(1, 32, saturator(TANHf, dcblock(10,((y+in) + (rho * (x+in) - (x+in) * z - (y+in)) * dt ))) ),
filterbank1(1, 32, saturator(TANHf, dcblock(10,((z+in) + ((x+in) * (y+in) - beta * (z+in)) * dt ))) ),
(SIGMAf),
(DTf),
(RHOf),
(BETAf);
};
process =
( autolorenzL(0.12-0.12'),
autolorenzR(0.74-0.74') ) :
\(xyz1, sigma1, dt1, rho1, beta1, xyz2, sigma2, dt2, rho2, beta2).
(xyz1, xyz2, sigma1, dt1, rho1, beta1, sigma2, dt2, rho2, beta2);
| https://raw.githubusercontent.com/LucaSpanedda/RITI-Room-Is-The-Instrument/8c49f5b5ea699577e5c0b50a92b680b0173aaea9/Code_Drafts/RITILorenz.dsp | faust | import faust standard library
import audible ecosystemics objects library
Import lists: Frequencies, Amps, Bandwidth
INSTRUMENT SPECTRES --------------------------------------
index of the lists
FlistCH1(index) = ba.take(index, Cello1_D2_frequencies) * FREQUENCYf ;
AlistCH1(index) = ba.take(index, Cello1_D2_amplitudes) * 1 ;
QlistCH1(index) = ba.take(1, Cello1_D2_bandwidths) * BANDWIDTHf ;
FlistCH1(index) = ba.take(index, Cello2_D2_frequencies) * FREQUENCYf ;
AlistCH1(index) = ba.take(index, Cello2_D2_amplitudes) * 1 ;
QlistCH1(index) = ba.take(1, Cello2_D2_bandwidths) * BANDWIDTHf ;
FlistCH1(index) = ba.take(index, Cello3_D2_frequencies) * FREQUENCYf ;
AlistCH1(index) = ba.take(index, Cello3_D2_amplitudes) * 1 ;
QlistCH1(index) = ba.take(1, Cello3_D2_bandwidths) * BANDWIDTHf ;
FlistCH1(index) = ba.take(index, Cello4_D2_frequencies) * FREQUENCYf ;
AlistCH1(index) = ba.take(index, Cello4_D2_amplitudes) * 1 ;
QlistCH1(index) = ba.take(1, Cello4_D2_bandwidths) * BANDWIDTHf ;
sliders for control the system
process = BANDWIDTHf;
BP FILTER ----------------------------------------------
optimized BP from the TPT version of the SVF Filter by Vadim Zavalishin
reference : (by Will Pirkle)
http://www.willpirkle.com/Downloads/AN-4VirtualAnalogFilters.2.0.pdf
Spectre BP Filter Banks
Autoregulating Lorenz System
saturator(lim,x) = lim*ma.tanh(x);
saturator(lim,x) = lim * ma.tanh(x); | import("stdfaust.lib");
import("ritilib.lib");
import("Cello_D2.lib");
TANHf = ( hslider("TANH", 1, 1, 100, .001) ) : si.smoo;
FBf = 2 ^ hslider("EQ FEEDBACK", 0, -1, 1, .001) : si.smoo;
DTf = ( hslider("DT", 0.62, 0, 10, .001)) : si.smoo;
SIGMAf = ( hslider("SIGMA", 8.2, 0, 100, .001)) : si.smoo;
RHOf = ( hslider("RHO", 0.010, 0, .1, .001)) : si.smoo;
BETAf = ( hslider("BETA", 0.10, 0, 1, .001)) : si.smoo;
BANDWIDTHf = 10 ^ hslider("BANDWIDTH", 0, -1, 1, .001) : si.smoo;
FREQUENCYf = 16 ^ hslider("FREQUENCY", 0, -1, 1, .001) : si.smoo;
BPSVF(glin, bw, cf, x) = loop ~ si.bus(2) : (! , ! , _)
with {
g = tan(cf * ma.PI * ma.T);
Q = cf / max(ma.EPSILON, bw);
R = 1.0 / (Q + Q);
G = 1.0 / (1.0 + 2.0 * R * g + g * g);
loop(s1, s2) = u1 , u2 , bp * glin
with {
bp = (g * (x - s2) + s1) * G;
bp2 = bp + bp;
v2 = bp2 * g;
u1 = bp2 - s1;
u2 = v2 + s2;
};
};
filterbank1(cascade, parallel, x) =
x <: par(i, parallel,
seq(r, cascade,
BPSVF( AlistCH1(i + 1), QlistCH1(i + 1), FlistCH1(i + 1) )
)
):> (+/parallel);
autolorenzL(in) =
( loop : (( si.bus(3) : par(i, 3, _ * FBf) ), si.bus(4)) ) ~ si.bus(7) :
par(i, 7, /(TANHf * 2)) : (si.bus(3) :> _ / 3 : normalization(1) ), si.bus(4)
with {
saturator(lim,x) = lim * ma.tanh(x/(max(lim,ma.EPSILON)));
dcblock(dcfc,x) = fi.highpass(1, dcfc, x);
loop(x, y, z, sigma, dt, rho, beta) =
filterbank1(1, 32, saturator(TANHf, dcblock(10,((x+in) + sigma * ((y+in) - (x+in)) * dt))) ),
filterbank1(1, 32, saturator(TANHf, dcblock(10,((y+in) + (rho * (x+in) - (x+in) * z - (y+in)) * dt ))) ),
filterbank1(1, 32, saturator(TANHf, dcblock(10,((z+in) + ((x+in) * (y+in) - beta * (z+in)) * dt ))) ),
(SIGMAf),
(DTf),
(RHOf),
(BETAf);
};
autolorenzR(in) =
( loop : (( si.bus(3) : par(i, 3, _ * FBf) ), si.bus(4)) ) ~ si.bus(7) :
par(i, 7, /(TANHf * 2)) : (si.bus(3) :> _ / 3 : normalization(1) ), si.bus(4)
with {
saturator(lim,x) = lim*ma.tanh(x/(max(lim,ma.EPSILON)));
dcblock(dcfc,x) = fi.highpass(1, dcfc, x);
loop(x, y, z, sigma, dt, rho, beta) =
filterbank1(1, 32, saturator(TANHf, dcblock(10,((x+in) + sigma * ((y+in) - (x+in)) * dt))) ),
filterbank1(1, 32, saturator(TANHf, dcblock(10,((y+in) + (rho * (x+in) - (x+in) * z - (y+in)) * dt ))) ),
filterbank1(1, 32, saturator(TANHf, dcblock(10,((z+in) + ((x+in) * (y+in) - beta * (z+in)) * dt ))) ),
(SIGMAf),
(DTf),
(RHOf),
(BETAf);
};
process =
( autolorenzL(0.12-0.12'),
autolorenzR(0.74-0.74') ) :
\(xyz1, sigma1, dt1, rho1, beta1, xyz2, sigma2, dt2, rho2, beta2).
(xyz1, xyz2, sigma1, dt1, rho1, beta1, sigma2, dt2, rho2, beta2);
|
fa31628052de2c1a45f2d9eef86f6bb23e78344c4f1c3712584e6be1cd401888 | LucaSpanedda/Sound_reading_and_writing_techniques_in_Faust | GranularSampling_Audible_Ecosystemics_2.dsp | import("stdfaust.lib");
/*
Granular Sampling -
version with - Overlap Add To One - Granulator
for:
Agostino Di Scipio - AUDIBLE ECOSYSTEMICS
n.2a / Feedback Study (2003)
n.2b / Feedback Study, sound installation (2004).
*/
/*
Author NOTES in the Score.
page 5:
- granular sampling =
read sample sequences off subsequent buffer memory chunks,
and envelopes the signal chunk with a pseudo-Gaussian envelope curve; ù
the particular implementation should allow for time-stretching ù
(slower memory pointer increments at grain level),
as well as for "grain density" controls
and slight random deviations ("jitter") on grain parameters;
no frequency shift necessary
page 9:
- "grains" are short sequences of samples read off the memory
buffer, enveloped with a pseudo-gaussian function curve
- grain.dur.jitter is a random deviation of the current
grain.duration value: the current actual grain duration =
grain.duration + (rnd ⋅ grain.dur.jitter ⋅ grain.duration), with rnd
= random value in the interval [-1, 1]
- mem.pointer is the pointer to the next location in the memory
buffer; in the present notation, it varies between -1 (beginning
of buffer) and 1 (end of buffer)
mem.pointer.jitter is a random deviation of the current
mem.pointer value; any viable method can be used to
calculate the current actual value of mem.pointer
- density is the average number of sound grains active at any
time (1 = max, 0 = no grains)
*/
/*
var1 = distance (in meters) between the two farthest removed loudspeakers
on the left-right axis.
sample write (to mem buffer) looped recording, i.e.
overwriting samples every var1 seconds
*/
// Buffer Dimension in Seconds
var1 = 3;
// DEMO GUI
// timeIndex1 - Manual control - Buffer position for the read
GUItimeIndex1 = ((hslider("[2]mem.pointer", 0, -1, 1, .001)+1)/2) : si.smoo;
// graindurjitter
GUIgraindurjitter = ((hslider("[1]grain.dur.jitter", -1, -1, 1, .001)+1)/2) : si.smoo;
// Jitter Amount in the position for the reads
GUIjitter = (hslider("[3]mem.pointer.jitter", 0, 0, 100, .001)+1) : si.smoo;
// Fixed grain duration position (change = frequency shift)
GUIfixedGrainMS = hslider("[0]grain.duration", 80, 1, 1000, 1) : si.smoo;
// -------- GRANULAR SAMPLING --------
GranularSampling
(var1,timeIndex1,memWriteDel1,fixedGrainMS,fixedgraindurjitter,density,x) =
(x <: head1 + head2)
with{
// TO DO:
// grain.duration: 0.023 + ((1 - memWriteDel1) / 21) s
// density - adding multiple instances
// multiple noises with External SEED - change seed in par func.
// Receive AE Controls
grainduration = 1000/fixedGrainMS;
mempointer = timeIndex1;
mempointerjitter = (1-memWriteDel1)/100;
graindurjitter = fixedgraindurjitter*100;
// Sample and Hold Function
SAH2(trig,x) = loop~_
with{
loop(y) = (y,x : select2(trig));
};
// Phasor Function
Phasor(f) = Xn
letrec{
'Xn = (Xn+(f/ma.SR))-int(Xn);
};
// Waveshaping - Clipping (for drive the window func)
Clipping(w) = (w<1)*w+(w>1);
// tableMax = table Max Dimension
tableMax = 192000*var1;
// L = buffer dimension in seconds
L = ma.SR*var1;
// Write index - ramp 0 to L
wIdx = (+(1) : %(L)) ~ _ : int;
buffer(p, x) = it.frwtable(3, tableMax, .0, wIdx, x, p);
// Hanning window Equation
hann(x) = sin(ma.frac(x) * ma.PI) ^ 2.0;
// Position of the grain in the Buffer
timePhase = (mempointer*L) * ((1 - mempointerjitter) + no.noise * mempointerjitter);
// two Heads for the read
// 0°
ph1 = Phasor(grainduration);
// 180*
ph2 = ma.frac(.5 + ph1);
// Buffer positions = Position in the Buffer + Grain Read
pos1 = SAH2(ph1 < ph1', timePhase) + ph1*(ma.SR/grainduration);
pos2 = SAH2(ph2 < ph2', timePhase) + ph2*(ma.SR/grainduration);
// block graindur at new grain start
posgraindur1 = SAH2(ph1 < ph1', (no.noise*graindurjitter):abs);
posgraindur2 = SAH2(ph2 < ph2', (no.noise*graindurjitter):abs);
// Windows in Clipping (for drive the window func) + Buffer Reads
head1 = hann(ph1*(1+posgraindur1):Clipping) * buffer(pos1);
head2 = hann(ph2*(1+posgraindur2):Clipping) * buffer(pos2);
};
process = GranularSampling(var1,GUItimeIndex1,GUIjitter,GUIfixedGrainMS,GUIgraindurjitter,1)
<: _,_; | https://raw.githubusercontent.com/LucaSpanedda/Sound_reading_and_writing_techniques_in_Faust/bb01eff05a51424c16420a00b383441d8973d85e/0_work-in-progress/GranularSampling_Audible_Ecosystemics_2.dsp | faust |
Granular Sampling -
version with - Overlap Add To One - Granulator
for:
Agostino Di Scipio - AUDIBLE ECOSYSTEMICS
n.2a / Feedback Study (2003)
n.2b / Feedback Study, sound installation (2004).
Author NOTES in the Score.
page 5:
- granular sampling =
read sample sequences off subsequent buffer memory chunks,
and envelopes the signal chunk with a pseudo-Gaussian envelope curve; ù
the particular implementation should allow for time-stretching ù
(slower memory pointer increments at grain level),
as well as for "grain density" controls
and slight random deviations ("jitter") on grain parameters;
no frequency shift necessary
page 9:
- "grains" are short sequences of samples read off the memory
buffer, enveloped with a pseudo-gaussian function curve
- grain.dur.jitter is a random deviation of the current
grain.duration value: the current actual grain duration =
grain.duration + (rnd ⋅ grain.dur.jitter ⋅ grain.duration), with rnd
= random value in the interval [-1, 1]
- mem.pointer is the pointer to the next location in the memory
buffer; in the present notation, it varies between -1 (beginning
of buffer) and 1 (end of buffer)
mem.pointer.jitter is a random deviation of the current
mem.pointer value; any viable method can be used to
calculate the current actual value of mem.pointer
- density is the average number of sound grains active at any
time (1 = max, 0 = no grains)
var1 = distance (in meters) between the two farthest removed loudspeakers
on the left-right axis.
sample write (to mem buffer) looped recording, i.e.
overwriting samples every var1 seconds
Buffer Dimension in Seconds
DEMO GUI
timeIndex1 - Manual control - Buffer position for the read
graindurjitter
Jitter Amount in the position for the reads
Fixed grain duration position (change = frequency shift)
-------- GRANULAR SAMPLING --------
TO DO:
grain.duration: 0.023 + ((1 - memWriteDel1) / 21) s
density - adding multiple instances
multiple noises with External SEED - change seed in par func.
Receive AE Controls
Sample and Hold Function
Phasor Function
Waveshaping - Clipping (for drive the window func)
tableMax = table Max Dimension
L = buffer dimension in seconds
Write index - ramp 0 to L
Hanning window Equation
Position of the grain in the Buffer
two Heads for the read
0°
180*
Buffer positions = Position in the Buffer + Grain Read
block graindur at new grain start
Windows in Clipping (for drive the window func) + Buffer Reads | import("stdfaust.lib");
var1 = 3;
GUItimeIndex1 = ((hslider("[2]mem.pointer", 0, -1, 1, .001)+1)/2) : si.smoo;
GUIgraindurjitter = ((hslider("[1]grain.dur.jitter", -1, -1, 1, .001)+1)/2) : si.smoo;
GUIjitter = (hslider("[3]mem.pointer.jitter", 0, 0, 100, .001)+1) : si.smoo;
GUIfixedGrainMS = hslider("[0]grain.duration", 80, 1, 1000, 1) : si.smoo;
GranularSampling
(var1,timeIndex1,memWriteDel1,fixedGrainMS,fixedgraindurjitter,density,x) =
(x <: head1 + head2)
with{
grainduration = 1000/fixedGrainMS;
mempointer = timeIndex1;
mempointerjitter = (1-memWriteDel1)/100;
graindurjitter = fixedgraindurjitter*100;
SAH2(trig,x) = loop~_
with{
loop(y) = (y,x : select2(trig));
};
Phasor(f) = Xn
letrec{
'Xn = (Xn+(f/ma.SR))-int(Xn);
};
Clipping(w) = (w<1)*w+(w>1);
tableMax = 192000*var1;
L = ma.SR*var1;
wIdx = (+(1) : %(L)) ~ _ : int;
buffer(p, x) = it.frwtable(3, tableMax, .0, wIdx, x, p);
hann(x) = sin(ma.frac(x) * ma.PI) ^ 2.0;
timePhase = (mempointer*L) * ((1 - mempointerjitter) + no.noise * mempointerjitter);
ph1 = Phasor(grainduration);
ph2 = ma.frac(.5 + ph1);
pos1 = SAH2(ph1 < ph1', timePhase) + ph1*(ma.SR/grainduration);
pos2 = SAH2(ph2 < ph2', timePhase) + ph2*(ma.SR/grainduration);
posgraindur1 = SAH2(ph1 < ph1', (no.noise*graindurjitter):abs);
posgraindur2 = SAH2(ph2 < ph2', (no.noise*graindurjitter):abs);
head1 = hann(ph1*(1+posgraindur1):Clipping) * buffer(pos1);
head2 = hann(ph2*(1+posgraindur2):Clipping) * buffer(pos2);
};
process = GranularSampling(var1,GUItimeIndex1,GUIjitter,GUIfixedGrainMS,GUIgraindurjitter,1)
<: _,_; |
1978540f44709d7c62aa47c634af516ca5c7b4b8340b53e3af9f89521780fea3 | LucaSpanedda/Audible-Ecosystemics-2 | Spectral_Centroid_Mic_Test.dsp | // import faust standard library
import("stdfaust.lib");
SpectralCentroid = tgroup("Spectral Centroid Test",
par(i, 8, _ <:
vgroup("Mic %i[2]",
((HP3(nentry("Frequency", 1, 1, 20000, 1)) :
an.rms_envelope_rect(.5)) <:
attach(_, abs : ba.linear2db : hbargraph("HP",-80,20))),
((LP3(nentry("Frequency", 1, 1, 20000, 1)) :
an.rms_envelope_rect(.5)) <:
attach(_, abs : ba.linear2db : hbargraph("LP",-80,20)))
)
)
);
process = SpectralCentroid;
onePoleTPT(cf, x) = loop ~ _ : ! , si.bus(3)
with {
g = tan(cf * ma.PI * (1/ma.SR));
G = g / (1.0 + g);
loop(s) = u , lp , hp , ap
with {
v = (x - s) * G;
u = v + lp;
lp = v + s;
hp = x - lp;
ap = lp - hp;
};
};
SVFTPT(Q, cf, x) = loop ~ si.bus(2) : (! , ! , _ , _ , _ , _ , _)
with {
g = tan(cf * ma.PI * (1.0/ma.SR));
R = 1.0 / (2.0 * Q);
G1 = 1.0 / (1.0 + 2.0 * R * g + g * g);
G2 = 2.0 * R + g;
loop(s1, s2) = u1 , u2 , lp , hp , bp , bp * 2.0 * R , x - bp * 4.0 * R
with {
hp = (x - s1 * G2 - s2) * G1;
v1 = hp * g;
bp = s1 + v1;
v2 = bp * g;
lp = s2 + v2;
u1 = v1 + bp;
u2 = v2 + lp;
};
};
SVFTPT2(K, Q, CF, x) = circuitout : ! , ! , _ , _ , _ , _ , _ , _ , _ , _
with{
g = tan(CF * ma.PI / ma.SR);
R = 1.0 / (2.0 * Q);
G1 = 1.0 / (1.0 + 2.0 * R * g + g * g);
G2 = 2.0 * R + g;
circuit(s1, s2) = u1 , u2 , lp , hp , bp, notch, apf, ubp, peak, bshelf
with{
hp = (x - s1 * G2 - s2) * G1;
v1 = hp * g;
bp = s1 + v1;
v2 = bp * g;
lp = s2 + v2;
u1 = v1 + bp;
u2 = v2 + lp;
notch = x - ((2*R)*bp);
apf = x - ((4*R)*bp);
ubp = ((2*R)*bp);
peak = lp -hp;
bshelf = x + (((2*K)*R)*bp);
};
// choose the output from the SVF Filter (ex. bshelf)
circuitout = circuit ~ si.bus(2);
};
LPTPT(CF, x) = onePoleTPT(max(ma.EPSILON, min(20480, CF)), x) : (_ , ! , !);
HPTPT(CF, x) = onePoleTPT(max(ma.EPSILON, min(20480, CF)), x) : (! , _ , !);
LPSVF(Q, CF, x) = SVFTPT2(0, Q, max(ma.EPSILON, min(20480, CF)), x) : _ , ! , ! , ! , ! , ! , ! , ! ;
HPSVF(Q, CF, x) = SVFTPT2(0, Q, max(ma.EPSILON, min(20480, CF)), x) : ! , _ , ! , ! , ! , ! , ! , !;
BPsvftpt(bw, cf, x) = Q , CF , x : SVFTPT : (! , ! , ! , _ , !)
with {
CF = max(20, min(20480, LPTPT(1, cf)));
BW = max(1, min(20480, LPTPT(1, bw)));
Q = max(.01, min(100, BW / CF));
};
// Butterworth
butterworthQ(order, stage) = qFactor(order % 2)
with {
qFactor(0) = 1.0 / (2.0 * cos(((2.0 * stage + 1) *
(ma.PI / (order * 2.0)))));
qFactor(1) = 1.0 / (2.0 * cos(((stage + 1) * (ma.PI / order))));
};
LPButterworthN(1, cf, x) = LPTPT(cf, x);
LPButterworthN(N, cf, x) = cascade(N % 2)
with {
cascade(0) = x : seq(i, N / 2, LPSVF(butterworthQ(N, i), cf));
cascade(1) = x : LPTPT(cf) : seq(i, (N - 1) / 2,
LPSVF(butterworthQ(N, i), cf));
};
HPButterworthN(1, cf, x) = HPTPT(cf, x);
HPButterworthN(N, cf, x) = cascade(N % 2)
with {
cascade(0) = x : seq(i, N / 2, HPSVF(butterworthQ(N, i), cf));
cascade(1) = x : HPTPT(cf) : seq(i, (N - 1) /
2, HPSVF(butterworthQ(N, i), cf));
};
// Filters Order Butterworth
LP1(CF, x) = x : LPButterworthN(1, CF);
HP1(CF, x) = x : HPButterworthN(1, CF);
LP2(CF, x) = x : LPButterworthN(2, CF);
HP2(CF, x) = x : HPButterworthN(2, CF);
LP3(CF, x) = x : LPButterworthN(3, CF);
HP3(CF, x) = x : HPButterworthN(3, CF);
LP4(CF, x) = x : LPButterworthN(4, CF);
HP4(CF, x) = x : HPButterworthN(4, CF);
LP5(CF, x) = x : LPButterworthN(5, CF);
HP5(CF, x) = x : HPButterworthN(5, CF);
// Filters Order in series
// LP1(CF, x) = x : LPTPT(CF);
// HP1(CF, x) = x : HPTPT(CF);
// LP2(CF, x) = x : LPTPT(CF) : LPTPT(CF);
// HP2(CF, x) = x : HPTPT(CF) : HPTPT(CF);
// LP3(CF, x) = x : LPTPT(CF) : LPTPT(CF) : LPTPT(CF);
// HP3(CF, x) = x : HPTPT(CF) : HPTPT(CF) : HPTPT(CF);
// LP4(CF, x) = x : LPTPT(CF) : LPTPT(CF) : LPTPT(CF) : LPTPT(CF);
// HP4(CF, x) = x : HPTPT(CF) : HPTPT(CF) : HPTPT(CF) : HPTPT(CF);
// LP5(CF, x) = x : LPTPT(CF) : LPTPT(CF) : LPTPT(CF) : LPTPT(CF) : LPTPT(CF);
// HP5(CF, x) = x : HPTPT(CF) : HPTPT(CF) : HPTPT(CF) : HPTPT(CF) : HPTPT(CF); | https://raw.githubusercontent.com/LucaSpanedda/Audible-Ecosystemics-2/c4be0f10b765b5466fe87fbe42afaab5cfd37793/Electroacoustic_chain_environmental_tests/Spectral_Centroid_Mic_Test.dsp | faust | import faust standard library
choose the output from the SVF Filter (ex. bshelf)
Butterworth
Filters Order Butterworth
Filters Order in series
LP1(CF, x) = x : LPTPT(CF);
HP1(CF, x) = x : HPTPT(CF);
LP2(CF, x) = x : LPTPT(CF) : LPTPT(CF);
HP2(CF, x) = x : HPTPT(CF) : HPTPT(CF);
LP3(CF, x) = x : LPTPT(CF) : LPTPT(CF) : LPTPT(CF);
HP3(CF, x) = x : HPTPT(CF) : HPTPT(CF) : HPTPT(CF);
LP4(CF, x) = x : LPTPT(CF) : LPTPT(CF) : LPTPT(CF) : LPTPT(CF);
HP4(CF, x) = x : HPTPT(CF) : HPTPT(CF) : HPTPT(CF) : HPTPT(CF);
LP5(CF, x) = x : LPTPT(CF) : LPTPT(CF) : LPTPT(CF) : LPTPT(CF) : LPTPT(CF);
HP5(CF, x) = x : HPTPT(CF) : HPTPT(CF) : HPTPT(CF) : HPTPT(CF) : HPTPT(CF); | import("stdfaust.lib");
SpectralCentroid = tgroup("Spectral Centroid Test",
par(i, 8, _ <:
vgroup("Mic %i[2]",
((HP3(nentry("Frequency", 1, 1, 20000, 1)) :
an.rms_envelope_rect(.5)) <:
attach(_, abs : ba.linear2db : hbargraph("HP",-80,20))),
((LP3(nentry("Frequency", 1, 1, 20000, 1)) :
an.rms_envelope_rect(.5)) <:
attach(_, abs : ba.linear2db : hbargraph("LP",-80,20)))
)
)
);
process = SpectralCentroid;
onePoleTPT(cf, x) = loop ~ _ : ! , si.bus(3)
with {
g = tan(cf * ma.PI * (1/ma.SR));
G = g / (1.0 + g);
loop(s) = u , lp , hp , ap
with {
v = (x - s) * G;
u = v + lp;
lp = v + s;
hp = x - lp;
ap = lp - hp;
};
};
SVFTPT(Q, cf, x) = loop ~ si.bus(2) : (! , ! , _ , _ , _ , _ , _)
with {
g = tan(cf * ma.PI * (1.0/ma.SR));
R = 1.0 / (2.0 * Q);
G1 = 1.0 / (1.0 + 2.0 * R * g + g * g);
G2 = 2.0 * R + g;
loop(s1, s2) = u1 , u2 , lp , hp , bp , bp * 2.0 * R , x - bp * 4.0 * R
with {
hp = (x - s1 * G2 - s2) * G1;
v1 = hp * g;
bp = s1 + v1;
v2 = bp * g;
lp = s2 + v2;
u1 = v1 + bp;
u2 = v2 + lp;
};
};
SVFTPT2(K, Q, CF, x) = circuitout : ! , ! , _ , _ , _ , _ , _ , _ , _ , _
with{
g = tan(CF * ma.PI / ma.SR);
R = 1.0 / (2.0 * Q);
G1 = 1.0 / (1.0 + 2.0 * R * g + g * g);
G2 = 2.0 * R + g;
circuit(s1, s2) = u1 , u2 , lp , hp , bp, notch, apf, ubp, peak, bshelf
with{
hp = (x - s1 * G2 - s2) * G1;
v1 = hp * g;
bp = s1 + v1;
v2 = bp * g;
lp = s2 + v2;
u1 = v1 + bp;
u2 = v2 + lp;
notch = x - ((2*R)*bp);
apf = x - ((4*R)*bp);
ubp = ((2*R)*bp);
peak = lp -hp;
bshelf = x + (((2*K)*R)*bp);
};
circuitout = circuit ~ si.bus(2);
};
LPTPT(CF, x) = onePoleTPT(max(ma.EPSILON, min(20480, CF)), x) : (_ , ! , !);
HPTPT(CF, x) = onePoleTPT(max(ma.EPSILON, min(20480, CF)), x) : (! , _ , !);
LPSVF(Q, CF, x) = SVFTPT2(0, Q, max(ma.EPSILON, min(20480, CF)), x) : _ , ! , ! , ! , ! , ! , ! , ! ;
HPSVF(Q, CF, x) = SVFTPT2(0, Q, max(ma.EPSILON, min(20480, CF)), x) : ! , _ , ! , ! , ! , ! , ! , !;
BPsvftpt(bw, cf, x) = Q , CF , x : SVFTPT : (! , ! , ! , _ , !)
with {
CF = max(20, min(20480, LPTPT(1, cf)));
BW = max(1, min(20480, LPTPT(1, bw)));
Q = max(.01, min(100, BW / CF));
};
butterworthQ(order, stage) = qFactor(order % 2)
with {
qFactor(0) = 1.0 / (2.0 * cos(((2.0 * stage + 1) *
(ma.PI / (order * 2.0)))));
qFactor(1) = 1.0 / (2.0 * cos(((stage + 1) * (ma.PI / order))));
};
LPButterworthN(1, cf, x) = LPTPT(cf, x);
LPButterworthN(N, cf, x) = cascade(N % 2)
with {
cascade(0) = x : seq(i, N / 2, LPSVF(butterworthQ(N, i), cf));
cascade(1) = x : LPTPT(cf) : seq(i, (N - 1) / 2,
LPSVF(butterworthQ(N, i), cf));
};
HPButterworthN(1, cf, x) = HPTPT(cf, x);
HPButterworthN(N, cf, x) = cascade(N % 2)
with {
cascade(0) = x : seq(i, N / 2, HPSVF(butterworthQ(N, i), cf));
cascade(1) = x : HPTPT(cf) : seq(i, (N - 1) /
2, HPSVF(butterworthQ(N, i), cf));
};
LP1(CF, x) = x : LPButterworthN(1, CF);
HP1(CF, x) = x : HPButterworthN(1, CF);
LP2(CF, x) = x : LPButterworthN(2, CF);
HP2(CF, x) = x : HPButterworthN(2, CF);
LP3(CF, x) = x : LPButterworthN(3, CF);
HP3(CF, x) = x : HPButterworthN(3, CF);
LP4(CF, x) = x : LPButterworthN(4, CF);
HP4(CF, x) = x : HPButterworthN(4, CF);
LP5(CF, x) = x : LPButterworthN(5, CF);
HP5(CF, x) = x : HPButterworthN(5, CF);
|
adc9010303f1ae3baee626e2db1df8e94e7eaea8eadc2a7391f8744faf24cf83 | LucaSpanedda/Luca_Spanedda_St_Cecilia_Conservatory_Thesis | soloLAR_Audible_Ecosystemics_2.dsp | // import faust standard library
import("stdfaust.lib");
LARmechanismAE2(mic1, mic2) = sig1, sig2
with{
Mic_1B_1 = hgroup("Mixer", hgroup("Signal Flow 1B",
gainMic_1B_1(mic1)));
Mic_1B_2 = hgroup("Mixer", hgroup("Signal Flow 1B",
gainMic_1B_2(mic2)));
// cntrlMic - original version
cntrlMic(x) = x : HP1(50) : LP1(6000) :
integrator(.01) : delayfb(.01, .995) : LP5(.5);
cntrlMic1 = Mic_1B_1 : cntrlMic;
cntrlMic2 = Mic_1B_2 : cntrlMic;
// from Signal Flow 2a
Mic_2A_1 = hgroup("Mixer", hgroup("Signal Flow 2A",
gainMic_2A_1(mic1)));
Mic_2A_2 = hgroup("Mixer", hgroup("Signal Flow 2A",
gainMic_2A_2(mic2)));
micIN1 = Mic_2A_1 : HP1(50) : LP1(6000) *
(1 - cntrlMic1);
micIN2 = Mic_2A_2 : HP1(50) : LP1(6000) *
(1 - cntrlMic2);
// in the full system this this is a secondary counterbalance
directLevel = 1;
sig1 = micIN1 * directLevel;
sig2 = micIN2 * directLevel;
};
process = LARmechanismAE2;
//------- ------------- ----- -----------
//-- LIBRARY ----------------------------------------------------------
//------- --------
// selected objects from "aelibrary.lib"
//-------------------------------------------------------- UTILITIES --
// limit function for library and system
limit(maxl,minl,x) = x : max(minl, min(maxl));
//---------------------------------------------------------- FILTERS --
onePoleTPT(cf, x) = loop ~ _ : ! , si.bus(3)
with {
g = tan(cf * ma.PI * (1/ma.SR));
G = g / (1.0 + g);
loop(s) = u , lp , hp , ap
with {
v = (x - s) * G;
u = v + lp;
lp = v + s;
hp = x - lp;
ap = lp - hp;
};
};
LPTPT(cf, x) = onePoleTPT(limit(20000,ma.EPSILON,cf), x) : (_, !, !);
HPTPT(cf, x) = onePoleTPT(limit(20000,ma.EPSILON,cf), x) : (!, _, !);
// Order with filters in series
LP1(CF, x) = x :LPTPT(CF);
HP1(CF, x) = x :HPTPT(CF);
LP2(CF, x) = x :LPTPT(CF) :LPTPT(CF);
HP2(CF, x) = x :HPTPT(CF) :HPTPT(CF);
LP3(CF, x) = x :LPTPT(CF) :LPTPT(CF) :LPTPT(CF);
HP3(CF, x) = x :HPTPT(CF) :HPTPT(CF) :HPTPT(CF);
LP4(CF, x) = x :LPTPT(CF) :LPTPT(CF) :LPTPT(CF) :LPTPT(CF);
HP4(CF, x) = x :HPTPT(CF) :HPTPT(CF) :HPTPT(CF) :HPTPT(CF);
LP5(CF, x) = x :LPTPT(CF) :LPTPT(CF) :LPTPT(CF) :LPTPT(CF) :LPTPT(CF);
HP5(CF, x) = x :HPTPT(CF) :HPTPT(CF) :HPTPT(CF) :HPTPT(CF) :HPTPT(CF);
//------------------------------------------------------- INTEGRATOR --
integrator(sec, x) = an.abs_envelope_tau(limit(1000,.001, sec), x);
//----------------------------------------------------------- DELAYS --
delayfb(delSec,fb,x) = loop ~ _ : mem
with{
loop(z) = ( (z * fb + x) @(ba.sec2samp(delSec)-1) );
};
//--------------------------------------------- INPUTS/OUTPUTS MIXER --
gainMic_1B_1(x) = x *
si.smoo( ba.db2linear(
vslider("SF_1B_1 [unit:db]", 0, -80, 80, .001) ) ) <:
attach(_, VHmetersEnvelope(_) :
vbargraph("VM1B1 [unit:dB]", -80, 80));
gainMic_1B_2(x) = x *
si.smoo( ba.db2linear(
vslider("SF_1B_2 [unit:db]", 0, -80, 80, .001) ) ) <:
attach(_, VHmetersEnvelope(_) :
vbargraph("VM1B2 [unit:dB]", -80, 80));
gainMic_2A_1(x) = x *
si.smoo( ba.db2linear(
vslider("SF_2A_1 [unit:db]", 0, -80, 80, .001) ) ) <:
attach(_, VHmetersEnvelope(_) :
vbargraph("VM2A1 [unit:dB]", -80, 80));
gainMic_2A_2(x) = x *
si.smoo( ba.db2linear(
vslider("SF_2A_2 [unit:db]", 0, -80, 80, .001) ) ) <:
attach(_, VHmetersEnvelope(_) :
vbargraph("VM2A2 [unit:dB]", -80, 80));
VHmetersEnvelope = abs : max ~ -(1.0/ma.SR) :
max(ba.db2linear(-70)) : ba.linear2db; | https://raw.githubusercontent.com/LucaSpanedda/Luca_Spanedda_St_Cecilia_Conservatory_Thesis/b73b60d9e0b45e09bbf72b1477c21202b895f1bb/ITA/codes/soloLAR_Audible_Ecosystemics_2.dsp | faust | import faust standard library
cntrlMic - original version
from Signal Flow 2a
in the full system this this is a secondary counterbalance
------- ------------- ----- -----------
-- LIBRARY ----------------------------------------------------------
------- --------
selected objects from "aelibrary.lib"
-------------------------------------------------------- UTILITIES --
limit function for library and system
---------------------------------------------------------- FILTERS --
Order with filters in series
------------------------------------------------------- INTEGRATOR --
----------------------------------------------------------- DELAYS --
--------------------------------------------- INPUTS/OUTPUTS MIXER -- | import("stdfaust.lib");
LARmechanismAE2(mic1, mic2) = sig1, sig2
with{
Mic_1B_1 = hgroup("Mixer", hgroup("Signal Flow 1B",
gainMic_1B_1(mic1)));
Mic_1B_2 = hgroup("Mixer", hgroup("Signal Flow 1B",
gainMic_1B_2(mic2)));
cntrlMic(x) = x : HP1(50) : LP1(6000) :
integrator(.01) : delayfb(.01, .995) : LP5(.5);
cntrlMic1 = Mic_1B_1 : cntrlMic;
cntrlMic2 = Mic_1B_2 : cntrlMic;
Mic_2A_1 = hgroup("Mixer", hgroup("Signal Flow 2A",
gainMic_2A_1(mic1)));
Mic_2A_2 = hgroup("Mixer", hgroup("Signal Flow 2A",
gainMic_2A_2(mic2)));
micIN1 = Mic_2A_1 : HP1(50) : LP1(6000) *
(1 - cntrlMic1);
micIN2 = Mic_2A_2 : HP1(50) : LP1(6000) *
(1 - cntrlMic2);
directLevel = 1;
sig1 = micIN1 * directLevel;
sig2 = micIN2 * directLevel;
};
process = LARmechanismAE2;
limit(maxl,minl,x) = x : max(minl, min(maxl));
onePoleTPT(cf, x) = loop ~ _ : ! , si.bus(3)
with {
g = tan(cf * ma.PI * (1/ma.SR));
G = g / (1.0 + g);
loop(s) = u , lp , hp , ap
with {
v = (x - s) * G;
u = v + lp;
lp = v + s;
hp = x - lp;
ap = lp - hp;
};
};
LPTPT(cf, x) = onePoleTPT(limit(20000,ma.EPSILON,cf), x) : (_, !, !);
HPTPT(cf, x) = onePoleTPT(limit(20000,ma.EPSILON,cf), x) : (!, _, !);
LP1(CF, x) = x :LPTPT(CF);
HP1(CF, x) = x :HPTPT(CF);
LP2(CF, x) = x :LPTPT(CF) :LPTPT(CF);
HP2(CF, x) = x :HPTPT(CF) :HPTPT(CF);
LP3(CF, x) = x :LPTPT(CF) :LPTPT(CF) :LPTPT(CF);
HP3(CF, x) = x :HPTPT(CF) :HPTPT(CF) :HPTPT(CF);
LP4(CF, x) = x :LPTPT(CF) :LPTPT(CF) :LPTPT(CF) :LPTPT(CF);
HP4(CF, x) = x :HPTPT(CF) :HPTPT(CF) :HPTPT(CF) :HPTPT(CF);
LP5(CF, x) = x :LPTPT(CF) :LPTPT(CF) :LPTPT(CF) :LPTPT(CF) :LPTPT(CF);
HP5(CF, x) = x :HPTPT(CF) :HPTPT(CF) :HPTPT(CF) :HPTPT(CF) :HPTPT(CF);
integrator(sec, x) = an.abs_envelope_tau(limit(1000,.001, sec), x);
delayfb(delSec,fb,x) = loop ~ _ : mem
with{
loop(z) = ( (z * fb + x) @(ba.sec2samp(delSec)-1) );
};
gainMic_1B_1(x) = x *
si.smoo( ba.db2linear(
vslider("SF_1B_1 [unit:db]", 0, -80, 80, .001) ) ) <:
attach(_, VHmetersEnvelope(_) :
vbargraph("VM1B1 [unit:dB]", -80, 80));
gainMic_1B_2(x) = x *
si.smoo( ba.db2linear(
vslider("SF_1B_2 [unit:db]", 0, -80, 80, .001) ) ) <:
attach(_, VHmetersEnvelope(_) :
vbargraph("VM1B2 [unit:dB]", -80, 80));
gainMic_2A_1(x) = x *
si.smoo( ba.db2linear(
vslider("SF_2A_1 [unit:db]", 0, -80, 80, .001) ) ) <:
attach(_, VHmetersEnvelope(_) :
vbargraph("VM2A1 [unit:dB]", -80, 80));
gainMic_2A_2(x) = x *
si.smoo( ba.db2linear(
vslider("SF_2A_2 [unit:db]", 0, -80, 80, .001) ) ) <:
attach(_, VHmetersEnvelope(_) :
vbargraph("VM2A2 [unit:dB]", -80, 80));
VHmetersEnvelope = abs : max ~ -(1.0/ma.SR) :
max(ba.db2linear(-70)) : ba.linear2db; |
e5b5b9ad1455eb02d7d45308ccae3b5481ba07d86ab216f9650aa41c89ad6676 | LucaSpanedda/RITI-Room-Is-The-Instrument | RITIinterpolatedLorenz.dsp | // import faust standard library
import("stdfaust.lib");
// import audible ecosystemics objects library
import("ritilib.lib");
// Import lists: Frequencies, Amps, Bandwidth
import("Cello_D2.lib");
// INSTRUMENT SPECTRES --------------------------------------
// index of the lists
FlistCH1(index) = ba.take(index, Cello1_D2_frequencies) * FREQUENCYf ;
AlistCH1(index) = ba.take(index, Cello1_D2_amplitudes) * 1 ;
QlistCH1(index) = ba.take(1, Cello1_D2_bandwidths) * BANDWIDTHf ;
FlistCH2(index) = ba.take(index, Cello2_D2_frequencies) * FREQUENCYf ;
AlistCH2(index) = ba.take(index, Cello2_D2_amplitudes) * 1 ;
QlistCH2(index) = ba.take(1, Cello2_D2_bandwidths) * BANDWIDTHf ;
FlistCH3(index) = ba.take(index, Cello3_D2_frequencies) * FREQUENCYf ;
AlistCH3(index) = ba.take(index, Cello3_D2_amplitudes) * 1 ;
QlistCH3(index) = ba.take(1, Cello3_D2_bandwidths) * BANDWIDTHf ;
FlistCH4(index) = ba.take(index, Cello4_D2_frequencies) * FREQUENCYf ;
AlistCH4(index) = ba.take(index, Cello4_D2_amplitudes) * 1 ;
QlistCH4(index) = ba.take(1, Cello4_D2_bandwidths) * BANDWIDTHf ;
Flistinterpolate(index) = bilinInterpolate(
FlistCH1(index), FlistCH2(index), FlistCH3(index), FlistCH4(index),
DT1, DT2);
Alistinterpolate(index) = bilinInterpolate(
AlistCH1(index), AlistCH2(index), AlistCH3(index), AlistCH4(index),
DT1, DT2);
Qlistinterpolate(index) = bilinInterpolate(
QlistCH1(index), QlistCH2(index), QlistCH3(index), QlistCH4(index),
DT1, DT2);
// sliders for control the system
DT1 = hslider("DT1", 0, 0, 1, .001) : si.smoo;
DT2 = hslider("DT2", 0, 0, 1, .001) : si.smoo;
TANHf = ( hslider("TANH", 1, 1, 100, .001) ) : si.smoo;
FBf = hslider("EQ FEEDBACK", 1, 1, 10, .001) : si.smoo;
DTf = ( hslider("DT", 0.62, 0, 1, .001)) : si.smoo;
SIGMAf = ( hslider("SIGMA", 8.2, 0, 100, .001)) : si.smoo;
RHOf = ( hslider("RHO", 0.010, 0, .1, .001)) : si.smoo;
BETAf = ( hslider("BETA", 0.10, 0, 10, .001)) : si.smoo;
BANDWIDTHf = 10 ^ hslider("BANDWIDTH", 0, -1, 1, .001) : si.smoo;
FREQUENCYf = 16 ^ hslider("FREQUENCY", 0, -1, 1, .001) : si.smoo;
DIRECTEQUATIONSf = ( hslider("DIRECTEQUATIONS", 0, 0, 1, .001)) : si.smoo;
FILTEREDf = 1 - DIRECTEQUATIONSf;
//process = BANDWIDTHf;
// BP FILTER ----------------------------------------------
// optimized BP from the TPT version of the SVF Filter by Vadim Zavalishin
// reference : (by Will Pirkle)
// http://www.willpirkle.com/Downloads/AN-4VirtualAnalogFilters.2.0.pdf
BPSVF(glin, bw, cf, x) = loop ~ si.bus(2) : (! , ! , _)
with {
g = tan(cf * ma.PI * ma.T);
Q = cf / max(ma.EPSILON, bw);
R = 1.0 / (Q + Q);
G = 1.0 / (1.0 + 2.0 * R * g + g * g);
loop(s1, s2) = u1 , u2 , bp * glin
with {
bp = (g * (x - s2) + s1) * G;
bp2 = bp + bp;
v2 = bp2 * g;
u1 = bp2 - s1;
u2 = v2 + s2;
};
};
// Spectre BP Filter Banks
filterbank1(cascade, parallel, x) =
x <: par(i, parallel,
seq(r, cascade,
BPSVF( Alistinterpolate(i + 1) ,
Qlistinterpolate(i + 1) ,
Flistinterpolate(i + 1)
)
)
):> (+/parallel) * FILTEREDf + x * DIRECTEQUATIONSf;
// Autoregulating Lorenz System
autolorenzL(in) =
( loop : (( si.bus(3) : par(i, 3, _ * FBf) ), si.bus(4)) ) ~ si.bus(7) :
par(i, 7, /(TANHf * 2)) : (si.bus(3) :> _ / 3 : normalization(1) ), si.bus(4)
with {
// saturator(lim,x) = lim*ma.tanh(x);
saturator(lim,x) = lim * ma.tanh(x/(max(lim,ma.EPSILON)));
dcblock(dcfc,x) = fi.highpass(1, dcfc, x);
loop(x, y, z, sigma, dt, rho, beta) =
filterbank1(1, 32, saturator(TANHf, dcblock(10,((x+in) + sigma * ((y+in) - (x+in)) * dt))) ),
filterbank1(1, 32, saturator(TANHf, dcblock(10,((y+in) + (rho * (x+in) - (x+in) * z - (y+in)) * dt ))) ),
filterbank1(1, 32, saturator(TANHf, dcblock(10,((z+in) + ((x+in) * (y+in) - beta * (z+in)) * dt ))) ),
(SIGMAf),
(DTf),
(RHOf),
(BETAf);
};
autolorenzR(in) =
( loop : (( si.bus(3) : par(i, 3, _ * FBf) ), si.bus(4)) ) ~ si.bus(7) :
par(i, 7, /(TANHf * 2)) : (si.bus(3) :> _ / 3 : normalization(1) ), si.bus(4)
with {
// saturator(lim,x) = lim * ma.tanh(x);
saturator(lim,x) = lim*ma.tanh(x/(max(lim,ma.EPSILON)));
dcblock(dcfc,x) = fi.highpass(1, dcfc, x);
loop(x, y, z, sigma, dt, rho, beta) =
filterbank1(1, 32, saturator(TANHf, dcblock(10,((x+in) + sigma * ((y+in) - (x+in)) * dt))) ),
filterbank1(1, 32, saturator(TANHf, dcblock(10,((y+in) + (rho * (x+in) - (x+in) * z - (y+in)) * dt ))) ),
filterbank1(1, 32, saturator(TANHf, dcblock(10,((z+in) + ((x+in) * (y+in) - beta * (z+in)) * dt ))) ),
(SIGMAf),
(DTf),
(RHOf),
(BETAf);
};
process =
( autolorenzL(0.12-0.12'),
autolorenzR(0.74-0.74') ) :
\(xyz1, sigma1, dt1, rho1, beta1, xyz2, sigma2, dt2, rho2, beta2).
(xyz1, xyz2, sigma1, dt1, rho1, beta1, sigma2, dt2, rho2, beta2);
| https://raw.githubusercontent.com/LucaSpanedda/RITI-Room-Is-The-Instrument/8c49f5b5ea699577e5c0b50a92b680b0173aaea9/Code_Drafts/RITIinterpolatedLorenz.dsp | faust | import faust standard library
import audible ecosystemics objects library
Import lists: Frequencies, Amps, Bandwidth
INSTRUMENT SPECTRES --------------------------------------
index of the lists
sliders for control the system
process = BANDWIDTHf;
BP FILTER ----------------------------------------------
optimized BP from the TPT version of the SVF Filter by Vadim Zavalishin
reference : (by Will Pirkle)
http://www.willpirkle.com/Downloads/AN-4VirtualAnalogFilters.2.0.pdf
Spectre BP Filter Banks
Autoregulating Lorenz System
saturator(lim,x) = lim*ma.tanh(x);
saturator(lim,x) = lim * ma.tanh(x); | import("stdfaust.lib");
import("ritilib.lib");
import("Cello_D2.lib");
FlistCH1(index) = ba.take(index, Cello1_D2_frequencies) * FREQUENCYf ;
AlistCH1(index) = ba.take(index, Cello1_D2_amplitudes) * 1 ;
QlistCH1(index) = ba.take(1, Cello1_D2_bandwidths) * BANDWIDTHf ;
FlistCH2(index) = ba.take(index, Cello2_D2_frequencies) * FREQUENCYf ;
AlistCH2(index) = ba.take(index, Cello2_D2_amplitudes) * 1 ;
QlistCH2(index) = ba.take(1, Cello2_D2_bandwidths) * BANDWIDTHf ;
FlistCH3(index) = ba.take(index, Cello3_D2_frequencies) * FREQUENCYf ;
AlistCH3(index) = ba.take(index, Cello3_D2_amplitudes) * 1 ;
QlistCH3(index) = ba.take(1, Cello3_D2_bandwidths) * BANDWIDTHf ;
FlistCH4(index) = ba.take(index, Cello4_D2_frequencies) * FREQUENCYf ;
AlistCH4(index) = ba.take(index, Cello4_D2_amplitudes) * 1 ;
QlistCH4(index) = ba.take(1, Cello4_D2_bandwidths) * BANDWIDTHf ;
Flistinterpolate(index) = bilinInterpolate(
FlistCH1(index), FlistCH2(index), FlistCH3(index), FlistCH4(index),
DT1, DT2);
Alistinterpolate(index) = bilinInterpolate(
AlistCH1(index), AlistCH2(index), AlistCH3(index), AlistCH4(index),
DT1, DT2);
Qlistinterpolate(index) = bilinInterpolate(
QlistCH1(index), QlistCH2(index), QlistCH3(index), QlistCH4(index),
DT1, DT2);
DT1 = hslider("DT1", 0, 0, 1, .001) : si.smoo;
DT2 = hslider("DT2", 0, 0, 1, .001) : si.smoo;
TANHf = ( hslider("TANH", 1, 1, 100, .001) ) : si.smoo;
FBf = hslider("EQ FEEDBACK", 1, 1, 10, .001) : si.smoo;
DTf = ( hslider("DT", 0.62, 0, 1, .001)) : si.smoo;
SIGMAf = ( hslider("SIGMA", 8.2, 0, 100, .001)) : si.smoo;
RHOf = ( hslider("RHO", 0.010, 0, .1, .001)) : si.smoo;
BETAf = ( hslider("BETA", 0.10, 0, 10, .001)) : si.smoo;
BANDWIDTHf = 10 ^ hslider("BANDWIDTH", 0, -1, 1, .001) : si.smoo;
FREQUENCYf = 16 ^ hslider("FREQUENCY", 0, -1, 1, .001) : si.smoo;
DIRECTEQUATIONSf = ( hslider("DIRECTEQUATIONS", 0, 0, 1, .001)) : si.smoo;
FILTEREDf = 1 - DIRECTEQUATIONSf;
BPSVF(glin, bw, cf, x) = loop ~ si.bus(2) : (! , ! , _)
with {
g = tan(cf * ma.PI * ma.T);
Q = cf / max(ma.EPSILON, bw);
R = 1.0 / (Q + Q);
G = 1.0 / (1.0 + 2.0 * R * g + g * g);
loop(s1, s2) = u1 , u2 , bp * glin
with {
bp = (g * (x - s2) + s1) * G;
bp2 = bp + bp;
v2 = bp2 * g;
u1 = bp2 - s1;
u2 = v2 + s2;
};
};
filterbank1(cascade, parallel, x) =
x <: par(i, parallel,
seq(r, cascade,
BPSVF( Alistinterpolate(i + 1) ,
Qlistinterpolate(i + 1) ,
Flistinterpolate(i + 1)
)
)
):> (+/parallel) * FILTEREDf + x * DIRECTEQUATIONSf;
autolorenzL(in) =
( loop : (( si.bus(3) : par(i, 3, _ * FBf) ), si.bus(4)) ) ~ si.bus(7) :
par(i, 7, /(TANHf * 2)) : (si.bus(3) :> _ / 3 : normalization(1) ), si.bus(4)
with {
saturator(lim,x) = lim * ma.tanh(x/(max(lim,ma.EPSILON)));
dcblock(dcfc,x) = fi.highpass(1, dcfc, x);
loop(x, y, z, sigma, dt, rho, beta) =
filterbank1(1, 32, saturator(TANHf, dcblock(10,((x+in) + sigma * ((y+in) - (x+in)) * dt))) ),
filterbank1(1, 32, saturator(TANHf, dcblock(10,((y+in) + (rho * (x+in) - (x+in) * z - (y+in)) * dt ))) ),
filterbank1(1, 32, saturator(TANHf, dcblock(10,((z+in) + ((x+in) * (y+in) - beta * (z+in)) * dt ))) ),
(SIGMAf),
(DTf),
(RHOf),
(BETAf);
};
autolorenzR(in) =
( loop : (( si.bus(3) : par(i, 3, _ * FBf) ), si.bus(4)) ) ~ si.bus(7) :
par(i, 7, /(TANHf * 2)) : (si.bus(3) :> _ / 3 : normalization(1) ), si.bus(4)
with {
saturator(lim,x) = lim*ma.tanh(x/(max(lim,ma.EPSILON)));
dcblock(dcfc,x) = fi.highpass(1, dcfc, x);
loop(x, y, z, sigma, dt, rho, beta) =
filterbank1(1, 32, saturator(TANHf, dcblock(10,((x+in) + sigma * ((y+in) - (x+in)) * dt))) ),
filterbank1(1, 32, saturator(TANHf, dcblock(10,((y+in) + (rho * (x+in) - (x+in) * z - (y+in)) * dt ))) ),
filterbank1(1, 32, saturator(TANHf, dcblock(10,((z+in) + ((x+in) * (y+in) - beta * (z+in)) * dt ))) ),
(SIGMAf),
(DTf),
(RHOf),
(BETAf);
};
process =
( autolorenzL(0.12-0.12'),
autolorenzR(0.74-0.74') ) :
\(xyz1, sigma1, dt1, rho1, beta1, xyz2, sigma2, dt2, rho2, beta2).
(xyz1, xyz2, sigma1, dt1, rho1, beta1, sigma2, dt2, rho2, beta2);
|
62182de8720209f9b88a7fe234a854b9f5ec24bbe8d4cfac1e4ef05f10d6a111 | LucaSpanedda/RITI-Room-Is-The-Instrument | RITI_AutonomousNetwork_fixedVersion.dsp | // import faust standard library
import("stdfaust.lib");
// import RITI objects library
import("RITI.lib");
// SYSTEM INTERFACE ----------------------------------------
TGroup(x) = tgroup("Main", x);
MixerGroup(x) = hgroup("Mixer", x);
FiltersGroup(x) = hgroup("Bandpass Filters Bank", x);
TFreqsGroup(x) = tgroup("Bank Voices", x);
FreqsGroup(i, x) = hgroup("Voice_%i", x);
FDNGroup(x) = hgroup("Feedback Delay Network", x);
INDelayGroup(x) = hgroup("Input Delays", x);
OUTDelayGroup(x) = hgroup("Output Delays", x);
GainDelayGroup(x) = hgroup("Gains Network", x);
TDelayGroup(x) = tgroup("Delay Times", x);
InsOutsGroup(x) = hgroup("Inputs and Outputs", x);
LorenzFuncGroup(x) = hgroup("Lorenz Equation Parameters", x);
InspectorsGroup(x) = vgroup("Inspectors", x);
// SYSTEM VARIABLES ----------------------------------------
DelSecondsMax = 12;
SystemSpaceVarOUT = 2.8713;
SystemSpaceVarIN = 2.3132;
BPFOrder = 1;
BPFilters = 32;
NetworkVoices = 4;
InitDCBlockzero = 1;
InitDCBlockpole = 0.995;
InitX0 = 1.2;
InitY0 = 1.3;
InitZ0 = 1.6;
Dtf = TGroup((ba.db2linear(MixerGroup(LorenzFuncGroup(vslider("Dt [unit:dB]", 0, -60, 60, .001)))))) : onepoletau(2);
Sigmaf = TGroup((MixerGroup(LorenzFuncGroup(vslider("Sigma", 10, 1, 19, .001))))) : onepoletau(2);
Rhof = TGroup((MixerGroup(LorenzFuncGroup(vslider("Rho", 3.518, 2.8, 53.2, .001))))) : onepoletau(2);
Betaf = TGroup((MixerGroup(LorenzFuncGroup(vslider("Beta", 1.073, 0.2666, 5.066, .001))))) : onepoletau(2);
BPFilterBypassf = TGroup((MixerGroup(FiltersGroup(vslider("BP Bypass", 0, 0, 1, .001))))) : onepoletau(2);
BPFilterDirectf = TGroup((MixerGroup(FiltersGroup(vslider("BP Signal", 1, 0, 1, .001))))) : onepoletau(2);
GlobalBPFrequenciesf(i) = TGroup((16 ^ MixerGroup(FiltersGroup(TFreqsGroup(FreqsGroup(i+1, vslider("Frequency [unit:Hz]", 0, -1, 1, .001))))))) : onepoletau(2);
GlobalBPBWf = TGroup((MixerGroup(FiltersGroup(vslider("Bandwidth [unit:Hz]", 1, 1, 100, .001))))) : onepoletau(2);
Interpolations1f(i) = TGroup((MixerGroup(FiltersGroup(TFreqsGroup(FreqsGroup(i+1, vslider("Interpolations A", 1, 0, 1, .001))))))) : onepoletau(2);
Interpolations2f(i) = TGroup((MixerGroup(FiltersGroup(TFreqsGroup(FreqsGroup(i+1, vslider("Interpolations B", 1, 0, 1, .001))))))) : onepoletau(2);
Saturationf = TGroup((MixerGroup(LorenzFuncGroup(vslider("TanH [unit:TanH]", 50, 1, 100, .001))))) : onepoletau(2);
LorenzFeedbackf = TGroup(MixerGroup(LorenzFuncGroup(vslider("Lorenz FB", 1, 0, 1, .001)))) : onepoletau(2);
OutputGainf = TGroup(((ba.db2linear(MixerGroup(InsOutsGroup(vslider("Master [unit:dB]", -80, -80, 0, .001))))) : \(x).( (x > ba.db2linear(-80)) * x ))) : onepoletau(2);
HPfreqf = TGroup((MixerGroup(InsOutsGroup(vslider("HP frequency [unit:Hz]", 1, 1, 20000, 1))))) : onepoletau(2);
LPfreqf = TGroup((MixerGroup(InsOutsGroup(vslider("LP frequency [unit:Hz]", 20000, 1, 20000, 1))))) : onepoletau(2);
ExternalInputGainf = TGroup(((ba.db2linear(MixerGroup(InsOutsGroup(vslider("Externals [unit:dB]", -80, -80, 80, .001))))) :
\(x).( (x > ba.db2linear(-80)) * x ))) : onepoletau(2);
// MODIFIED LORENZ SYSTEM ----------------------------------------
ModifiedLorenzSystem(x0, y0, z0, dt, beta, rho, sigma, bypassFilter, directFilter, filterPartials, filterOrder, globalFreq, globalAmps, globalBW, interpolation1, interpolation2, saturation, dcBlockzero, dcBlockpole, internalFeedback, i, externalInput) =
(
(
par(i, 3, _ * internalFeedback) :
TGroup(InspectorsGroup(hgroup("Lorenz Feedback", XYZinspect(i)))) : LorenzSystemEquations
) :
par(i, 3, _ : dcblocker(dcBlockzero, dcBlockpole)) :
TGroup(InspectorsGroup(hgroup("DC Blocker", XYZinspect(i)))) :
par(i, 3, _ : saturator(saturation)) :
TGroup(InspectorsGroup(hgroup("Hyperbolic Tangent", XYZinspect(i)))) :
par(i, 3, _ : BandpassFiltersBank(bypassFilter, directFilter, filterPartials, filterOrder, globalFreq, globalAmps, globalBW, interpolation1, interpolation2)) :
TGroup(InspectorsGroup(hgroup("Bandpass Filters", XYZinspect(i))))
) ~ si.bus(3) :
par(i, 3, / (max(saturation, ma.EPSILON))) :> _ / 3
with {
x_init = x0-x0'; y_init = y0-y0'; z_init = z0-z0';
LorenzSystemEquations(x, y, z) =
((((x + externalInput) + sigma * (y - x) * dt + x_init))),
((((y + externalInput) + (rho * x - x * z - y) * dt + y_init))),
((((z + externalInput) + (x * y - beta * z) * dt + z_init)));
};
// GLOBAL SYSTEM NETWORK ----------------------------------------
GlobalSystemNetwork(Mic1, Mic2, Mic3, Mic4) =
(NetworkLoop ~ _ : (si.block(1), si.bus(NetworkVoices))) :
par(i, NetworkVoices, _ : HPTPT(HPfreqf) : LPTPT(LPfreqf) : normalization(1)) :
par(i, NetworkVoices, _ * OutputGainf )
with{
NetworkLoop(networkFeedback) = par(i, NetworkVoices,
(networkFeedback * (TGroup(MixerGroup(FDNGroup(TDelayGroup(GainDelayGroup(vslider("Voice_%i+1[2]", 1, 0, 1, .001))))))) :
(timeVaryingDelay(TGroup(MixerGroup(FDNGroup(TDelayGroup(INDelayGroup(vslider("Voice_%i+1[2] [unit:Sec]",
(SystemSpaceVarIN * (NetworkVoices - i)), .001, DelSecondsMax, .001)))))), 0) + (((Mic1,Mic2,Mic3,Mic4) :> _ / 4) * ExternalInputGainf)) :
ModifiedLorenzSystem(InitX0, InitY0, InitZ0, Dtf, Betaf, Rhof, Sigmaf, BPFilterBypassf, BPFilterDirectf, BPFilters, BPFOrder,
GlobalBPFrequenciesf(i), 1, GlobalBPBWf, Interpolations1f(i), Interpolations2f(i), Saturationf, InitDCBlockzero, InitDCBlockpole, LorenzFeedbackf, i)
)
) <:
(par( i, NetworkVoices, _ : timeVaryingDelay(TGroup(MixerGroup(FDNGroup(TDelayGroup(OUTDelayGroup(vslider("Voice_%i+1[2] [unit:Sec]", SystemSpaceVarOUT * (i + 1), .001, DelSecondsMax, .001)))))) , 0)) :> +/NetworkVoices), (si.bus(NetworkVoices));
};
process = si.bus(8) :> si.bus(4) : GlobalSystemNetwork; | https://raw.githubusercontent.com/LucaSpanedda/RITI-Room-Is-The-Instrument/7ea34afa403eb7c7a70f0b23c6425964e0689e7d/Compiled_15-2-2023_RITI_AutonomousNetwork_fixedVersion/RITI_AutonomousNetwork_fixedVersion.dsp | faust | import faust standard library
import RITI objects library
SYSTEM INTERFACE ----------------------------------------
SYSTEM VARIABLES ----------------------------------------
MODIFIED LORENZ SYSTEM ----------------------------------------
GLOBAL SYSTEM NETWORK ----------------------------------------
| import("stdfaust.lib");
import("RITI.lib");
TGroup(x) = tgroup("Main", x);
MixerGroup(x) = hgroup("Mixer", x);
FiltersGroup(x) = hgroup("Bandpass Filters Bank", x);
TFreqsGroup(x) = tgroup("Bank Voices", x);
FreqsGroup(i, x) = hgroup("Voice_%i", x);
FDNGroup(x) = hgroup("Feedback Delay Network", x);
INDelayGroup(x) = hgroup("Input Delays", x);
OUTDelayGroup(x) = hgroup("Output Delays", x);
GainDelayGroup(x) = hgroup("Gains Network", x);
TDelayGroup(x) = tgroup("Delay Times", x);
InsOutsGroup(x) = hgroup("Inputs and Outputs", x);
LorenzFuncGroup(x) = hgroup("Lorenz Equation Parameters", x);
InspectorsGroup(x) = vgroup("Inspectors", x);
DelSecondsMax = 12;
SystemSpaceVarOUT = 2.8713;
SystemSpaceVarIN = 2.3132;
BPFOrder = 1;
BPFilters = 32;
NetworkVoices = 4;
InitDCBlockzero = 1;
InitDCBlockpole = 0.995;
InitX0 = 1.2;
InitY0 = 1.3;
InitZ0 = 1.6;
Dtf = TGroup((ba.db2linear(MixerGroup(LorenzFuncGroup(vslider("Dt [unit:dB]", 0, -60, 60, .001)))))) : onepoletau(2);
Sigmaf = TGroup((MixerGroup(LorenzFuncGroup(vslider("Sigma", 10, 1, 19, .001))))) : onepoletau(2);
Rhof = TGroup((MixerGroup(LorenzFuncGroup(vslider("Rho", 3.518, 2.8, 53.2, .001))))) : onepoletau(2);
Betaf = TGroup((MixerGroup(LorenzFuncGroup(vslider("Beta", 1.073, 0.2666, 5.066, .001))))) : onepoletau(2);
BPFilterBypassf = TGroup((MixerGroup(FiltersGroup(vslider("BP Bypass", 0, 0, 1, .001))))) : onepoletau(2);
BPFilterDirectf = TGroup((MixerGroup(FiltersGroup(vslider("BP Signal", 1, 0, 1, .001))))) : onepoletau(2);
GlobalBPFrequenciesf(i) = TGroup((16 ^ MixerGroup(FiltersGroup(TFreqsGroup(FreqsGroup(i+1, vslider("Frequency [unit:Hz]", 0, -1, 1, .001))))))) : onepoletau(2);
GlobalBPBWf = TGroup((MixerGroup(FiltersGroup(vslider("Bandwidth [unit:Hz]", 1, 1, 100, .001))))) : onepoletau(2);
Interpolations1f(i) = TGroup((MixerGroup(FiltersGroup(TFreqsGroup(FreqsGroup(i+1, vslider("Interpolations A", 1, 0, 1, .001))))))) : onepoletau(2);
Interpolations2f(i) = TGroup((MixerGroup(FiltersGroup(TFreqsGroup(FreqsGroup(i+1, vslider("Interpolations B", 1, 0, 1, .001))))))) : onepoletau(2);
Saturationf = TGroup((MixerGroup(LorenzFuncGroup(vslider("TanH [unit:TanH]", 50, 1, 100, .001))))) : onepoletau(2);
LorenzFeedbackf = TGroup(MixerGroup(LorenzFuncGroup(vslider("Lorenz FB", 1, 0, 1, .001)))) : onepoletau(2);
OutputGainf = TGroup(((ba.db2linear(MixerGroup(InsOutsGroup(vslider("Master [unit:dB]", -80, -80, 0, .001))))) : \(x).( (x > ba.db2linear(-80)) * x ))) : onepoletau(2);
HPfreqf = TGroup((MixerGroup(InsOutsGroup(vslider("HP frequency [unit:Hz]", 1, 1, 20000, 1))))) : onepoletau(2);
LPfreqf = TGroup((MixerGroup(InsOutsGroup(vslider("LP frequency [unit:Hz]", 20000, 1, 20000, 1))))) : onepoletau(2);
ExternalInputGainf = TGroup(((ba.db2linear(MixerGroup(InsOutsGroup(vslider("Externals [unit:dB]", -80, -80, 80, .001))))) :
\(x).( (x > ba.db2linear(-80)) * x ))) : onepoletau(2);
ModifiedLorenzSystem(x0, y0, z0, dt, beta, rho, sigma, bypassFilter, directFilter, filterPartials, filterOrder, globalFreq, globalAmps, globalBW, interpolation1, interpolation2, saturation, dcBlockzero, dcBlockpole, internalFeedback, i, externalInput) =
(
(
par(i, 3, _ * internalFeedback) :
TGroup(InspectorsGroup(hgroup("Lorenz Feedback", XYZinspect(i)))) : LorenzSystemEquations
) :
par(i, 3, _ : dcblocker(dcBlockzero, dcBlockpole)) :
TGroup(InspectorsGroup(hgroup("DC Blocker", XYZinspect(i)))) :
par(i, 3, _ : saturator(saturation)) :
TGroup(InspectorsGroup(hgroup("Hyperbolic Tangent", XYZinspect(i)))) :
par(i, 3, _ : BandpassFiltersBank(bypassFilter, directFilter, filterPartials, filterOrder, globalFreq, globalAmps, globalBW, interpolation1, interpolation2)) :
TGroup(InspectorsGroup(hgroup("Bandpass Filters", XYZinspect(i))))
) ~ si.bus(3) :
par(i, 3, / (max(saturation, ma.EPSILON))) :> _ / 3
with {
x_init = x0-x0'; y_init = y0-y0'; z_init = z0-z0';
LorenzSystemEquations(x, y, z) =
((((x + externalInput) + sigma * (y - x) * dt + x_init))),
((((y + externalInput) + (rho * x - x * z - y) * dt + y_init))),
((((z + externalInput) + (x * y - beta * z) * dt + z_init)));
};
GlobalSystemNetwork(Mic1, Mic2, Mic3, Mic4) =
(NetworkLoop ~ _ : (si.block(1), si.bus(NetworkVoices))) :
par(i, NetworkVoices, _ : HPTPT(HPfreqf) : LPTPT(LPfreqf) : normalization(1)) :
par(i, NetworkVoices, _ * OutputGainf )
with{
NetworkLoop(networkFeedback) = par(i, NetworkVoices,
(networkFeedback * (TGroup(MixerGroup(FDNGroup(TDelayGroup(GainDelayGroup(vslider("Voice_%i+1[2]", 1, 0, 1, .001))))))) :
(timeVaryingDelay(TGroup(MixerGroup(FDNGroup(TDelayGroup(INDelayGroup(vslider("Voice_%i+1[2] [unit:Sec]",
(SystemSpaceVarIN * (NetworkVoices - i)), .001, DelSecondsMax, .001)))))), 0) + (((Mic1,Mic2,Mic3,Mic4) :> _ / 4) * ExternalInputGainf)) :
ModifiedLorenzSystem(InitX0, InitY0, InitZ0, Dtf, Betaf, Rhof, Sigmaf, BPFilterBypassf, BPFilterDirectf, BPFilters, BPFOrder,
GlobalBPFrequenciesf(i), 1, GlobalBPBWf, Interpolations1f(i), Interpolations2f(i), Saturationf, InitDCBlockzero, InitDCBlockpole, LorenzFeedbackf, i)
)
) <:
(par( i, NetworkVoices, _ : timeVaryingDelay(TGroup(MixerGroup(FDNGroup(TDelayGroup(OUTDelayGroup(vslider("Voice_%i+1[2] [unit:Sec]", SystemSpaceVarOUT * (i + 1), .001, DelSecondsMax, .001)))))) , 0)) :> +/NetworkVoices), (si.bus(NetworkVoices));
};
process = si.bus(8) :> si.bus(4) : GlobalSystemNetwork; |
fbb1377cd7ab3b7f9b3b066d0d97f4e2bac08c5ec71fb1d45b9ba078be92be50 | LucaSpanedda/Riverberazione_Digitale_in_FAUST | 0.22_FBCombTPT.dsp | // import Standard Faust library
// https://github.com/grame-cncm/faustlibraries/
import("stdfaust.lib");
// TPT version of the FBComb Filter
// reference : (by Will Pirkle)
// http://www.willpirkle.com/Downloads/AN-4VirtualAnalogFilters.2.0.pdf
// Feedback Comb Filter. FBComb(Del,G,signal)
// Del=delay time in samples, G=feedback gain 0-1
FBCombTPT(Del,G,x) = FBcircuit ~ _
with {
FBcircuit(y) = x+y@(Del-1)*G;
};
process = FBCombTPT(1000,0.998);
| https://raw.githubusercontent.com/LucaSpanedda/Riverberazione_Digitale_in_FAUST/5b0d8fdd01d355676ef017cd351e0e89f22d7387/0.22_FBCombTPT.dsp | faust | import Standard Faust library
https://github.com/grame-cncm/faustlibraries/
TPT version of the FBComb Filter
reference : (by Will Pirkle)
http://www.willpirkle.com/Downloads/AN-4VirtualAnalogFilters.2.0.pdf
Feedback Comb Filter. FBComb(Del,G,signal)
Del=delay time in samples, G=feedback gain 0-1 | import("stdfaust.lib");
FBCombTPT(Del,G,x) = FBcircuit ~ _
with {
FBcircuit(y) = x+y@(Del-1)*G;
};
process = FBCombTPT(1000,0.998);
|
d2327795147e515ea660036e7322d2612966ff03b75942b80dfcf7d97122d72f | LucaSpanedda/Riverberazione_Digitale_in_FAUST | 0.12_OnepoleTPT.dsp | // import Standard Faust library
// https://github.com/grame-cncm/faustlibraries/
import("stdfaust.lib");
// One-Pole filter function. OnepoleTPT(CF) = Frequency Cut in HZ
// TPT version of the One-Pole Filter by Vadim Zavalishin
// reference : (by Will Pirkle)
// http://www.willpirkle.com/Downloads/AN-4VirtualAnalogFilters.2.0.pdf
OnepoleTPT(CF,x) = circuit ~ _ : ! , _
with {
g = tan(CF * ma.PI / ma.SR);
G = g / (1.0 + g);
circuit(sig) = u , lp
with {
v = (x - sig) * G;
u = v + lp;
lp = v + sig;
};
};
// out
process = OnepoleTPT(100);
| https://raw.githubusercontent.com/LucaSpanedda/Riverberazione_Digitale_in_FAUST/5b0d8fdd01d355676ef017cd351e0e89f22d7387/0.12_OnepoleTPT.dsp | faust | import Standard Faust library
https://github.com/grame-cncm/faustlibraries/
One-Pole filter function. OnepoleTPT(CF) = Frequency Cut in HZ
TPT version of the One-Pole Filter by Vadim Zavalishin
reference : (by Will Pirkle)
http://www.willpirkle.com/Downloads/AN-4VirtualAnalogFilters.2.0.pdf
out | import("stdfaust.lib");
OnepoleTPT(CF,x) = circuit ~ _ : ! , _
with {
g = tan(CF * ma.PI / ma.SR);
G = g / (1.0 + g);
circuit(sig) = u , lp
with {
v = (x - sig) * G;
u = v + lp;
lp = v + sig;
};
};
process = OnepoleTPT(100);
|
78e590344d0ce33123a34e02b9bdc75eb3b81bc5a76a403087390ed82186a270 | LucaSpanedda/Riverberazione_Digitale_in_FAUST | 1.30_Riverbero_Allpass_Loop_di_Keith_Barr.dsp | import("stdfaust.lib");
// Keith Barr Allpass Loop Reverb
apf(delaysamples) = ap
with{
ap =
(+ : _ <: @(delaysamples-1), *(0.5)) ~
*(-0.5) : mem, _ : + : _;
};
// tempo decadimento
krt = 0.9;
lrtap(dl,dr) = _@(dr) <: _,_,_;
//process = lrtap(7,14);
// section 1
sect1(x,y) = x+y : apf(4801) : apf(2903) : lrtap(593,659) : *(krt),y,_,_;
// process = sect1~_;
router(a,b,c,d,e) = a, (b+d), (c+e);
sect2(x,y) = x+y,_,_ : (apf(4673) : apf(2801)),_,_ : lrtap(743,751),_,_ : router : *(krt),y,_,_;
//process = (sect1 : sect2)~_;
sect3(x,y) = x+y,_,_ : (apf(3853) : apf(2657)),_,_ : lrtap(433,599),_,_ : router : *(krt),y,_,_;
//process = (sect1 : sect2 : sect3)~_;
sect4(x,y) = x+y,_,_ : (apf(3049) : apf(1987)),_,_ : lrtap(911,997),_,_ : router : *(krt),_,_;
kbreverb = (sect1 : sect2 : sect3 : sect4)~_ : !,_,_;
process = _ : kbreverb;
| https://raw.githubusercontent.com/LucaSpanedda/Riverberazione_Digitale_in_FAUST/f40fe0b4a2555671fe45ba122264b1053c4de6da/1.30_Riverbero_Allpass_Loop_di_Keith_Barr.dsp | faust | Keith Barr Allpass Loop Reverb
tempo decadimento
process = lrtap(7,14);
section 1
process = sect1~_;
process = (sect1 : sect2)~_;
process = (sect1 : sect2 : sect3)~_;
| import("stdfaust.lib");
apf(delaysamples) = ap
with{
ap =
(+ : _ <: @(delaysamples-1), *(0.5)) ~
*(-0.5) : mem, _ : + : _;
};
krt = 0.9;
lrtap(dl,dr) = _@(dr) <: _,_,_;
sect1(x,y) = x+y : apf(4801) : apf(2903) : lrtap(593,659) : *(krt),y,_,_;
router(a,b,c,d,e) = a, (b+d), (c+e);
sect2(x,y) = x+y,_,_ : (apf(4673) : apf(2801)),_,_ : lrtap(743,751),_,_ : router : *(krt),y,_,_;
sect3(x,y) = x+y,_,_ : (apf(3853) : apf(2657)),_,_ : lrtap(433,599),_,_ : router : *(krt),y,_,_;
sect4(x,y) = x+y,_,_ : (apf(3049) : apf(1987)),_,_ : lrtap(911,997),_,_ : router : *(krt),_,_;
kbreverb = (sect1 : sect2 : sect3 : sect4)~_ : !,_,_;
process = _ : kbreverb;
|
072ecde73d1110b1a58beb7f91d031ee106b56cf19e033fe967acb80d01bef01 | LucaSpanedda/Riverberazione_Digitale_in_FAUST | 0.26_LFBCombTPT.dsp | // import Standard Faust library
// https://github.com/grame-cncm/faustlibraries/
import("stdfaust.lib");
// TPT version of the Lowpass Feedback Comb Filter. FBComb(Del,G,signal)
// Del=delay time in samples, G=feedback gain 0-1
// TPT version of the One-Pole Filter by Vadim Zavalishin
// reference : (by Will Pirkle)
// http://www.willpirkle.com/Downloads/AN-4VirtualAnalogFilters.2.0.pdf
LFBCombTPT(Del,G,CF) = LFBCcircuit ~ _
with{
LFBCcircuit(y,z) = z+(LowpassTPT(y)@(Del-1))*G
with{
LowpassTPT(x) = (lowpasscircuit ~ _ : ! , _)
with{
g = tan(CF * ma.PI / ma.SR);
G = g / (1.0 + g);
lowpasscircuit(sig) = u , lp
with{
v = (x - sig) * G;
u = v + lp;
lp = v + sig;
};
};
};
};
// out
process = LFBComb(1000,0.998,10000);
| https://raw.githubusercontent.com/LucaSpanedda/Riverberazione_Digitale_in_FAUST/5b0d8fdd01d355676ef017cd351e0e89f22d7387/0.26_LFBCombTPT.dsp | faust | import Standard Faust library
https://github.com/grame-cncm/faustlibraries/
TPT version of the Lowpass Feedback Comb Filter. FBComb(Del,G,signal)
Del=delay time in samples, G=feedback gain 0-1
TPT version of the One-Pole Filter by Vadim Zavalishin
reference : (by Will Pirkle)
http://www.willpirkle.com/Downloads/AN-4VirtualAnalogFilters.2.0.pdf
out | import("stdfaust.lib");
LFBCombTPT(Del,G,CF) = LFBCcircuit ~ _
with{
LFBCcircuit(y,z) = z+(LowpassTPT(y)@(Del-1))*G
with{
LowpassTPT(x) = (lowpasscircuit ~ _ : ! , _)
with{
g = tan(CF * ma.PI / ma.SR);
G = g / (1.0 + g);
lowpasscircuit(sig) = u , lp
with{
v = (x - sig) * G;
u = v + lp;
lp = v + sig;
};
};
};
};
process = LFBComb(1000,0.998,10000);
|
cefc00ba311aa232b7e3a7468aa4fa04f4f8b4d1030bac29616072255b6cf624 | LucaSpanedda/Sound_reading_and_writing_techniques_in_Faust | 1.00_Table_Lookup_Reading.dsp | // import Standard Faust library
// https://github.com/grame-cncm/faustlibraries/
import("stdfaust.lib");
// MAIN FUNCTION (OUT)
process =
// DEFINITION OF THE TABLE: SAMPLE DATA
waveform
{0.00000,0.02000,0.03986,0.05264,0.06458,
0.07510,0.08310,0.08978,0.09360,0.09607,
0.09613,0.09332,0.08936,0.08344,0.07614,
0.06784,0.05826,0.04871,0.03906,0.03146,
0.02536,0.02045,0.01755,0.01477,0.01282,
0.01312,0.01593,0.01859,0.02176,0.02484,
0.02734,0.03018,0.03189,0.03204,0.03177,
0.02957,0.02640,0.02222,0.01852,0.01392,
0.00800,0.00104,-0.00751,-0.01794,-0.03015,
-0.04330,-0.05710,-0.07294,-0.08932,-0.10568,
-0.12094,-0.13617,-0.14920,-0.16147,-0.17099,
-0.17960,-0.18414,-0.18579,-0.18497,-0.18152,
-0.17651,-0.16898,-0.16095,-0.15140,-0.14133,
-0.13120,-0.11951,-0.10687,-0.09399,-0.08078,
-0.06653,-0.05203,-0.03891,-0.02545,0.01288,
-0.00238,0.00732,0.01508,0.02087,0.02606,
0.02982,0.03314,0.03525,0.03723,0.03772,
0.03751,0.03821,0.03879,0.03867,0.03897,
0.03961,0.04059,0.04089,0.04086,0.03983,
0.03833,0.03662,0.03464,0.03189,0.02975,
0.02740,0.02542,0.02341,0.02090,0.01895,
0.01575,0.01230,0.00772,0.00189,-0.00504,
-0.01273,-0.02258,-0.03256,-0.04413,0.05606,
-0.06793,-0.07993,-0.09308,-0.10641,0.11768,
-0.12903,-0.13760,-0.14307,-0.14658,-0.14725,
-0.14554,-0.14111,-0.13422,-0.12497,-0.11322,
-0.09863,-0.08298,-0.06558,-0.04675,-0.02847,
-0.01041,0.00906,0.02704,0.04446,0.05997,
0.07343,0.08563,0.09467,0.10193,0.10541,
0.10562,0.10358,0.09793,0.08939,0.07980,
0.06802,0.05624,0.04376,0.03091,0.01874,
0.00760,-0.00308,-0.01132,-0.01791,-0.02380,
-0.02676,-0.02905,-0.03073,-0.03061,-0.03055,
-0.02960,-0.02917,-0.02792,-0.02768,-0.02792,
-0.02808,-0.02914,-0.02942,-0.03128,-0.03415,
-0.03772,-0.04181,-0.04694,-0.05341,-0.06140,
-0.06992,-0.07944,-0.08990,-0.10037,-0.11069,
-0.12134,-0.13135,-0.13934,-0.14725,-0.15289,
-0.15674,-0.15857,-0.15692,-0.15311,-0.14651,
-0.13803,-0.12643,-0.11371,-0.09894,-0.08282,
-0.06653,-0.04904,-0.03043,-0.01138,0.00647,
0.02484,0.04178,0.05618,0.07034,0.08228,
0.09082,0.09692,0.10052,0.10190,0.10190,
0.09845,0.09326,0.08698,0.07855,0.06879,
0.05756,0.04584,0.03494,0.02478,0.01511,
0.00806,0.00192,-0.00244,-0.00662,-0.00980,
-0.01059,-0.01111,-0.01025,-0.00793,-0.00613,
-0.00189,0.00323,0.00854,0.01370,0.01843,
0.02292,0.02637,0.02939,0.03012,0.02899,
0.02551,0.01868,0.01016,-0.00067,-0.01453,
-0.03070,-0.04788,-0.06747,-0.08768,-0.10568,
-0.12363,-0.14029,-0.15372,-0.16547,-0.17389,
-0.18027,-0.18372,-0.18231,-0.17892,-0.17252,
-0.16345,-0.15320,-0.14166,-0.12726,-0.11206,
-0.09653,-0.08087,-0.06436,-0.04834,-0.03290,
-0.01666,-0.00162,0.01212,0.02463,0.03641,
0.04471,0.05011,0.05331,0.05493,0.05368,
0.05185,0.04889,0.04562,0.03961,0.03439,
0.02927,0.02286,0.01807,0.01422,0.01013,
0.00882,0.00836,0.00970,0.01199,0.01361,
0.01730,0.02158,0.02722,0.03259,0.03839,
0.04361,0.04889,0.05334,0.05698,0.05966,
0.06055,0.05908,0.05527,0.04965,0.04138,
0.03198,0.01926,0.00562,-0.01010,-0.02625,
-0.04333,-0.06131,-0.07822,-0.09451,-0.10843,
-0.11993,-0.13037,-0.13809,-0.14343,-0.14648,
-0.14792,-0.14661,-0.14279,-0.13800,-0.13098,
-0.12228,-0.11240,-0.09995,-0.08612,-0.07117,
-0.05600,-0.04004,-0.02594,-0.01303,-0.00174,
0.00787,0.01541,0.02039,0.02267,0.02142,
0.01727,0.01035,0.00168,-0.00797,-0.01968,
-0.03119,-0.04312,-0.05389,-0.06476,-0.07428,
-0.08203,-0.08810,-0.09116,-0.08987,-0.08847,
-0.08469,-0.07889,-0.07138,-0.06155,-0.05151,
-0.04095,-0.03046,-0.01956,-0.01038,-0.00287,
0.00311,0.00842,0.01236,0.01318,0.01440,
0.01419,0.01328,0.01022,0.00604,0.00061,
-0.00455,-0.01129,-0.01828,-0.02530,-0.03302,
-0.04068,-0.04895,-0.05627,-0.06393,-0.06921,
-0.07336,-0.07654,-0.07672,-0.07498,-0.07153,
-0.06738,-0.06104,-0.05411,-0.04620,-0.03644,
-0.02502,-0.01309,-0.00015,0.01324,0.02719,
0.04031,0.05399,0.06638,0.07669,0.08591,
0.09341,0.09711,0.09778,0.09583,0.09155,
0.08380,0.07541,0.06503,0.05518,0.04498,
0.03690,0.02844,0.02112,0.01663,0.01199,
0.00916,0.00769,0.00766,0.00912,0.01007,
0.01190,0.01547,0.01923,0.02441,0.03073,
0.03580,0.04211,0.04797,0.05267,0.05548,
0.05676,0.05646,0.05493,0.04971,0.04227,
0.03195,0.01840,0.00269,-0.01593,-0.03757,
-0.06042,-0.08517,-0.11115,-0.13638,-0.16119,
-0.18436,-0.20578,-0.22586,-0.24271,-0.25607,
-0.26563,-0.27054,-0.27216,-0.26987,-0.26291,
-0.25232,-0.23770,-0.22049,-0.20081,-0.17966,
-0.15710,-0.13461,-0.11267,-0.09131,-0.07065,
-0.05121,-0.03229,-0.01572,-0.00095,0.01181,
0.02374,0.03259,0.04037,0.04605,0.05042,
0.05249,0.05396,0.05374,0.05338,0.05164,
0.04929,0.04630,0.04230,0.03989,0.03784,
0.03467,0.03326,0.03186,0.03076,0.02951,
0.02829,0.02765,0.02719,0.02679,0.02759,
0.02000,0.00000},
// COUNTER of the LOOKUP TABLE
%(512)~+(1)
// READTABLE
: rdtable <: _,_; | https://raw.githubusercontent.com/LucaSpanedda/Sound_reading_and_writing_techniques_in_Faust/bb01eff05a51424c16420a00b383441d8973d85e/0_work-in-progress/1.00_Table_Lookup_Reading.dsp | faust | import Standard Faust library
https://github.com/grame-cncm/faustlibraries/
MAIN FUNCTION (OUT)
DEFINITION OF THE TABLE: SAMPLE DATA
COUNTER of the LOOKUP TABLE
READTABLE
| import("stdfaust.lib");
process =
waveform
{0.00000,0.02000,0.03986,0.05264,0.06458,
0.07510,0.08310,0.08978,0.09360,0.09607,
0.09613,0.09332,0.08936,0.08344,0.07614,
0.06784,0.05826,0.04871,0.03906,0.03146,
0.02536,0.02045,0.01755,0.01477,0.01282,
0.01312,0.01593,0.01859,0.02176,0.02484,
0.02734,0.03018,0.03189,0.03204,0.03177,
0.02957,0.02640,0.02222,0.01852,0.01392,
0.00800,0.00104,-0.00751,-0.01794,-0.03015,
-0.04330,-0.05710,-0.07294,-0.08932,-0.10568,
-0.12094,-0.13617,-0.14920,-0.16147,-0.17099,
-0.17960,-0.18414,-0.18579,-0.18497,-0.18152,
-0.17651,-0.16898,-0.16095,-0.15140,-0.14133,
-0.13120,-0.11951,-0.10687,-0.09399,-0.08078,
-0.06653,-0.05203,-0.03891,-0.02545,0.01288,
-0.00238,0.00732,0.01508,0.02087,0.02606,
0.02982,0.03314,0.03525,0.03723,0.03772,
0.03751,0.03821,0.03879,0.03867,0.03897,
0.03961,0.04059,0.04089,0.04086,0.03983,
0.03833,0.03662,0.03464,0.03189,0.02975,
0.02740,0.02542,0.02341,0.02090,0.01895,
0.01575,0.01230,0.00772,0.00189,-0.00504,
-0.01273,-0.02258,-0.03256,-0.04413,0.05606,
-0.06793,-0.07993,-0.09308,-0.10641,0.11768,
-0.12903,-0.13760,-0.14307,-0.14658,-0.14725,
-0.14554,-0.14111,-0.13422,-0.12497,-0.11322,
-0.09863,-0.08298,-0.06558,-0.04675,-0.02847,
-0.01041,0.00906,0.02704,0.04446,0.05997,
0.07343,0.08563,0.09467,0.10193,0.10541,
0.10562,0.10358,0.09793,0.08939,0.07980,
0.06802,0.05624,0.04376,0.03091,0.01874,
0.00760,-0.00308,-0.01132,-0.01791,-0.02380,
-0.02676,-0.02905,-0.03073,-0.03061,-0.03055,
-0.02960,-0.02917,-0.02792,-0.02768,-0.02792,
-0.02808,-0.02914,-0.02942,-0.03128,-0.03415,
-0.03772,-0.04181,-0.04694,-0.05341,-0.06140,
-0.06992,-0.07944,-0.08990,-0.10037,-0.11069,
-0.12134,-0.13135,-0.13934,-0.14725,-0.15289,
-0.15674,-0.15857,-0.15692,-0.15311,-0.14651,
-0.13803,-0.12643,-0.11371,-0.09894,-0.08282,
-0.06653,-0.04904,-0.03043,-0.01138,0.00647,
0.02484,0.04178,0.05618,0.07034,0.08228,
0.09082,0.09692,0.10052,0.10190,0.10190,
0.09845,0.09326,0.08698,0.07855,0.06879,
0.05756,0.04584,0.03494,0.02478,0.01511,
0.00806,0.00192,-0.00244,-0.00662,-0.00980,
-0.01059,-0.01111,-0.01025,-0.00793,-0.00613,
-0.00189,0.00323,0.00854,0.01370,0.01843,
0.02292,0.02637,0.02939,0.03012,0.02899,
0.02551,0.01868,0.01016,-0.00067,-0.01453,
-0.03070,-0.04788,-0.06747,-0.08768,-0.10568,
-0.12363,-0.14029,-0.15372,-0.16547,-0.17389,
-0.18027,-0.18372,-0.18231,-0.17892,-0.17252,
-0.16345,-0.15320,-0.14166,-0.12726,-0.11206,
-0.09653,-0.08087,-0.06436,-0.04834,-0.03290,
-0.01666,-0.00162,0.01212,0.02463,0.03641,
0.04471,0.05011,0.05331,0.05493,0.05368,
0.05185,0.04889,0.04562,0.03961,0.03439,
0.02927,0.02286,0.01807,0.01422,0.01013,
0.00882,0.00836,0.00970,0.01199,0.01361,
0.01730,0.02158,0.02722,0.03259,0.03839,
0.04361,0.04889,0.05334,0.05698,0.05966,
0.06055,0.05908,0.05527,0.04965,0.04138,
0.03198,0.01926,0.00562,-0.01010,-0.02625,
-0.04333,-0.06131,-0.07822,-0.09451,-0.10843,
-0.11993,-0.13037,-0.13809,-0.14343,-0.14648,
-0.14792,-0.14661,-0.14279,-0.13800,-0.13098,
-0.12228,-0.11240,-0.09995,-0.08612,-0.07117,
-0.05600,-0.04004,-0.02594,-0.01303,-0.00174,
0.00787,0.01541,0.02039,0.02267,0.02142,
0.01727,0.01035,0.00168,-0.00797,-0.01968,
-0.03119,-0.04312,-0.05389,-0.06476,-0.07428,
-0.08203,-0.08810,-0.09116,-0.08987,-0.08847,
-0.08469,-0.07889,-0.07138,-0.06155,-0.05151,
-0.04095,-0.03046,-0.01956,-0.01038,-0.00287,
0.00311,0.00842,0.01236,0.01318,0.01440,
0.01419,0.01328,0.01022,0.00604,0.00061,
-0.00455,-0.01129,-0.01828,-0.02530,-0.03302,
-0.04068,-0.04895,-0.05627,-0.06393,-0.06921,
-0.07336,-0.07654,-0.07672,-0.07498,-0.07153,
-0.06738,-0.06104,-0.05411,-0.04620,-0.03644,
-0.02502,-0.01309,-0.00015,0.01324,0.02719,
0.04031,0.05399,0.06638,0.07669,0.08591,
0.09341,0.09711,0.09778,0.09583,0.09155,
0.08380,0.07541,0.06503,0.05518,0.04498,
0.03690,0.02844,0.02112,0.01663,0.01199,
0.00916,0.00769,0.00766,0.00912,0.01007,
0.01190,0.01547,0.01923,0.02441,0.03073,
0.03580,0.04211,0.04797,0.05267,0.05548,
0.05676,0.05646,0.05493,0.04971,0.04227,
0.03195,0.01840,0.00269,-0.01593,-0.03757,
-0.06042,-0.08517,-0.11115,-0.13638,-0.16119,
-0.18436,-0.20578,-0.22586,-0.24271,-0.25607,
-0.26563,-0.27054,-0.27216,-0.26987,-0.26291,
-0.25232,-0.23770,-0.22049,-0.20081,-0.17966,
-0.15710,-0.13461,-0.11267,-0.09131,-0.07065,
-0.05121,-0.03229,-0.01572,-0.00095,0.01181,
0.02374,0.03259,0.04037,0.04605,0.05042,
0.05249,0.05396,0.05374,0.05338,0.05164,
0.04929,0.04630,0.04230,0.03989,0.03784,
0.03467,0.03326,0.03186,0.03076,0.02951,
0.02829,0.02765,0.02719,0.02679,0.02759,
0.02000,0.00000},
%(512)~+(1)
: rdtable <: _,_; |
aa8bdf5052807974abde3058218f4b6dd678d90e63990a4f133c5f3769c92eab | LucaSpanedda/Luca_Spanedda_St_Cecilia_Conservatory_Thesis | RITI_AutonomousNetwork_fixedVersion.dsp | // import faust standard library
import("stdfaust.lib");
// import RITI objects library
import("RITI.lib");
// SYSTEM VARIABLES ----------------------------------------
DelSecondsMax = 12;
SystemSpaceVarOUT = 2.8713;
SystemSpaceVarIN = 2.3132;
BPFOrder = 1;
BPFilters = 32;
NetworkVoices = 4;
InitDCBlockzero = 1;
InitDCBlockpole = 0.995;
InitX0 = 1.2;
InitY0 = 1.3;
InitZ0 = 1.6;
// SYSTEM CONTROLS ----------------------------------------
RoomInterfaceNetwork(Mic1, Mic2, Mic3, Mic4) = Dtf, Betaf, Rhof, Sigmaf, BPFilterBypassf, GlobalBPFrequenciesf, GlobalBPBWf, Interpolations1f, Interpolations2f, Saturationf, LorenzFeedbackf, NetworkFeedbackf, ExternalInputGainf, OutputGainf, HPfreqf, LPfreqf, MicsOutputf
with {
SmoothTf(x) = onepoletau(vslider("h:[0]Mixer/h:Interpolation/Smooth [unit:Sec]", 1, .001, 10, .001), x);
Dtf = (ba.db2linear(vslider("h:[0]Mixer/h:Lorenz Equation Parameters/Dt [unit:dB]", 0, -60, 60, .001))) : SmoothTf;
Sigmaf = (vslider("h:[0]Mixer/h:Lorenz Equation Parameters/Sigma", 10, 1, 19, .001)) : SmoothTf;
Rhof = (vslider("h:[0]Mixer/h:Lorenz Equation Parameters/Rho", 3.518, 2.8, 53.2, .001)) : SmoothTf;
Betaf = (vslider("h:[0]Mixer/h:Lorenz Equation Parameters/Beta", 1.073, 0.2666, 5.066, .001)) : SmoothTf;
BPFilterBypassf = (vslider("h:[0]Mixer/h:Bandpass Filters Bank/BP Bypass", 0, 0, 1, .001)) : SmoothTf;
GlobalBPFrequenciesf = (16 ^ vslider("h:[0]Mixer/h:Bandpass Filters Bank/Frequency [unit:Hz]", 0, -1, 1, .001)) : SmoothTf;
GlobalBPBWf = (vslider("h:[0]Mixer/h:Bandpass Filters Bank/Bandwidth [unit:Hz]", 1, 1, 100, .001)) : SmoothTf;
Interpolations1f = (vslider("h:[0]Mixer/h:Bandpass Filters Bank/Interpolations 1", 1, 0, 1, .001)) : SmoothTf;
Interpolations2f = (vslider("h:[0]Mixer/h:Bandpass Filters Bank/Interpolations 2", 1, 0, 1, .001)) : SmoothTf;
Saturationf = (vslider("h:[0]Mixer/h:Lorenz Equation Parameters/TanH [unit:TanH]", 50, 1, 100, .001)) : SmoothTf;
LorenzFeedbackf = vslider("h:[0]Mixer/h:Lorenz Equation Parameters/Lorenz FB", 1, 0, 1, .001) : SmoothTf;
NetworkFeedbackf = vslider("h:[0]Mixer/h:Feedback Delay Network/Network FB", 1, 0, 1, .001) : SmoothTf;
OutputGainf = ((ba.db2linear(vslider("h:[0]Mixer/h:Input-Output/Master [unit:dB]", -80, -80, 0, .001))) : \(x).( (x > ba.db2linear(-80)) * x )) : SmoothTf;
HPfreqf = (vslider("h:[0]Mixer/h:Input-Output/HP frequency [unit:Hz]", 1, 1, 20000, 1)) : SmoothTf;
LPfreqf = (vslider("h:[0]Mixer/h:Input-Output/LP frequency [unit:Hz]", 20000, 1, 20000, 1)) : SmoothTf;
ExternalInputGainf = ((ba.db2linear(vslider("h:[0]Mixer/h:Input-Output/Externals [unit:dB]", -80, -80, 80, .001))) : \(x).( (x > ba.db2linear(-80)) * x )) : SmoothTf;
MicsOutputf = (Mic1, Mic2, Mic3, Mic4) :> _ / 4;
};
// MODIFIED LORENZ SYSTEM ----------------------------------------
ModifiedLorenzSystem(x0, y0, z0, dt, beta, rho, sigma, bypassFilter, filterPartials, filterOrder, globalFreq, globalAmps, globalBW, interpolation1, interpolation2, saturation, dcBlockzero, dcBlockpole, internalFeedback, i, externalInput) =
(
(
par(i, 3, _ * internalFeedback) :
vgroup("[2]Inspectors", hgroup("Lorenz Feedback", XYZinspect(i))) : LorenzSystemEquations
) :
par(i, 3, _ : dcblocker(dcBlockzero, dcBlockpole)) :
vgroup("[2]Inspectors", hgroup("DC Blocker", XYZinspect(i))) :
par(i, 3, _ : saturator(saturation)) :
vgroup("[2]Inspectors", hgroup("Hyperbolic Tangent", XYZinspect(i))) :
par(i, 3, _ : BandpassFiltersBank(bypassFilter, filterPartials, filterOrder, globalFreq, globalAmps, globalBW, interpolation1, interpolation2)) :
vgroup("[2]Inspectors", hgroup("Bandpass Filters", XYZinspect(i)))
) ~ si.bus(3) :
par(i, 3, / (max(saturation, ma.EPSILON))) :> _ / 3
with {
x_init = x0-x0'; y_init = y0-y0'; z_init = z0-z0';
LorenzSystemEquations(x, y, z) =
(((x + sigma * (y - x) * dt + x_init) + (externalInput))),
(((y + (rho * x - x * z - y) * dt + y_init) + (externalInput))),
(((z + (x * y - beta * z) * dt + z_init) + (externalInput)));
};
// GLOBAL SYSTEM NETWORK ----------------------------------------
GlobalSystemNetwork(dt, beta, rho, sigma, bpFilterBypass, globalBPFrequencies, globalBPBW, interpolations1, interpolations2, saturation, lorenzFeedback, networkFeedbackGain, externalInputGain, networkOutputGain, hpfreqGain, lpfreqGain, micsOutput) =
(
(_ * networkFeedbackGain : NetworkLoop) ~ _ :
(si.block(1), si.bus(NetworkVoices))
) :
par(i, NetworkVoices, _ : HPTPT(hpfreqGain) : LPTPT(lpfreqGain) : normalization(1)) :
par(i, NetworkVoices, _ * networkOutputGain ) :
par(i, NetworkVoices, _ : vgroup("[2]Inspectors", hgroup("Output Channels", Vmeter(i+1, 0, 1)))
)
with{
NetworkLoop(networkFeedback) = par(i, NetworkVoices,
(networkFeedback : (timeVaryingDelay(vslider("h:[0]Mixer/h:Feedback Delay Network/h:Input Delays/Voice_%i+1[2] [unit:Sec]",
(SystemSpaceVarIN * (NetworkVoices - i)), .001, DelSecondsMax, .001), 0) + (micsOutput * externalInputGain)) :
ModifiedLorenzSystem(InitX0, InitY0, InitZ0, dt, beta, rho, sigma, bpFilterBypass, BPFilters, BPFOrder, globalBPFrequencies, 1, globalBPBW, interpolations1, interpolations2, saturation, InitDCBlockzero, InitDCBlockpole, lorenzFeedback, i)
)
) <:
(par( i, NetworkVoices, _ : timeVaryingDelay( vslider("h:[0]Mixer/h:Feedback Delay Network/h:Output Delays/Voice_%i+1[2] [unit:Sec]", SystemSpaceVarOUT * (i + 1), .001, DelSecondsMax, .001) , 0)) :> +/NetworkVoices), (si.bus(NetworkVoices));
};
process = si.bus(8) :> si.bus(4) : RoomInterfaceNetwork : GlobalSystemNetwork; | https://raw.githubusercontent.com/LucaSpanedda/Luca_Spanedda_St_Cecilia_Conservatory_Thesis/b73b60d9e0b45e09bbf72b1477c21202b895f1bb/ITA/codes/RITI_AutonomousNetwork_fixedVersion.dsp | faust | import faust standard library
import RITI objects library
SYSTEM VARIABLES ----------------------------------------
SYSTEM CONTROLS ----------------------------------------
MODIFIED LORENZ SYSTEM ----------------------------------------
GLOBAL SYSTEM NETWORK ----------------------------------------
| import("stdfaust.lib");
import("RITI.lib");
DelSecondsMax = 12;
SystemSpaceVarOUT = 2.8713;
SystemSpaceVarIN = 2.3132;
BPFOrder = 1;
BPFilters = 32;
NetworkVoices = 4;
InitDCBlockzero = 1;
InitDCBlockpole = 0.995;
InitX0 = 1.2;
InitY0 = 1.3;
InitZ0 = 1.6;
RoomInterfaceNetwork(Mic1, Mic2, Mic3, Mic4) = Dtf, Betaf, Rhof, Sigmaf, BPFilterBypassf, GlobalBPFrequenciesf, GlobalBPBWf, Interpolations1f, Interpolations2f, Saturationf, LorenzFeedbackf, NetworkFeedbackf, ExternalInputGainf, OutputGainf, HPfreqf, LPfreqf, MicsOutputf
with {
SmoothTf(x) = onepoletau(vslider("h:[0]Mixer/h:Interpolation/Smooth [unit:Sec]", 1, .001, 10, .001), x);
Dtf = (ba.db2linear(vslider("h:[0]Mixer/h:Lorenz Equation Parameters/Dt [unit:dB]", 0, -60, 60, .001))) : SmoothTf;
Sigmaf = (vslider("h:[0]Mixer/h:Lorenz Equation Parameters/Sigma", 10, 1, 19, .001)) : SmoothTf;
Rhof = (vslider("h:[0]Mixer/h:Lorenz Equation Parameters/Rho", 3.518, 2.8, 53.2, .001)) : SmoothTf;
Betaf = (vslider("h:[0]Mixer/h:Lorenz Equation Parameters/Beta", 1.073, 0.2666, 5.066, .001)) : SmoothTf;
BPFilterBypassf = (vslider("h:[0]Mixer/h:Bandpass Filters Bank/BP Bypass", 0, 0, 1, .001)) : SmoothTf;
GlobalBPFrequenciesf = (16 ^ vslider("h:[0]Mixer/h:Bandpass Filters Bank/Frequency [unit:Hz]", 0, -1, 1, .001)) : SmoothTf;
GlobalBPBWf = (vslider("h:[0]Mixer/h:Bandpass Filters Bank/Bandwidth [unit:Hz]", 1, 1, 100, .001)) : SmoothTf;
Interpolations1f = (vslider("h:[0]Mixer/h:Bandpass Filters Bank/Interpolations 1", 1, 0, 1, .001)) : SmoothTf;
Interpolations2f = (vslider("h:[0]Mixer/h:Bandpass Filters Bank/Interpolations 2", 1, 0, 1, .001)) : SmoothTf;
Saturationf = (vslider("h:[0]Mixer/h:Lorenz Equation Parameters/TanH [unit:TanH]", 50, 1, 100, .001)) : SmoothTf;
LorenzFeedbackf = vslider("h:[0]Mixer/h:Lorenz Equation Parameters/Lorenz FB", 1, 0, 1, .001) : SmoothTf;
NetworkFeedbackf = vslider("h:[0]Mixer/h:Feedback Delay Network/Network FB", 1, 0, 1, .001) : SmoothTf;
OutputGainf = ((ba.db2linear(vslider("h:[0]Mixer/h:Input-Output/Master [unit:dB]", -80, -80, 0, .001))) : \(x).( (x > ba.db2linear(-80)) * x )) : SmoothTf;
HPfreqf = (vslider("h:[0]Mixer/h:Input-Output/HP frequency [unit:Hz]", 1, 1, 20000, 1)) : SmoothTf;
LPfreqf = (vslider("h:[0]Mixer/h:Input-Output/LP frequency [unit:Hz]", 20000, 1, 20000, 1)) : SmoothTf;
ExternalInputGainf = ((ba.db2linear(vslider("h:[0]Mixer/h:Input-Output/Externals [unit:dB]", -80, -80, 80, .001))) : \(x).( (x > ba.db2linear(-80)) * x )) : SmoothTf;
MicsOutputf = (Mic1, Mic2, Mic3, Mic4) :> _ / 4;
};
ModifiedLorenzSystem(x0, y0, z0, dt, beta, rho, sigma, bypassFilter, filterPartials, filterOrder, globalFreq, globalAmps, globalBW, interpolation1, interpolation2, saturation, dcBlockzero, dcBlockpole, internalFeedback, i, externalInput) =
(
(
par(i, 3, _ * internalFeedback) :
vgroup("[2]Inspectors", hgroup("Lorenz Feedback", XYZinspect(i))) : LorenzSystemEquations
) :
par(i, 3, _ : dcblocker(dcBlockzero, dcBlockpole)) :
vgroup("[2]Inspectors", hgroup("DC Blocker", XYZinspect(i))) :
par(i, 3, _ : saturator(saturation)) :
vgroup("[2]Inspectors", hgroup("Hyperbolic Tangent", XYZinspect(i))) :
par(i, 3, _ : BandpassFiltersBank(bypassFilter, filterPartials, filterOrder, globalFreq, globalAmps, globalBW, interpolation1, interpolation2)) :
vgroup("[2]Inspectors", hgroup("Bandpass Filters", XYZinspect(i)))
) ~ si.bus(3) :
par(i, 3, / (max(saturation, ma.EPSILON))) :> _ / 3
with {
x_init = x0-x0'; y_init = y0-y0'; z_init = z0-z0';
LorenzSystemEquations(x, y, z) =
(((x + sigma * (y - x) * dt + x_init) + (externalInput))),
(((y + (rho * x - x * z - y) * dt + y_init) + (externalInput))),
(((z + (x * y - beta * z) * dt + z_init) + (externalInput)));
};
GlobalSystemNetwork(dt, beta, rho, sigma, bpFilterBypass, globalBPFrequencies, globalBPBW, interpolations1, interpolations2, saturation, lorenzFeedback, networkFeedbackGain, externalInputGain, networkOutputGain, hpfreqGain, lpfreqGain, micsOutput) =
(
(_ * networkFeedbackGain : NetworkLoop) ~ _ :
(si.block(1), si.bus(NetworkVoices))
) :
par(i, NetworkVoices, _ : HPTPT(hpfreqGain) : LPTPT(lpfreqGain) : normalization(1)) :
par(i, NetworkVoices, _ * networkOutputGain ) :
par(i, NetworkVoices, _ : vgroup("[2]Inspectors", hgroup("Output Channels", Vmeter(i+1, 0, 1)))
)
with{
NetworkLoop(networkFeedback) = par(i, NetworkVoices,
(networkFeedback : (timeVaryingDelay(vslider("h:[0]Mixer/h:Feedback Delay Network/h:Input Delays/Voice_%i+1[2] [unit:Sec]",
(SystemSpaceVarIN * (NetworkVoices - i)), .001, DelSecondsMax, .001), 0) + (micsOutput * externalInputGain)) :
ModifiedLorenzSystem(InitX0, InitY0, InitZ0, dt, beta, rho, sigma, bpFilterBypass, BPFilters, BPFOrder, globalBPFrequencies, 1, globalBPBW, interpolations1, interpolations2, saturation, InitDCBlockzero, InitDCBlockpole, lorenzFeedback, i)
)
) <:
(par( i, NetworkVoices, _ : timeVaryingDelay( vslider("h:[0]Mixer/h:Feedback Delay Network/h:Output Delays/Voice_%i+1[2] [unit:Sec]", SystemSpaceVarOUT * (i + 1), .001, DelSecondsMax, .001) , 0)) :> +/NetworkVoices), (si.bus(NetworkVoices));
};
process = si.bus(8) :> si.bus(4) : RoomInterfaceNetwork : GlobalSystemNetwork; |
f443e470468e12333b917083fe92380fd0db434a2a2eaa47a5a6c46de4f02652 | LucaSpanedda/RITI-Room-Is-The-Instrument | RITI_AutonomousNetwork_fixedVersion.dsp | // import faust standard library
import("stdfaust.lib");
// import RITI objects library
import("RITI.lib");
// SYSTEM INTERFACE ----------------------------------------
TGroup(x) = tgroup("Main", x);
MixerGroup(x) = hgroup("Mixer", x);
FiltersGroup(x) = hgroup("Bandpass Filters Bank", x);
TFreqsGroup(x) = tgroup("Bank Voices", x);
FreqsGroup(i, x) = hgroup("Voice_%i", x);
FDNGroup(x) = hgroup("Feedback Delay Network", x);
INDelayGroup(x) = hgroup("Input Delays", x);
OUTDelayGroup(x) = hgroup("Output Delays", x);
GainDelayGroup(x) = hgroup("Gains Network", x);
TDelayGroup(x) = tgroup("Delay Times", x);
InsOutsGroup(x) = hgroup("Inputs and Outputs", x);
LorenzFuncGroup(x) = hgroup("Lorenz Equation Parameters", x);
InspectorsGroup(x) = vgroup("Inspectors", x);
// SYSTEM VARIABLES ----------------------------------------
DelSecondsMax = 12;
SystemSpaceVarOUT = 2.8713;
SystemSpaceVarIN = 2.3132;
BPFOrder = 1;
BPFilters = 32;
NetworkVoices = 4;
InitDCBlockzero = 1;
InitDCBlockpole = 0.995;
InitX0 = 1.2;
InitY0 = 1.3;
InitZ0 = 1.6;
Dtf = TGroup((ba.db2linear(MixerGroup(LorenzFuncGroup(vslider("Dt [unit:dB]", 0, -60, 60, .001)))))) : onepoletau(2);
Sigmaf = TGroup((MixerGroup(LorenzFuncGroup(vslider("Sigma", 10, 1, 19, .001))))) : onepoletau(2);
Rhof = TGroup((MixerGroup(LorenzFuncGroup(vslider("Rho", 3.518, 2.8, 53.2, .001))))) : onepoletau(2);
Betaf = TGroup((MixerGroup(LorenzFuncGroup(vslider("Beta", 1.073, 0.2666, 5.066, .001))))) : onepoletau(2);
BPFilterBypassf = TGroup((MixerGroup(FiltersGroup(vslider("BP Bypass", 0, 0, 1, .001))))) : onepoletau(2);
BPFilterDirectf = TGroup((MixerGroup(FiltersGroup(vslider("BP Signal", 1, 0, 1, .001))))) : onepoletau(2);
GlobalBPFrequenciesf(i) = TGroup((16 ^ MixerGroup(FiltersGroup(TFreqsGroup(FreqsGroup(i+1, vslider("Frequency [unit:Hz]", 0, -1, 1, .001))))))) : onepoletau(2);
GlobalBPBWf = TGroup((MixerGroup(FiltersGroup(vslider("Bandwidth [unit:Hz]", 1, 1, 100, .001))))) : onepoletau(2);
ChngList1f(i) = TGroup((MixerGroup(FiltersGroup(TFreqsGroup(FreqsGroup(i+1, nentry("Change List 1", 1, 1, 4, 1)))))));
ChngList2f(i) = TGroup((MixerGroup(FiltersGroup(TFreqsGroup(FreqsGroup(i+1, nentry("Change List 2", 2, 1, 4, 1)))))));
ChngList3f(i) = TGroup((MixerGroup(FiltersGroup(TFreqsGroup(FreqsGroup(i+1, nentry("Change List 3", 3, 1, 4, 1)))))));
ChngList4f(i) = TGroup((MixerGroup(FiltersGroup(TFreqsGroup(FreqsGroup(i+1, nentry("Change List 4", 4, 1, 4, 1)))))));
Interpolations1f(i) = TGroup((MixerGroup(FiltersGroup(TFreqsGroup(FreqsGroup(i+1, vslider("Interpolations A", 0, 0, 1, .001))))))) : onepoletau(2);
Interpolations2f(i) = TGroup((MixerGroup(FiltersGroup(TFreqsGroup(FreqsGroup(i+1, vslider("Interpolations B", 0, 0, 1, .001))))))) : onepoletau(2);
Saturationf = TGroup((MixerGroup(LorenzFuncGroup(vslider("TanH [unit:TanH]", 50, 1, 100, .001))))) : onepoletau(2);
LorenzFeedbackf = TGroup(MixerGroup(LorenzFuncGroup(vslider("Lorenz FB", 1, 0, 1, .001)))) : onepoletau(2);
OutputGainf = TGroup(((ba.db2linear(MixerGroup(InsOutsGroup(vslider("Master [unit:dB]", -80, -80, 0, .001))))) : \(x).( (x > ba.db2linear(-80)) * x ))) : onepoletau(2);
ExternalInputGainf = TGroup(((ba.db2linear(MixerGroup(InsOutsGroup(vslider("Externals [unit:dB]", -80, -80, 80, .001))))) :
\(x).( (x > ba.db2linear(-80)) * x ))) : onepoletau(2);
// MODIFIED LORENZ SYSTEM ----------------------------------------
ModifiedLorenzSystem(x0, y0, z0, dt, beta, rho, sigma, bypassFilter, directFilter, filterPartials, filterOrder, globalFreq, globalAmps, globalBW, interpolation1, interpolation2, changeList1, changeList2, changeList3, changeList4, saturation, dcBlockzero, dcBlockpole, internalFeedback, i, externalInput) =
(
(
par(i, 3, _ * internalFeedback) :
TGroup(InspectorsGroup(hgroup("Lorenz Feedback", XYZinspect(i)))) : LorenzSystemEquations
) :
par(i, 3, _ : dcblocker(dcBlockzero, dcBlockpole)) :
TGroup(InspectorsGroup(hgroup("DC Blocker", XYZinspect(i)))) :
par(i, 3, _ : saturator(saturation)) :
TGroup(InspectorsGroup(hgroup("Hyperbolic Tangent", XYZinspect(i)))) :
par(i, 3, _ : BandpassFiltersBank(bypassFilter, directFilter, filterPartials, filterOrder, globalFreq, globalAmps, globalBW, interpolation1, interpolation2, changeList1, changeList2, changeList3, changeList4)) :
TGroup(InspectorsGroup(hgroup("Bandpass Filters", XYZinspect(i))))
) ~ si.bus(3) :
par(i, 3, / (max(saturation, ma.EPSILON))) :> _ / 3
with {
x_init = x0-x0'; y_init = y0-y0'; z_init = z0-z0';
LorenzSystemEquations(x, y, z) =
((((x + externalInput) + sigma * (y - x) * dt + x_init))),
((((y + externalInput) + (rho * x - x * z - y) * dt + y_init))),
((((z + externalInput) + (x * y - beta * z) * dt + z_init)));
};
// GLOBAL SYSTEM NETWORK ----------------------------------------
GlobalSystemNetwork(Mic1, Mic2, Mic3, Mic4) =
(NetworkLoop ~ _ : (si.block(1), si.bus(NetworkVoices))) :
par(i, NetworkVoices, _ : dcblocker(InitDCBlockzero, InitDCBlockpole) : normalization(1)) :
par(i, NetworkVoices, _ * OutputGainf )
with{
NetworkLoop(networkFeedback) = par(i, NetworkVoices,
(networkFeedback * (TGroup(MixerGroup(FDNGroup(TDelayGroup(GainDelayGroup(vslider("Voice_%i+1[2]", 1, 0, 1, .001))))))) :
(timeVaryingDelay(TGroup(MixerGroup(FDNGroup(TDelayGroup(INDelayGroup(vslider("Voice_%i+1[2] [unit:Sec]",
(SystemSpaceVarIN * (NetworkVoices - i)), .001, DelSecondsMax, .001)))))), 0) + (((Mic1,Mic2,Mic3,Mic4) :> _ / 4) * ExternalInputGainf)) :
ModifiedLorenzSystem(InitX0, InitY0, InitZ0, Dtf, Betaf, Rhof, Sigmaf, BPFilterBypassf, BPFilterDirectf, BPFilters, BPFOrder,
GlobalBPFrequenciesf(i), 1, GlobalBPBWf, Interpolations1f(i), Interpolations2f(i), ChngList1f(i), ChngList2f(i), ChngList3f(i), ChngList4f(i), Saturationf, InitDCBlockzero, InitDCBlockpole, LorenzFeedbackf, i)
)
) <:
(par( i, NetworkVoices, _ : timeVaryingDelay(TGroup(MixerGroup(FDNGroup(TDelayGroup(OUTDelayGroup(vslider("Voice_%i+1[2] [unit:Sec]", SystemSpaceVarOUT * (i + 1), .001, DelSecondsMax, .001)))))) , 0)) :> +/NetworkVoices), (si.bus(NetworkVoices));
};
process = si.bus(8) :> si.bus(4) : GlobalSystemNetwork; | https://raw.githubusercontent.com/LucaSpanedda/RITI-Room-Is-The-Instrument/d8014a009772cb1a5a8580dcf5bd8e24bf65a11e/RITI_v1_CelloResponse/RITI_v1_CelloA3/RITI_AutonomousNetwork_fixedVersion.dsp | faust | import faust standard library
import RITI objects library
SYSTEM INTERFACE ----------------------------------------
SYSTEM VARIABLES ----------------------------------------
MODIFIED LORENZ SYSTEM ----------------------------------------
GLOBAL SYSTEM NETWORK ----------------------------------------
| import("stdfaust.lib");
import("RITI.lib");
TGroup(x) = tgroup("Main", x);
MixerGroup(x) = hgroup("Mixer", x);
FiltersGroup(x) = hgroup("Bandpass Filters Bank", x);
TFreqsGroup(x) = tgroup("Bank Voices", x);
FreqsGroup(i, x) = hgroup("Voice_%i", x);
FDNGroup(x) = hgroup("Feedback Delay Network", x);
INDelayGroup(x) = hgroup("Input Delays", x);
OUTDelayGroup(x) = hgroup("Output Delays", x);
GainDelayGroup(x) = hgroup("Gains Network", x);
TDelayGroup(x) = tgroup("Delay Times", x);
InsOutsGroup(x) = hgroup("Inputs and Outputs", x);
LorenzFuncGroup(x) = hgroup("Lorenz Equation Parameters", x);
InspectorsGroup(x) = vgroup("Inspectors", x);
DelSecondsMax = 12;
SystemSpaceVarOUT = 2.8713;
SystemSpaceVarIN = 2.3132;
BPFOrder = 1;
BPFilters = 32;
NetworkVoices = 4;
InitDCBlockzero = 1;
InitDCBlockpole = 0.995;
InitX0 = 1.2;
InitY0 = 1.3;
InitZ0 = 1.6;
Dtf = TGroup((ba.db2linear(MixerGroup(LorenzFuncGroup(vslider("Dt [unit:dB]", 0, -60, 60, .001)))))) : onepoletau(2);
Sigmaf = TGroup((MixerGroup(LorenzFuncGroup(vslider("Sigma", 10, 1, 19, .001))))) : onepoletau(2);
Rhof = TGroup((MixerGroup(LorenzFuncGroup(vslider("Rho", 3.518, 2.8, 53.2, .001))))) : onepoletau(2);
Betaf = TGroup((MixerGroup(LorenzFuncGroup(vslider("Beta", 1.073, 0.2666, 5.066, .001))))) : onepoletau(2);
BPFilterBypassf = TGroup((MixerGroup(FiltersGroup(vslider("BP Bypass", 0, 0, 1, .001))))) : onepoletau(2);
BPFilterDirectf = TGroup((MixerGroup(FiltersGroup(vslider("BP Signal", 1, 0, 1, .001))))) : onepoletau(2);
GlobalBPFrequenciesf(i) = TGroup((16 ^ MixerGroup(FiltersGroup(TFreqsGroup(FreqsGroup(i+1, vslider("Frequency [unit:Hz]", 0, -1, 1, .001))))))) : onepoletau(2);
GlobalBPBWf = TGroup((MixerGroup(FiltersGroup(vslider("Bandwidth [unit:Hz]", 1, 1, 100, .001))))) : onepoletau(2);
ChngList1f(i) = TGroup((MixerGroup(FiltersGroup(TFreqsGroup(FreqsGroup(i+1, nentry("Change List 1", 1, 1, 4, 1)))))));
ChngList2f(i) = TGroup((MixerGroup(FiltersGroup(TFreqsGroup(FreqsGroup(i+1, nentry("Change List 2", 2, 1, 4, 1)))))));
ChngList3f(i) = TGroup((MixerGroup(FiltersGroup(TFreqsGroup(FreqsGroup(i+1, nentry("Change List 3", 3, 1, 4, 1)))))));
ChngList4f(i) = TGroup((MixerGroup(FiltersGroup(TFreqsGroup(FreqsGroup(i+1, nentry("Change List 4", 4, 1, 4, 1)))))));
Interpolations1f(i) = TGroup((MixerGroup(FiltersGroup(TFreqsGroup(FreqsGroup(i+1, vslider("Interpolations A", 0, 0, 1, .001))))))) : onepoletau(2);
Interpolations2f(i) = TGroup((MixerGroup(FiltersGroup(TFreqsGroup(FreqsGroup(i+1, vslider("Interpolations B", 0, 0, 1, .001))))))) : onepoletau(2);
Saturationf = TGroup((MixerGroup(LorenzFuncGroup(vslider("TanH [unit:TanH]", 50, 1, 100, .001))))) : onepoletau(2);
LorenzFeedbackf = TGroup(MixerGroup(LorenzFuncGroup(vslider("Lorenz FB", 1, 0, 1, .001)))) : onepoletau(2);
OutputGainf = TGroup(((ba.db2linear(MixerGroup(InsOutsGroup(vslider("Master [unit:dB]", -80, -80, 0, .001))))) : \(x).( (x > ba.db2linear(-80)) * x ))) : onepoletau(2);
ExternalInputGainf = TGroup(((ba.db2linear(MixerGroup(InsOutsGroup(vslider("Externals [unit:dB]", -80, -80, 80, .001))))) :
\(x).( (x > ba.db2linear(-80)) * x ))) : onepoletau(2);
ModifiedLorenzSystem(x0, y0, z0, dt, beta, rho, sigma, bypassFilter, directFilter, filterPartials, filterOrder, globalFreq, globalAmps, globalBW, interpolation1, interpolation2, changeList1, changeList2, changeList3, changeList4, saturation, dcBlockzero, dcBlockpole, internalFeedback, i, externalInput) =
(
(
par(i, 3, _ * internalFeedback) :
TGroup(InspectorsGroup(hgroup("Lorenz Feedback", XYZinspect(i)))) : LorenzSystemEquations
) :
par(i, 3, _ : dcblocker(dcBlockzero, dcBlockpole)) :
TGroup(InspectorsGroup(hgroup("DC Blocker", XYZinspect(i)))) :
par(i, 3, _ : saturator(saturation)) :
TGroup(InspectorsGroup(hgroup("Hyperbolic Tangent", XYZinspect(i)))) :
par(i, 3, _ : BandpassFiltersBank(bypassFilter, directFilter, filterPartials, filterOrder, globalFreq, globalAmps, globalBW, interpolation1, interpolation2, changeList1, changeList2, changeList3, changeList4)) :
TGroup(InspectorsGroup(hgroup("Bandpass Filters", XYZinspect(i))))
) ~ si.bus(3) :
par(i, 3, / (max(saturation, ma.EPSILON))) :> _ / 3
with {
x_init = x0-x0'; y_init = y0-y0'; z_init = z0-z0';
LorenzSystemEquations(x, y, z) =
((((x + externalInput) + sigma * (y - x) * dt + x_init))),
((((y + externalInput) + (rho * x - x * z - y) * dt + y_init))),
((((z + externalInput) + (x * y - beta * z) * dt + z_init)));
};
GlobalSystemNetwork(Mic1, Mic2, Mic3, Mic4) =
(NetworkLoop ~ _ : (si.block(1), si.bus(NetworkVoices))) :
par(i, NetworkVoices, _ : dcblocker(InitDCBlockzero, InitDCBlockpole) : normalization(1)) :
par(i, NetworkVoices, _ * OutputGainf )
with{
NetworkLoop(networkFeedback) = par(i, NetworkVoices,
(networkFeedback * (TGroup(MixerGroup(FDNGroup(TDelayGroup(GainDelayGroup(vslider("Voice_%i+1[2]", 1, 0, 1, .001))))))) :
(timeVaryingDelay(TGroup(MixerGroup(FDNGroup(TDelayGroup(INDelayGroup(vslider("Voice_%i+1[2] [unit:Sec]",
(SystemSpaceVarIN * (NetworkVoices - i)), .001, DelSecondsMax, .001)))))), 0) + (((Mic1,Mic2,Mic3,Mic4) :> _ / 4) * ExternalInputGainf)) :
ModifiedLorenzSystem(InitX0, InitY0, InitZ0, Dtf, Betaf, Rhof, Sigmaf, BPFilterBypassf, BPFilterDirectf, BPFilters, BPFOrder,
GlobalBPFrequenciesf(i), 1, GlobalBPBWf, Interpolations1f(i), Interpolations2f(i), ChngList1f(i), ChngList2f(i), ChngList3f(i), ChngList4f(i), Saturationf, InitDCBlockzero, InitDCBlockpole, LorenzFeedbackf, i)
)
) <:
(par( i, NetworkVoices, _ : timeVaryingDelay(TGroup(MixerGroup(FDNGroup(TDelayGroup(OUTDelayGroup(vslider("Voice_%i+1[2] [unit:Sec]", SystemSpaceVarOUT * (i + 1), .001, DelSecondsMax, .001)))))) , 0)) :> +/NetworkVoices), (si.bus(NetworkVoices));
};
process = si.bus(8) :> si.bus(4) : GlobalSystemNetwork; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.