Difference between revisions of "FaustWorkshop2014-CostaRica"
(Created page with 'For any question/comment, please contact Romain Michon (rmichon_at_ccrma_dot_stanford_dot_edu).') |
|||
Line 1: | Line 1: | ||
For any question/comment, please contact Romain Michon (rmichon_at_ccrma_dot_stanford_dot_edu). | For any question/comment, please contact Romain Michon (rmichon_at_ccrma_dot_stanford_dot_edu). | ||
+ | |||
+ | == Day 1 == | ||
+ | |||
+ | Optional textbook to go further: http://www.amazon.com/Physical-Audio-Signal-Processing-Instruments/dp/0974560723 | ||
+ | |||
+ | ==== Simple Gain Controller ==== | ||
+ | |||
+ | <pre style="white-space: pre-wrap; | ||
+ | white-space: -moz-pre-wrap; | ||
+ | white-space: -pre-wrap; | ||
+ | white-space: -o-pre-wrap; | ||
+ | word-wrap: break-word;"> | ||
+ | import("filter.lib"); | ||
+ | |||
+ | process = *(hslider("gain",0.5,0,1,0.01)) : smooth(0.999); | ||
+ | </pre> | ||
+ | |||
+ | ==== Simple Sine Oscillator Synthesizer ==== | ||
+ | |||
+ | <pre style="white-space: pre-wrap; | ||
+ | white-space: -moz-pre-wrap; | ||
+ | white-space: -pre-wrap; | ||
+ | white-space: -o-pre-wrap; | ||
+ | word-wrap: break-word;"> | ||
+ | import("music.lib"); | ||
+ | import("filter.lib"); | ||
+ | |||
+ | g = hslider("myParameter",0,0,1,0.01); | ||
+ | freq = hslider("frequency",440,50,1000,0.1); | ||
+ | |||
+ | myOsc(frequency,gain) = osc(frequency)*(smoothGain) | ||
+ | with{ | ||
+ | // the smooth(0.999) function interpolates the different values of gain so that it doesn't click | ||
+ | smoothGain = gain : smooth(0.999); | ||
+ | }; | ||
+ | |||
+ | process = myOsc(freq,g) ; | ||
+ | </pre> | ||
+ | |||
+ | ==== Working with Signals ==== | ||
+ | |||
+ | <code> | ||
+ | process = _ <: _,_,_,_ :> _; | ||
+ | </code> | ||
+ | |||
+ | is the same as: | ||
+ | |||
+ | <code> | ||
+ | process = _ <: _+_+_+_; | ||
+ | </code> | ||
+ | |||
+ | ==== Simple Panner ==== | ||
+ | |||
+ | <pre style="white-space: pre-wrap; | ||
+ | white-space: -moz-pre-wrap; | ||
+ | white-space: -pre-wrap; | ||
+ | white-space: -o-pre-wrap; | ||
+ | word-wrap: break-word;"> | ||
+ | import("filter.lib"); | ||
+ | |||
+ | // the metadata "[style:knob]" turns the horizontal slider into a knob | ||
+ | pan = hslider("pan [style:knob]",0.5,0,1,0.01) : smooth(0.999); | ||
+ | |||
+ | process = _ <: *(pan),*(1-pan); | ||
+ | </pre> | ||
+ | |||
+ | ==== Additive Synthesizer ==== | ||
+ | |||
+ | <pre style="white-space: pre-wrap; | ||
+ | white-space: -moz-pre-wrap; | ||
+ | white-space: -pre-wrap; | ||
+ | white-space: -o-pre-wrap; | ||
+ | word-wrap: break-word;"> | ||
+ | import("music.lib"); | ||
+ | import("effect.lib"); | ||
+ | |||
+ | gain = hslider("gain",0,0,1,0.01) : smooth(0.999); | ||
+ | freq = hslider("freq",440,50,1000,0.1) : smooth(0.999); | ||
+ | // the smooth function can be used as a simple envelope generator for gate | ||
+ | gate = button("gate") : smooth(0.999); | ||
+ | |||
+ | process = osc(freq),osc(freq*2),osc(freq*3) :> *(gain)*gate <: _,_; | ||
+ | </pre> | ||
+ | |||
+ | The last line of the code can be replaced by: | ||
+ | |||
+ | <code> | ||
+ | process = par(i,3,osc(freq*(i+1))) :> *(gain)*gate <: _,_; | ||
+ | </code> | ||
+ | |||
+ | or | ||
+ | |||
+ | <code> | ||
+ | process = sum(i,3,osc(freq*(i+1))) : *(gain)*gate <: _,_; | ||
+ | </code> | ||
+ | |||
+ | === Wave Shape Synthesis === | ||
+ | |||
+ | <pre style="white-space: pre-wrap; | ||
+ | white-space: -moz-pre-wrap; | ||
+ | white-space: -pre-wrap; | ||
+ | white-space: -o-pre-wrap; | ||
+ | word-wrap: break-word;"> | ||
+ | saw1(freq) // Sawtooth wave | ||
+ | lf_imptrain(freq) // Impulse train | ||
+ | lf_squarewave(freq) // Square wave | ||
+ | </pre> | ||
+ | |||
+ | = Day 2 = | ||
+ | |||
+ | === Tremolo and Ring Modulation === | ||
+ | |||
+ | https://ccrma.stanford.edu/~jos/rbeats/Sinusoidal_Amplitude_Modulation_AM.html | ||
+ | |||
+ | <pre style="white-space: pre-wrap; | ||
+ | white-space: -moz-pre-wrap; | ||
+ | white-space: -pre-wrap; | ||
+ | white-space: -o-pre-wrap; | ||
+ | word-wrap: break-word;"> | ||
+ | import("filter.lib"); | ||
+ | |||
+ | freq = hslider("freq",2,1,500,0.01); | ||
+ | gain = hslider("gain",1,0,1,0.01) : smooth(0.999); | ||
+ | depth = hslider("depth",0,0,1,0.01) : smooth(0.999); | ||
+ | |||
+ | ringMod = *(1-(depth*osc(freq)/2 + 0.5)); | ||
+ | |||
+ | process = ringMod*gain <: _,_; | ||
+ | </pre> | ||
+ | |||
+ | === Stereo Ring Modulator === | ||
+ | |||
+ | <pre style="white-space: pre-wrap; | ||
+ | white-space: -moz-pre-wrap; | ||
+ | white-space: -pre-wrap; | ||
+ | white-space: -o-pre-wrap; | ||
+ | word-wrap: break-word;"> | ||
+ | import("filter.lib"); | ||
+ | |||
+ | freq = hslider("freq",2,1,500,0.01); | ||
+ | gain = hslider("gain",1,0,1,0.01) : smooth(0.999); | ||
+ | depth = hslider("depth",0,0,1,0.01) : smooth(0.999); | ||
+ | |||
+ | pan = 1-(depth*osc(freq)/2 + 0.5); | ||
+ | stereoRingMod = _ <: *(pan),*(1-pan); | ||
+ | |||
+ | process = stereoRingMod : *(gain), *(gain); | ||
+ | </pre> | ||
+ | |||
+ | === Delay === | ||
+ | |||
+ | One sample delay: | ||
+ | |||
+ | <code> | ||
+ | _'; | ||
+ | </code> | ||
+ | |||
+ | N samples delay: | ||
+ | |||
+ | <code> | ||
+ | _@N; | ||
+ | </code> | ||
+ | |||
+ | Fractional delay: | ||
+ | |||
+ | <code> | ||
+ | fdelay1(MaxDelayLength, delayLength) | ||
+ | </code> | ||
+ | |||
+ | === The Simplest Lowpass/Highpass Filter === | ||
+ | |||
+ | https://ccrma.stanford.edu/~jos/filters/One_Zero.html | ||
+ | |||
+ | <pre style="white-space: pre-wrap; | ||
+ | white-space: -moz-pre-wrap; | ||
+ | white-space: -pre-wrap; | ||
+ | white-space: -o-pre-wrap; | ||
+ | word-wrap: break-word;"> | ||
+ | import("filter.lib"); | ||
+ | import("music.lib"); | ||
+ | |||
+ | b1 = hslider("feedforward",0,-1,1,0.01) : smooth(0.999); | ||
+ | filter = _ <: _+(_' : *(b1)) : *(0.5); | ||
+ | process = noise : filter; | ||
+ | </pre> | ||
+ | |||
+ | === Feedforward Comb Filter === | ||
+ | |||
+ | https://ccrma.stanford.edu/~jos/pasp/Feedforward_Comb_Filters.html | ||
+ | |||
+ | <pre style="white-space: pre-wrap; | ||
+ | white-space: -moz-pre-wrap; | ||
+ | white-space: -pre-wrap; | ||
+ | white-space: -o-pre-wrap; | ||
+ | word-wrap: break-word;"> | ||
+ | import("filter.lib"); | ||
+ | import("music.lib"); | ||
+ | |||
+ | b = hslider("feedforward",0,-1,1,0.01) : smooth(0.999); | ||
+ | del = hslider("del",1,1,100,1); | ||
+ | filter = _ <: _+(_@del : *(b)) : *(0.5); | ||
+ | process = noise : filter; | ||
+ | </pre> | ||
+ | |||
+ | === Flanger === | ||
+ | |||
+ | https://ccrma.stanford.edu/~jos/pasp/Flanging.html | ||
+ | |||
+ | ===== Workshop Version ===== | ||
+ | |||
+ | <pre style="white-space: pre-wrap; | ||
+ | white-space: -moz-pre-wrap; | ||
+ | white-space: -pre-wrap; | ||
+ | white-space: -o-pre-wrap; | ||
+ | word-wrap: break-word;"> | ||
+ | import("music.lib"); | ||
+ | import("filter.lib"); | ||
+ | |||
+ | flangeDelay = hslider("flangeDelay",0.05,0.001,1,0.001)*SR*0.001; | ||
+ | depth = hslider("depth",0.5,-1,1,0.01) : smooth(0.999); | ||
+ | speed = hslider("speed",0.5,0.1,20,0.01); | ||
+ | gain = hslider("gain",0.8,0,1,0.01) : smooth(0.999); | ||
+ | |||
+ | myFlanger = _ <: _,fdelay1(1024,delayLength)*depth : + : *(0.5) | ||
+ | with{ | ||
+ | delayLength = flangeDelay*(1 + osc(speed))/2; | ||
+ | }; | ||
+ | |||
+ | process = myFlanger*gain; | ||
+ | </pre> |
Revision as of 15:18, 30 September 2014
For any question/comment, please contact Romain Michon (rmichon_at_ccrma_dot_stanford_dot_edu).
Day 1
Optional textbook to go further: http://www.amazon.com/Physical-Audio-Signal-Processing-Instruments/dp/0974560723
Simple Gain Controller
import("filter.lib"); process = *(hslider("gain",0.5,0,1,0.01)) : smooth(0.999);
Simple Sine Oscillator Synthesizer
import("music.lib"); import("filter.lib"); g = hslider("myParameter",0,0,1,0.01); freq = hslider("frequency",440,50,1000,0.1); myOsc(frequency,gain) = osc(frequency)*(smoothGain) with{ // the smooth(0.999) function interpolates the different values of gain so that it doesn't click smoothGain = gain : smooth(0.999); }; process = myOsc(freq,g) ;
Working with Signals
process = _ <: _,_,_,_ :> _;
is the same as:
process = _ <: _+_+_+_;
Simple Panner
import("filter.lib"); // the metadata "[style:knob]" turns the horizontal slider into a knob pan = hslider("pan [style:knob]",0.5,0,1,0.01) : smooth(0.999); process = _ <: *(pan),*(1-pan);
Additive Synthesizer
import("music.lib"); import("effect.lib"); gain = hslider("gain",0,0,1,0.01) : smooth(0.999); freq = hslider("freq",440,50,1000,0.1) : smooth(0.999); // the smooth function can be used as a simple envelope generator for gate gate = button("gate") : smooth(0.999); process = osc(freq),osc(freq*2),osc(freq*3) :> *(gain)*gate <: _,_;
The last line of the code can be replaced by:
process = par(i,3,osc(freq*(i+1))) :> *(gain)*gate <: _,_;
or
process = sum(i,3,osc(freq*(i+1))) : *(gain)*gate <: _,_;
Wave Shape Synthesis
saw1(freq) // Sawtooth wave lf_imptrain(freq) // Impulse train lf_squarewave(freq) // Square wave
Day 2
Tremolo and Ring Modulation
https://ccrma.stanford.edu/~jos/rbeats/Sinusoidal_Amplitude_Modulation_AM.html
import("filter.lib"); freq = hslider("freq",2,1,500,0.01); gain = hslider("gain",1,0,1,0.01) : smooth(0.999); depth = hslider("depth",0,0,1,0.01) : smooth(0.999); ringMod = *(1-(depth*osc(freq)/2 + 0.5)); process = ringMod*gain <: _,_;
Stereo Ring Modulator
import("filter.lib"); freq = hslider("freq",2,1,500,0.01); gain = hslider("gain",1,0,1,0.01) : smooth(0.999); depth = hslider("depth",0,0,1,0.01) : smooth(0.999); pan = 1-(depth*osc(freq)/2 + 0.5); stereoRingMod = _ <: *(pan),*(1-pan); process = stereoRingMod : *(gain), *(gain);
Delay
One sample delay:
_';
N samples delay:
_@N;
Fractional delay:
fdelay1(MaxDelayLength, delayLength)
The Simplest Lowpass/Highpass Filter
https://ccrma.stanford.edu/~jos/filters/One_Zero.html
import("filter.lib"); import("music.lib"); b1 = hslider("feedforward",0,-1,1,0.01) : smooth(0.999); filter = _ <: _+(_' : *(b1)) : *(0.5); process = noise : filter;
Feedforward Comb Filter
https://ccrma.stanford.edu/~jos/pasp/Feedforward_Comb_Filters.html
import("filter.lib"); import("music.lib"); b = hslider("feedforward",0,-1,1,0.01) : smooth(0.999); del = hslider("del",1,1,100,1); filter = _ <: _+(_@del : *(b)) : *(0.5); process = noise : filter;
Flanger
https://ccrma.stanford.edu/~jos/pasp/Flanging.html
Workshop Version
import("music.lib"); import("filter.lib"); flangeDelay = hslider("flangeDelay",0.05,0.001,1,0.001)*SR*0.001; depth = hslider("depth",0.5,-1,1,0.01) : smooth(0.999); speed = hslider("speed",0.5,0.1,20,0.01); gain = hslider("gain",0.8,0,1,0.01) : smooth(0.999); myFlanger = _ <: _,fdelay1(1024,delayLength)*depth : + : *(0.5) with{ delayLength = flangeDelay*(1 + osc(speed))/2; }; process = myFlanger*gain;