bounds(0, 0, 0, 0)
form caption("FM Test") size(1160, 570), colour("black"), pluginid("def1")
keyboard bounds(33, 440, 1096, 100)
groupbox bounds(34, 18, 260, 190), text("Op1 LF0") colour(0, 0, 0, 255) outlinecolour("purple")
{
rslider bounds(2, 20, 60, 80), channel("LFO1Waveshape"), range(0, 3, 0, 1, 1), text("Shape") valuetextbox(1) trackercolour("green"), colour(0,0,0,0), outlinecolour(0,0,0,0)
rslider bounds(64, 20, 60, 80), channel("LFO1depth"), range(0, 1500, 0, 1, 0.01), text("Depth") valuetextbox(1) trackercolour("green"), colour(0,0,0,0), outlinecolour(0,0,0,0)
rslider bounds(128, 20, 60, 80), channel("LFO1rate"), range(0, 50, 0, 1, 1), text("Rate") valuetextbox(1) trackercolour("green"), colour(0,0,0,0), outlinecolour(0,0,0,0)
rslider bounds(194, 20, 60, 80), channel("LFO1Sync"), range(0, 16, 0, 1, 1), text("Sync") valuetextbox(1) trackercolour("green"), colour(0,0,0,0), outlinecolour(0,0,0,0)
rslider bounds(2, 103, 60, 80), channel("LFO1depthAttack"), range(1e-05, 16, 0.0001, 1, 0.001), text("A") valuetextbox(1) trackercolour("green"), colour(0,0,0,0), outlinecolour(0,0,0,0)
rslider bounds(64, 103, 60, 80), channel("LFO1depthDecay"), range(1e-06, 16, 0, 1, 0.001), text("D") valuetextbox(1) trackercolour("green"), colour(0,0,0,0), outlinecolour(0,0,0,0)
rslider bounds(128, 103, 60, 80), channel("LFO1depthSustain"), range(1e-06, 16, 0.0001, 1, 0.001), text("S") valuetextbox(1) trackercolour("green"), colour(0,0,0,0), outlinecolour(0,0,0,0)
rslider bounds(194, 103, 60, 80), channel("LFO1depthRelease"), range(1e-06, 16, 0.0001, 1, 0.001), text("R") valuetextbox(1) trackercolour("green"), colour(0,0,0,0), outlinecolour(0,0,0,0)
}
groupbox bounds(34, 226, 260, 190), text("Operator 1") colour(0, 0, 0, 255) outlinecolour("purple")
{
rslider bounds(2, 20, 60, 80), channel("Op1WaveShape"), text("Shape") range(0, 3, 0, 1, 1) valuetextbox(1), trackercolour("green"), colour(0,0,0,0), outlinecolour(0,0,0,0)
rslider bounds(64, 20, 60, 80), channel("ModAmp1"), range(0, 1500, 0, 1, 0.01), text("Index") valuetextbox(1), trackercolour("green"), colour(0,0,0,0), outlinecolour(0,0,0,0)
rslider bounds(128, 20, 60, 80), channel("ModRatio1"), range(1, 10, 1, 1, 1), text("Ratio"), valuetextbox(1), trackercolour("green"), colour(0,0,0,0), outlinecolour(0,0,0,0)
rslider bounds(194, 20, 60, 80), channel("Op1OffsetHz"), range(-1000, 1000, 0, 1, 0.01), text("Offset"), valuetextbox(1) trackercolour("green"), colour(0,0,0,0), outlinecolour(0,0,0,0)
rslider bounds(2, 103, 60, 80), channel("ModAmp1attack"), text("A"), range(1e-05, 16, 0.0001, 1, 0.001) valuetextbox(1), trackercolour("green"), colour(0,0,0,0), outlinecolour(0,0,0,0)
rslider bounds(64, 103, 60, 80), channel("ModAmp1decay"), text("D"), range(1e-06, 16, 0.0001, 1, 0.001) valuetextbox(1), trackercolour("green"), colour(0,0,0,0), outlinecolour(0,0,0,0)
rslider bounds(128, 103, 60, 80), channel("ModAmp1sustain"), text("S"), range(1e-06, 16, 0.0001, 1, 0.001) valuetextbox(1), trackercolour("green"), colour(0,0,0,0), outlinecolour(0,0,0,0)
rslider bounds(194, 103, 60, 80), channel("ModAmp1release"), text("R"), range(1e-06, 16, 0.0001, 1, 0.001) valuetextbox(1), trackercolour("green"), colour(0,0,0,0), outlinecolour(0,0,0,0)
}
groupbox bounds(312, 18, 260, 190), text("Op2 LF0") colour(0, 0, 0, 255) outlinecolour("purple")
{
rslider bounds(2, 20, 60, 80), channel("LFO2Waveshape"), range(0, 3, 0, 1, 1), text("Shape") valuetextbox(1), trackercolour("green"), colour(0,0,0,0), outlinecolour(0,0,0,0)
rslider bounds(64, 20, 60, 80), channel("LFO2depth"), range(0, 1500, 0, 1, 0.01), text("Depth") valuetextbox(1), trackercolour("green"), colour(0,0,0,0), outlinecolour(0,0,0,0)
rslider bounds(128, 20, 60, 80), channel("LFO2rate"), range(0, 50, 0, 1, 1), text("Rate") valuetextbox(1), trackercolour("green"), colour(0,0,0,0), outlinecolour(0,0,0,0)
rslider bounds(194, 20, 60, 80), channel("LFO2Sync"), range(0, 16, 0, 1, 1), text("Sync") valuetextbox(1), trackercolour("green"), colour(0,0,0,0), outlinecolour(0,0,0,0)
rslider bounds(2, 103, 60, 80), channel("LFO2depthAttack"), range(1e-05, 16, 0.0001, 1, 0.001), text("A") valuetextbox(1), trackercolour("green"), colour(0,0,0,0), outlinecolour(0,0,0,0)
rslider bounds(64, 103, 60, 80), channel("LFO2depthDecay"), range(1e-06, 16, 0, 1, 0.001), text("D") valuetextbox(1) trackercolour("green"), colour(0,0,0,0), outlinecolour(0,0,0,0)
rslider bounds(128, 103, 60, 80), channel("LFO2depthSustain"), range(1e-06, 16, 0.0001, 1, 0.001), text("S") valuetextbox(1), trackercolour("green"), colour(0,0,0,0), outlinecolour(0,0,0,0)
rslider bounds(194, 103, 60, 80), channel("LFO2depthRelease"), range(1e-06, 16, 0.0001, 1, 0.001), text("R") valuetextbox(1), trackercolour("green"), colour(0,0,0,0), outlinecolour(0,0,0,0)
}
groupbox bounds(312, 226, 260, 190), text("Operator 2") colour(0, 0, 0, 255) outlinecolour("purple")
{
rslider bounds(2, 20, 60, 80), channel("Op2WaveShape"), text("Shape") range(0, 3, 0, 1, 1) valuetextbox(1), trackercolour("green"), colour(0,0,0,0), outlinecolour(0,0,0,0)
rslider bounds(64, 20, 60, 80), channel("ModAmp2"), range(0, 1500, 0, 1, 0.001), text("Index") valuetextbox(1), trackercolour("green"), colour(0,0,0,0), outlinecolour(0,0,0,0)
rslider bounds(128, 20, 60, 80), channel("ModRatio2"), range(1, 10, 1, 1, 1), text("Ratio"), valuetextbox(1), trackercolour("green"), colour(0,0,0,0), outlinecolour(0,0,0,0)
rslider bounds(194, 20, 60, 80), channel("Op2OffsetHz"), range(-1000, 1000, 0, 1, 0.01), text("Offset") valuetextbox(1), trackercolour("green"), colour(0,0,0,0), outlinecolour(0,0,0,0)
rslider bounds(2, 103, 60, 80), channel("ModAmp2attack"), text("A"), range(1e-06, 16, 0.0001, 1, 0.001) valuetextbox(1) trackercolour("green"), colour(0,0,0,0), outlinecolour(0,0,0,0)
rslider bounds(64, 103, 60, 80), channel("ModAmp2decay"), text("D"), range(1e-06, 16, 0.0001, 1, 0.001) valuetextbox(1) trackercolour("green"), colour(0,0,0,0), outlinecolour(0,0,0,0)
rslider bounds(128, 103, 60, 80), channel("ModAmp2sustain"), text("S"), range(1e-06, 16, 0.0001, 1, 0.001) valuetextbox(1) trackercolour("green"), colour(0,0,0,0), outlinecolour(0,0,0,0)
rslider bounds(194, 103, 60, 80), channel("ModAmp2release"), text("R"), range(1e-06, 16, 0.0001, 1, 0.001) valuetextbox(1) trackercolour("green"), colour(0,0,0,0), outlinecolour(0,0,0,0)
}
groupbox bounds(590, 18, 260, 190), text("Op3 LF0") colour(0, 0, 0, 255) outlinecolour("purple")
{
rslider bounds(2, 20, 60, 80), channel("LFO3Waveshape"), range(0, 3, 0, 1, 1), text("Shape") valuetextbox(1), trackercolour("green"), colour(0,0,0,0), outlinecolour(0,0,0,0)
rslider bounds(64, 20, 60, 80), channel("LFO3depth"), range(0, 1500, 0, 1, 0.01), text("Depth") valuetextbox(1), trackercolour("green"), colour(0,0,0,0), outlinecolour(0,0,0,0)
rslider bounds(128, 20, 60, 80), channel("LFO3rate"), range(0, 50, 0, 1, 1), text("Rate") valuetextbox(1), trackercolour("green"), colour(0,0,0,0), outlinecolour(0,0,0,0)
rslider bounds(194, 20, 60, 80), channel("LFO3Sync"), range(0, 16, 0, 1, 1), text("Sync") valuetextbox(1), trackercolour("green"), colour(0,0,0,0), outlinecolour(0,0,0,0)
rslider bounds(2, 103, 53, 80), channel("LFO3depthAttack"), range(1e-05, 16, 0.0001, 1, 0.001), text("A") valuetextbox(1), trackercolour("green"), colour(0,0,0,0), outlinecolour(0,0,0,0)
rslider bounds(64, 103, 60, 80), channel("LFO3depthDecay"), range(1e-06, 16, 0, 1, 0.001), text("D") valuetextbox(1) trackercolour("green"), colour(0,0,0,0), outlinecolour(0,0,0,0)
rslider bounds(128, 103, 53, 80), channel("LFO3depthSustain"), range(1e-06, 16, 0.0001, 1, 0.001), text("S") valuetextbox(1), trackercolour("green"), colour(0,0,0,0), outlinecolour(0,0,0,0)
rslider bounds(194, 103, 53, 80), channel("LFO3depthRelease"), range(1e-06, 16, 0.0001, 1, 0.001), text("R") valuetextbox(1), trackercolour("green"), colour(0,0,0,0), outlinecolour(0,0,0,0)
}
groupbox bounds(590, 226, 260, 190), text("Operator 3") colour(0, 0, 0, 255) outlinecolour("purple")
{
rslider bounds(2, 20, 60, 80), channel("Op3WaveShape"), text("Shape") range(0, 3, 0, 1, 1) valuetextbox(1) trackercolour("green"), colour(0,0,0,0), outlinecolour(0,0,0,0)
rslider bounds(64, 20, 60, 80), channel("ModAmp3"), range(0, 1500, 0.0001, 1, 0.001), text("Index") valuetextbox(1) trackercolour("green"), colour(0,0,0,0), outlinecolour(0,0,0,0)
rslider bounds(128, 20, 60, 80), channel("ModRatio3"), range(1, 10, 0.0001, 1, 1), text("Ratio"), valuetextbox(1) trackercolour("green"), colour(0,0,0,0), outlinecolour(0,0,0,0)
rslider bounds(194, 20, 60, 80), channel("Op3OffsetHz"), range(-1000, 1000, 0, 1, 0.01), text("Offset") valuetextbox(1) trackercolour("green"), colour(0,0,0,0), outlinecolour(0,0,0,0)
rslider bounds(2, 103, 60, 80), channel("ModAmp3attack"), text("A"), range(1e-06, 16, 0.0001, 1, 0.001) valuetextbox(1) trackercolour("green"), colour(0,0,0,0), outlinecolour(0,0,0,0)
rslider bounds(64, 103, 60, 80), channel("ModAmp3decay"), text("D"), range(1e-06, 16, 0.0001, 1, 0.001) valuetextbox(1) trackercolour("green"), colour(0,0,0,0), outlinecolour(0,0,0,0)
rslider bounds(128, 103, 60, 80), channel("ModAmp3sustain"), text("S"), range(1e-06, 16, 0.0001, 1, 0.001) valuetextbox(1) trackercolour("green"), colour(0,0,0,0), outlinecolour(0,0,0,0)
rslider bounds(194, 103, 60, 80), channel("ModAmp3release"), text("R"), range(1e-06, 16, 0.0001, 1, 0.001) valuetextbox(1) trackercolour("green"), colour(0,0,0,0), outlinecolour(0,0,0,0)
}
groupbox bounds(868, 18, 260, 190), text("Op4 LF0") colour(0, 0, 0, 255) outlinecolour("green")
{
rslider bounds(2, 20, 60, 80), channel("LFO4Waveshape") range(0, 3, 0, 1, 1), text("Shape") valuetextbox(1) trackercolour("purple"), colour(0,0,0,0), outlinecolour(0,0,0,0)
rslider bounds(64, 20, 60, 80), channel("LFO4depth") range(0, 1500, 0, 1, 0.01), text("Depth") valuetextbox(1) trackercolour("purple"), colour(0,0,0,0), outlinecolour(0,0,0,0)
rslider bounds(128, 20, 60, 80), channel("LFO4rate"), range(0, 50, 0, 1, 1), text("Rate") valuetextbox(1) trackercolour("purple"), colour(0,0,0,0), outlinecolour(0,0,0,0)
rslider bounds(194, 20, 60, 80), channel("LFO4Sync"), range(0, 16, 0, 1, 0), text("Sync") valuetextbox(1) trackercolour("purple"), colour(0,0,0,0), outlinecolour(0,0,0,0)
rslider bounds(2, 103, 60, 80), channel("LFO4depthAttack"), range(1e-05, 16, 0.0001, 1, 0.001), text("A") valuetextbox(1) trackercolour("purple"), colour(0,0,0,0), outlinecolour(0,0,0,0)
rslider bounds(64, 103, 60, 80), channel("LFO4depthDecay"), range(1e-06, 16, 0, 1, 0.001), text("D") valuetextbox(1) trackercolour("purple"), colour(0,0,0,0), outlinecolour(0,0,0,0)
rslider bounds(128, 103, 60, 80), channel("LFO4depthSustain"), range(1e-06, 16, 0.0001, 1, 0.001), text("S") valuetextbox(1) trackercolour("purple"), colour(0,0,0,0), outlinecolour(0,0,0,0)
rslider bounds(194, 103, 60, 80), channel("LFO4depthRelease"), range(1e-06, 16, 0.0001, 1, 0.001), text("R") valuetextbox(1) trackercolour("purple"), colour(0,0,0,0), outlinecolour(0,0,0,0)
}
groupbox bounds(868, 226, 260, 190), text("Operator 4") colour(0, 0, 0, 255) outlinecolour("green")
{
rslider bounds(2, 20, 60, 80), channel("CarrierWaveShape"), text("Shape") range(0, 3, 0, 1, 1) valuetextbox(1) trackercolour("purple"), colour(0,0,0,0), outlinecolour(0,0,0,0)
rslider bounds(64, 20, 60, 80), channel("CarrierModRatio"), range(1, 10, 1, 1, 1), text("Ratio"), valuetextbox(1) trackercolour("purple"), colour(0,0,0,0), outlinecolour(0,0,0,0)
rslider bounds(128, 20, 60, 80), channel("BPCutoff"), text("BP Cutoff"), range(0, 22000, 150, 0.5, 0.01) valuetextbox(1) trackercolour("purple"), colour(0,0,0,0), outlinecolour(0,0,0,0)
rslider bounds(194, 20, 60, 80), channel("Bandwidth"), text("Bandwidth"), range(0.1, 22000, 300, 1, 0.001) valuetextbox(1) trackercolour("purple"), colour(0,0,0,0), outlinecolour(0,0,0,0)
rslider bounds(2, 103, 60, 80), channel("attackOsc1"), text("a"), range(0.0001, 16, 0.0001, 1, 0.001) valuetextbox(1) trackercolour("purple"), colour(0,0,0,0), outlinecolour(0,0,0,0)
rslider bounds(64, 103, 60, 80), channel("decayOsc1"), text("d"), range(0.01, 16, 10, 1, 0.001) valuetextbox(1) trackercolour("purple"), colour(0,0,0,0), outlinecolour(0,0,0,0)
rslider bounds(128, 103, 60, 80), channel("sustainOsc1"), text("s") range(1e-06, 16, 0.0001, 1, 0.001) valuetextbox(1) trackercolour("purple"), colour(0,0,0,0), outlinecolour(0,0,0,0)
rslider bounds(194, 103, 60, 80), channel("releaseOsc1"), text("r") range(0.0011, 16, 0.0011, 1, 0.0011) valuetextbox(1) trackercolour("purple"), colour(0,0,0,0), outlinecolour(0,0,0,0)
}
-n -d -+rtmidi=NULL -M0 -m0d --midi-key-cps=4 --midi-velocity-amp=5
; Initialize the global variables.
sr = 88200
ksmps = 64
nchnls = 2
0dbfs = 0
gisine ftgen 1, 0, 1024, 10, 1 ; sine wave
gisawtooth ftgen 2, 0, 1024, 10, 1, 0.5, 0.3, 0.25, 0.2, 0.167, 0.14, 0.125, .111 ; sawtooth
gipulse ftgen 3, 0, 1024, 10, 1, 1, 1, 1, 0.7, 0.5, 0.3, 0.1 ; pulse
gisquare ftgen 4, 0, 1024, 10, 1, 0, 0.3, 0, 0.2, 0, 0.14, 0, .111 ; square
;instrument will be triggered by keyboard widget
instr 1
kbpm chnget "HOST_BPM" ; returns Host DAW BPM
iattack chnget "attackOsc1" ; carrier amp envelope attack
idecay chnget "decayOsc1" ; carrier amp envelope decay
isustain chnget "sustainOsc1" ; carrier amp envelop decay
irelease chnget "releaseOsc1" ; carrier amp envelope decay
kfreq = p4
kamp = p5
kAmp1 chnget "ModAmp1" ; Operator 1 modulation depth/amplitude
iop1ampattack chnget "ModAmp1attack" ; a - linear envelope controlling Operator 1 modulation depth
iop1ampdecay chnget "ModAmp1decay" ; d - linear envelope controlling Operator 1 modulation depth
iop1ampsustain chnget "ModAmp1sustain" ; s - linear envelope controlling Operator 1 modulation depth
iop1amprelease chnget "ModAmp1release" ; r - linear envelope controlling Operator 1 modulation depth
kLFO1select chnget "LFO1Sync" ; control for lfo rhythm select
kLFO1rate chnget "LFO1rate"
kLFO1depth chnget "LFO1depth"
kMratio1 chnget "ModRatio1"
kFreq1 chnget "ModFreq1" ; Operator 1 modulation rate/frequency
kratioOffset1 chnget "Op1OffsetHz"
; Operator 1 lfo rhythm selection conditionals. If set to anything other that '0' then OpFreq1 bypassed and GUI locks.
if (kLFO1select == 0) then
kLFO1rate = kLFO1rate ; Mod Freq1 rotary slider engaged. If on any other value then rslider bypassed.
elseif (kLFO1select == 1) then
kLFO1rate = kbpm/240 ; whole note: 0.5hz
elseif (kLFO1select == 2) then
kLFO1rate = kbpm/120 ; half notes: 1hz
elseif (kLFO1select == 3) then
kLFO1rate = kbpm/60 ; quarter notes: 2hz
elseif (kLFO1select == 4) then
kLFO1rate = kbpm/30 ; 8th notes: 4hz
elseif (kLFO1select == 5) then
kLFO1rate = kbpm/15 ; 16th notes: 8hz
elseif (kLFO1select == 6) then
kLFO1rate = kbpm/7.5 ; 32nd notes: 16hz
elseif (kLFO1select == 7) then
kLFO1rate = kbpm/179.910044977511244 ; dotted half note: 0.667hz
elseif (kLFO1select == 8) then
kLFO1rate = kbpm/90.022505626406602 ; dotted quarter note: 1.333
elseif (kLFO1select == 9) then
kLFO1rate = kbpm/44.99437570303712 ; dotted 8th note: 2.667hz
elseif (kLFO1select == 10) then
kLFO1rate = kbpm/22.501406337896119 ; dotted 16th note: 5.333hz
elseif (kLFO1select == 11) then
kLFO1rate = kbpm/11.249648448485985 ; dotted 32nd note: 10.667hz
elseif (kLFO1select == 12) then
kLFO1rate = kbpm/80 ; half note triplets: 1.5hz
elseif (kLFO1select == 13) then
kLFO1rate = kbpm/40 ; quarter note triplets: 3hz
elseif (kLFO1select == 14) then
kLFO1rate = kbpm/20 ; 8th note triplets: 6hz
elseif (kLFO1select == 15) then
kLFO1rate = kbpm/10 ; 16th note triplets: 12hz
elseif (kLFO1select == 16) then
kLFO1rate = kbpm/5 ; 32nd note triplets: 24hz
endif
iLFO1attack chnget "LFO1depthAttack"
iLFO1decay chnget "LFO1depthDecay"
iLFO1sustain chnget "LFO1depthSustain"
iLFO1release chnget "LFO1depthRelease"
; Operator 1 modulation ratio conditionals
if (kMratio1 == 0) then
kFreq1 = kFreq1
elseif (kMratio1 == 1) then
kFreq1 = p4 / 1 ; Modulation cps = carrier cps divided by 1. C:M ratio of 1:1
elseif (kMratio1 == 2) then
kFreq1 = p4 / 0.5 ; Modulation cps = carrier cps divided by 0.5. C:M ratio of 1:2
elseif (kMratio1 == 3) then
kFreq1 = p4/0.333333333333333 ; Modulation cps = carrier cps divided by 0.33(r). C:M ratio of 1:3
elseif (kMratio1 == 4) then
kFreq1 = p4/0.25 ; Modulation cps = carier cps divided by 0.25. C:M ratio of 1:4
elseif (kMratio1 == 5) then
kFreq1 = p4/0.20 ; Modulation cps = carrier cps divided by 0.20. C:M ratio of 1:5
elseif (kMratio1 == 6) then
kFreq1 = p4/0.16666666666667 ; Modulation cps = carrier cps divided by 0.166666666666667. C:M ratio of 1:6
elseif (kMratio1 == 7) then
kFreq1 = p4/0.142857142857143 ; Modulation cps = carrier cps divided by 0.142857142857143. C:M ratio of 1:7
elseif (kMratio1 == 8) then
kFreq1 = p4/0.125 ; Modulation cps = carrier cps divided by 0.125. C:M ratio of 1:8
elseif (kMratio1 == 9) then
kFreq1 = p4/0.111111111111111 ; Modulation cps = carrier cps divided by 0.125. C:M ratio of 1:9
elseif (kMratio1 == 10) then
kFreq1 = p4/0.10 ; Modulation cps = carrier cps divided by 0.125. C:M ratio of 1:10
endif
kAmp2 chnget "ModAmp2" ; Operator 2 modulation depth/amplitude
iop2ampattack chnget "ModAmp2attack"
iop2ampdecay chnget "ModAmp2decay"
iop2ampsustain chnget "ModAmp2sustain"
iop2amprelease chnget "ModAmp2release"
kLFO2depth chnget "LFO2depth"
kLFO2rate chnget "LFO2rate"
kLFO2select chnget "LFO2Sync"
kMratio2 chnget "ModRatio2"
kFreq2 chnget "ModFreq2"
if (kLFO2select == 0) then
kLFO2rate = kLFO2rate ; un-synced - Mod Freq1 rotary slider engaged. If on any other value then rslider bypassed.
elseif (kLFO2select == 1) then
kLFO2rate = kbpm/240 ; whole note: 0.5hz
elseif (kLFO2select == 2) then
kLFO2rate = kbpm/120 ; half notes: 1hz
elseif (kLFO2select == 3) then
kLFO2rate = kbpm/60 ; quarter notes: 2hz
elseif (kLFO2select == 4) then
kLFO2rate = kbpm/30 ; 8th notes: 4hz
elseif (kLFO2select == 5) then
kLFO2rate = kbpm/15 ; 16th notes: 8hz
elseif (kLFO2select == 6) then
kLFO2rate = kbpm/7.5 ; 32nd notes: 16hz
elseif (kLFO2select == 7) then
kLFO2rate = kbpm/179.910044977511244 ; dotted half note: 0.667hz
elseif (kLFO2select == 8) then
kLFO2rate = kbpm/90.022505626406602 ; dotted quarter note: 1.333
elseif (kLFO2select == 9) then
kLFO2rate = kbpm/44.99437570303712 ; dotted 8th note: 2.667hz
elseif (kLFO2select == 10) then
kLFO2rate = kbpm/22.501406337896119 ; dotted 16th note: 5.333hz
elseif (kLFO2select == 11) then
kLFO2rate = kbpm/11.249648448485985 ; dotted 32nd note: 10.667hz
elseif (kLFO2select == 12) then
kLFO2rate = kbpm/80 ; half note triplets: 1.5hz
elseif (kLFO2select == 13) then
kLFO2rate = kbpm/40 ; quarter note triplets: 3hz
elseif (kLFO2select == 14) then
kLFO2rate = kbpm/20 ; 8th note triplets: 6hz
elseif (kLFO2select == 15) then
kLFO2rate = kbpm/10 ; 16th note triplets: 12hz
elseif (kLFO2select == 16) then
kLFO2rate = kbpm/5 ; 32nd note triplets: 24hz
endif
iLFO2attack chnget "LFO2depthAttack"
iLFO2decay chnget "LFO2depthDecay"
iLFO2sustain chnget "LFO2depthSustain"
iLFO2release chnget "LFO2depthRelease"
; Operator 2 modulation ratio conditionals
if (kMratio2 == 0) then
kFreq2 = kFreq2
elseif (kMratio2 == 1) then
kFreq2 = p4 / 1 ; Modulation cps = carrier cps divided by 1. C:M ratio of 1:1
elseif (kMratio2 == 2) then
kFreq2 = p4 / 0.5 ; Modulation cps = carrier cps divided by 0.5. C:M ratio of 1:2
elseif (kMratio2 == 3) then
kFreq2 = p4/0.333333333333333 ; Modulation cps = carrier cps divided by 0.33(r). C:M ratio of 1:3
elseif (kMratio2 == 4) then
kFreq2 = p4/0.25 ; Modulation cps = carier cps divided by 0.25. C:M ratio of 1:4
elseif (kMratio2 == 5) then
kFreq2 = p4/0.20 ; Modulation cps = carrier cps divided by 0.20. C:M ratio of 1:5
elseif (kMratio2 == 6) then
kFreq2 = p4/0.16666666666667 ; Modulation cps = carrier cps divided by 0.166666666666667. C:M ratio of 1:6
elseif (kMratio2 == 7) then
kFreq2 = p4/0.142857142857143 ; Modulation cps = carrier cps divided by 0.142857142857143. C:M ratio of 1:7
elseif (kMratio2 == 8) then
kFreq2 = p4/0.125 ; Modulation cps = carrier cps divided by 0.125. C:M ratio of 1:8
elseif (kMratio2 == 9) then
kFreq2 = p4/0.111111111111111 ; Modulation cps = carrier cps divided by 0.125. C:M ratio of 1:9
elseif (kMratio2 == 10) then
kFreq2 = p4/0.10 ; Modulation cps = carrier cps divided by 0.125. C:M ratio of 1:10
endif
kAmp3 chnget "ModAmp3"
iop3ampattack chnget "ModAmp3attack"
iop3ampdecay chnget "ModAmp3decay"
iop3ampsustain chnget "ModAmp3sustain"
iop3amprelease chnget "ModAmp3release"
kLFO3select chnget "LFO3Sync"
kLFO3depth chnget "LFO3depth"
kLFO3rate chnget "LFO3rate"
kMratio3 chnget "ModRatio3"
kFreq3 chnget "ModFreq3"
if (kLFO3select == 0) then
kLFO3rate = kLFO3rate ; un-synced - Mod Freq1 rotary slider engaged. If on any other value then rslider bypassed.
elseif (kLFO3select == 1) then
kLFO3rate = kbpm/240 ; whole note: 0.5hz
elseif (kLFO3select == 2) then
kLFO3rate = kbpm/120 ; half notes: 1hz
elseif (kLFO3select == 3) then
kLFO3rate = kbpm/60 ; quarter notes: 2hz
elseif (kLFO3select == 4) then
kLFO3rate = kbpm/30 ; 8th notes: 4hz
elseif (kLFO3select == 5) then
kLFO3rate = kbpm/15 ; 16th notes: 8hz
elseif (kLFO3select == 6) then
kLFO3rate = kbpm/7.5 ; 32nd notes: 16hz
elseif (kLFO3select == 7) then
kLFO3rate = kbpm/179.910044977511244 ; dotted half note: 0.667hz
elseif (kLFO3select == 8) then
kLFO3rate = kbpm/90.022505626406602 ; dotted quarter note: 1.333
elseif (kLFO3select == 9) then
kLFO3rate = kbpm/44.99437570303712 ; dotted 8th note: 2.667hz
elseif (kLFO3select == 10) then
kLFO3rate = kbpm/22.501406337896119 ; dotted 16th note: 5.333hz
elseif (kLFO3select == 11) then
kLFO3rate = kbpm/11.249648448485985 ; dotted 32nd note: 10.667hz
elseif (kLFO3select == 12) then
kLFO3rate = kbpm/80 ; half note triplets: 1.5hz
elseif (kLFO3select == 13) then
kLFO3rate = kbpm/40 ; quarter note triplets: 3hz
elseif (kLFO3select == 14) then
kLFO3rate = kbpm/20 ; 8th note triplets: 6hz
elseif (kLFO3select == 15) then
kLFO3rate = kbpm/10 ; 16th note triplets: 12hz
elseif (kLFO3select == 16) then
kLFO3rate = kbpm/5 ; 32nd note triplets: 24hz
endif
iLFO3attack chnget "LFO3depthAttack"
iLFO3decay chnget "LFO3depthDecay"
iLFO3sustain chnget "LFO3depthSustain"
iLFO3release chnget "LFO3depthRelease"
; Operator 3 modulation ratio conditionals
if (kMratio3 == 0) then
kFreq3 = kFreq3
elseif (kMratio3 == 1) then
kFreq3 = p4 / 1 ; Modulation cps = carrier cps divided by 1. C:M ratio of 1:1
elseif (kMratio3 == 2) then
kFreq3 = p4 / 0.5 ; Modulation cps = carrier cps divided by 0.5. C:M ratio of 1:2
elseif (kMratio3 == 3) then
kFreq3 = p4/0.333333333333333 ; Modulation cps = carrier cps divided by 0.33(r). C:M ratio of 1:3
elseif (kMratio3 == 4) then
kFreq3 = p4/0.25 ; Modulation cps = carier cps divided by 0.25. C:M ratio of 1:4
elseif (kMratio3 == 5) then
kFreq3 = p4/0.20 ; Modulation cps = carrier cps divided by 0.20. C:M ratio of 1:5
elseif (kMratio3 == 6) then
kFreq3 = p4/0.16666666666667 ; Modulation cps = carrier cps divided by 0.166666666666667. C:M ratio of 1:6
elseif (kMratio3 == 7) then
kFreq3 = p4/0.142857142857143 ; Modulation cps = carrier cps divided by 0.142857142857143. C:M ratio of 1:7
elseif (kMratio3 == 8) then
kFreq3 = p4/0.125 ; Modulation cps = carrier cps divided by 0.125. C:M ratio of 1:8
elseif (kMratio3 == 9) then
kFreq3 = p4/0.111111111111111 ; Modulation cps = carrier cps divided by 0.125. C:M ratio of 1:9
elseif (kMratio3 == 10) then
kFreq3 = p4/0.10 ; Modulation cps = carrier cps divided by 0.125. C:M ratio of 1:10
endif
kBPcutoff chnget "BPCutoff"
kBwidth chnget "Bandwidth"
kLFO4select chnget "LFO4Sync"
kLFO4depth chnget "LFO4depth"
kLFO4rate chnget "LFO4rate"
kCarrierRatio chnget "CarrierModRatio"
if (kLFO4select == 0) then
kLFO4rate = kLFO4rate ; un-synced - Mod Freq1 rotary slider engaged. If on any other value then rslider bypassed.
elseif (kLFO4select == 1) then
kLFO4rate = kbpm/240 ; whole note: 0.5hz
elseif (kLFO4select == 2) then
kLFO4rate = kbpm/120 ; half notes: 1hz
elseif (kLFO4select == 3) then
kLFO4rate = kbpm/60 ; quarter notes: 2hz
elseif (kLFO4select == 4) then
kLFO4rate = kbpm/30 ; 8th notes: 4hz
elseif (kLFO4select == 5) then
kLFO4rate = kbpm/15 ; 16th notes: 8hz
elseif (kLFO4select == 6) then
kLFO4rate = kbpm/7.5 ; 32nd notes: 16hz
elseif (kLFO4select == 7) then
kLFO4rate = kbpm/179.910044977511244 ; dotted half note: 0.667hz
elseif (kLFO4select == 8) then
kLFO4rate = kbpm/90.022505626406602 ; dotted quarter note: 1.333
elseif (kLFO4select == 9) then
kLFO4rate = kbpm/44.99437570303712 ; dotted 8th note: 2.667hz
elseif (kLFO4select == 10) then
kLFO4rate = kbpm/22.501406337896119 ; dotted 16th note: 5.333hz
elseif (kLFO4select == 11) then
kLFO4rate = kbpm/11.249648448485985 ; dotted 32nd note: 10.667hz
elseif (kLFO4select == 12) then
kLFO4rate = kbpm/80 ; half note triplets: 1.5hz
elseif (kLFO4select == 13) then
kLFO4rate = kbpm/40 ; quarter note triplets: 3hz
elseif (kLFO4select == 14) then
kLFO4rate = kbpm/20 ; 8th note triplets: 6hz
elseif (kLFO4select == 15) then
kLFO4rate = kbpm/10 ; 16th note triplets: 12hz
elseif (kLFO4select == 16) then
kLFO4rate = kbpm/5 ; 32nd note triplets: 24hz
endif
iLFO4attack chnget "LFO4depthAttack"
iLFO4decay chnget "LFO4depthDecay"
iLFO4sustain chnget "LFO4depthSustain"
iLFO4release chnget "LFO4depthRelease"
; Operator 4 modulation ratio conditionals
if (kCarrierRatio == 0) then
kfreq = kfreq
elseif (kCarrierRatio == 1) then
kfreq = p4*1 ; Modulation cps = carrier cps divided by 1. C:M ratio of 1:1
elseif (kCarrierRatio == 2) then
kfreq = p4*2 ; Modulation cps = carrier cps divided by 0.5. C:M ratio of 1:2
elseif (kCarrierRatio == 3) then
kfreq = p4*3 ; Modulation cps = carrier cps divided by 0.33(r). C:M ratio of 1:3
elseif (kCarrierRatio == 4) then
kfreq = p4*4 ; Modulation cps = carier cps divided by 0.25. C:M ratio of 1:4
elseif (kCarrierRatio == 5) then
kfreq = p4*5 ; Modulation cps = carrier cps divided by 0.20. C:M ratio of 1:5
elseif (kCarrierRatio == 6) then
kfreq = p4*6 ; Modulation cps = carrier cps divided by 0.166666666666667. C:M ratio of 1:6
elseif (kCarrierRatio == 7) then
kfreq = p4*7 ; Modulation cps = carrier cps divided by 0.142857142857143. C:M ratio of 1:7
elseif (kCarrierRatio == 8) then
kfreq = p4*8 ; Modulation cps = carrier cps divided by 0.125. C:M ratio of 1:8
elseif (kCarrierRatio == 9) then
kfreq = p4*9 ; Modulation cps = carrier cps divided by 0.125. C:M ratio of 1:9
elseif (kCarrierRatio == 10) then
kfreq = p4*10 ; Modulation cps = carrier cps divided by 0.125. C:M ratio of 1:10
endif
kLFO1Waveshape chnget "LFO1Waveshape"
if (kLFO1Waveshape == 0) then
kLFO1Waveshape = gisine
elseif (kLFO1Waveshape == 1) then
kLFO1Waveshape = gisawtooth
elseif (kLFO1Waveshape == 2) then
kLFO1Waveshape = gipulse
elseif (kLFO1Waveshape == 3) then
kLFO1Waveshape = gisquare
endif
kLFO2Waveshape chnget "LFO2Waveshape"
if (kLFO2Waveshape == 0) then
kLFO2Waveshape = gisine
elseif (kLFO2Waveshape == 1) then
kLFO2Waveshape = gisawtooth
elseif (kLFO2Waveshape == 2) then
kLFO2Waveshape = gipulse
elseif (kLFO2Waveshape == 3) then
kLFO2Waveshape = gisquare
endif
kLFO3Waveshape chnget "LFO3Waveshape"
if (kLFO3Waveshape == 0) then
kLFO3Waveshape = gisine
elseif (kLFO3Waveshape == 1) then
kLFO3Waveshape = gisawtooth
elseif (kLFO3Waveshape == 2) then
kLFO3Waveshape = gipulse
elseif (kLFO3Waveshape == 3) then
kLFO3Waveshape = gisquare
endif
kLFO4Waveshape chnget "LFO4Waveshape"
if (kLFO4Waveshape == 0) then
kLFO4Waveshape = gisine
elseif (kLFO4Waveshape == 1) then
kLFO4Waveshape = gisawtooth
elseif (kLFO4Waveshape == 2) then
kLFO4Waveshape = gipulse
elseif (kLFO4Waveshape == 3) then
kLFO4Waveshape = gisquare
endif
kCarrierWaveShape chnget "CarrierWaveShape"
if (kCarrierWaveShape == 0) then
kCarrierWaveShape = gisine
elseif (kCarrierWaveShape == 1) then
kCarrierWaveShape = gisawtooth
elseif (kCarrierWaveShape == 2) then
kCarrierWaveShape = gipulse
elseif (kCarrierWaveShape == 3) then
kCarrierWaveShape = gisquare
endif
kOp1WaveShape chnget "Op1WaveShape"
if (kOp1WaveShape == 0) then
kOp1WaveShape = gisine
elseif (kOp1WaveShape == 1) then
kOp1WaveShape = gisawtooth
elseif (kOp1WaveShape == 2) then
kOp1WaveShape = gipulse
elseif (kOp1WaveShape == 3) then
kOp1WaveShape = gisquare
endif
kOp2WaveShape chnget "Op2WaveShape"
if (kOp2WaveShape == 0) then
kOp2WaveShape = gisine
elseif (kOp2WaveShape == 1) then
kOp2WaveShape = gisawtooth
elseif (kOp2WaveShape == 2) then
kOp2WaveShape = gipulse
elseif (kOp2WaveShape == 3) then
kOp2WaveShape = gisquare
endif
kOp3WaveShape chnget "Op3WaveShape"
if (kOp3WaveShape == 0) then
kOp3WaveShape = gisine
elseif (kOp3WaveShape == 1) then
kOp3WaveShape = gisawtooth
elseif (kOp3WaveShape == 2) then
kOp3WaveShape = gipulse
elseif (kOp3WaveShape == 3) then
kOp3WaveShape = gisquare
endif
aLFO1Env madsr iLFO1attack, iLFO1decay, iLFO1sustain, iLFO1release
aLFO2Env madsr iLFO2attack, iLFO2decay, iLFO2sustain, iLFO2release
aLFO3Env madsr iLFO3attack, iLFO3decay, iLFO3sustain, iLFO3release
aLFO4Env madsr iLFO4attack, iLFO4decay, iLFO4sustain, iLFO4release
aMod1Env madsr iop1ampattack, iop1ampdecay, iop1ampsustain, iop1amprelease
aMod2Env madsr iop2ampattack, iop2ampdecay, iop2ampsustain, iop2amprelease
aMod3Env madsr iop3ampattack, iop3ampdecay, iop3ampsustain, iop3amprelease
aEnv madsr iattack, idecay, isustain, irelease
aLFO1 oscilikt kLFO1depth*aLFO1Env, kLFO1rate, kLFO1Waveshape
aLFO2 oscilikt kLFO2depth*aLFO2Env, kLFO2rate, kLFO2Waveshape
aLFO3 oscilikt kLFO3depth*aLFO3Env, kLFO3rate, kLFO3Waveshape
aLFO4 oscilikt kLFO4depth*aLFO4Env, kLFO4rate, kLFO4Waveshape
aMod1 oscilikt kAmp1*aMod1Env, kFreq1+aLFO1, kOp1WaveShape
aMod2 oscilikt kAmp2*aMod2Env, kFreq2+aLFO2, kOp2WaveShape
aMod3 oscilikt kAmp3*aMod3Env, kFreq3+aLFO3, kOp3WaveShape
aCar oscilikt kamp, (kfreq+aLFO4)+aMod1+aMod2+aMod3, kCarrierWaveShape
aBPfil butterbp aCar, kBPcutoff, kBwidth
outs aBPfil*aEnv, aBPfil*aEnv
endin
;causes Csound to run for about 7000 years...
f0 z