Cabbage Logo
Back to Cabbage Site

Vst synth

<Cabbage>

form caption("TEXTURES") size(700, 500), pluginid("def1"), colour("black"),

groupbox text("Distorted Textured Echo"), bounds(0, 300, 600, 100), colour(0, 0, 0, 0)

groupbox text("Oscilator 1") bounds(0, 0, 100, 300), colour(0, 0, 0, 0)

groupbox text("Oscilator 2") bounds(100, 0, 100, 300), colour(0, 0, 0, 0)

groupbox text("Oscilator 3") bounds(200, 0, 100, 300), colour(0, 0, 0, 0)

groupbox text("Delay") bounds(300, 200, 300, 100), colour(0, 0, 0, 0)

groupbox text("Filter") bounds(300, 0, 300, 100), colour(0, 0, 0, 0)

groupbox text("Reverb")bounds(300, 100, 300, 100), colour(0, 0, 0, 0)

 

groupbox text("LFO"), bounds(600, 100, 100, 300), colour(0, 0, 0, 0)

groupbox text("tempo"), bounds(600, 0, 100, 100), colour(0, 0, 0, 0)

 

keyboard bounds(0, 400, 700, 100)

combobox channel("combobox"), range(1, 4, 1, 1, 1), bounds(10, 38, 80, 20), text("sine/tri", "saw", "square", "pulse")

combobox bounds(110, 38, 80, 20), text("sine/tri", "saw", "square", "pulse") channel("combobox2"), range(1, 4, 1, 1, 1)

combobox bounds(210, 38, 80, 20), items("sine/tri", "saw", "square", "pulse") channel("combobox3"), range(1, 4, 1, 1, 1)

rslider bounds(20, 78, 60, 60) range(0, 1, 0.3, 1, 0.001), channel("gainone"), text("Volume")

rslider bounds(122, 76, 60, 60) range(0, 1, 0.3, 1, 0.001) channel("gaintwo"), text("Volume")

rslider bounds(220, 78, 60, 60) range(0, 1, 0.3, 1, 0.001) channel("gainthree"), text("Volume")

rslider bounds(20, 170, 60, 60) range(1, 1.0833, 1, 1, 0.0001) channel("DT1"), text("Detune")

rslider bounds(122, 170, 60, 60) range(1, 1.0833, 1, 1, 0.0001) channel("DT2"), text("Detune")

rslider  range(1, 1.0833, 1, 1, 0.0001) channel("DT3") bounds(218, 170, 60, 60), text("Detune")

 

 

 

rslider  range(0, 20000, 20000, 0.5, 1) channel("X") range(0, 20000, 20000, 0.5, 1), text("lp cutoff"), identchannel("pluckenv") bounds(330, 30, 55, 55)

rslider bounds(500, 30, 55, 55) range(0, 1, 0, 1, 0.01) channel("Y"), range(0, 1, 0, 1, 0.01), text("resonance")

rslider bounds(368, 128, 60, 60) range(0.1, 0.99, 0.1, 1, 0.01) channel("reverb"), range(0, 0.99, 0, 1, 0.01), text("feedback")

rslider bounds(480, 130, 60, 60) range(0, 20000, 12000, 1, 1), channel("reverb2") range(0, 20000, 12000, 1, 1), text("frequency")

rslider bounds(420, 30, 55, 55), text("hp cutoff"), range(0, 20000, 0, 0.5, 1), channel("hpcutoff")

 

csoundoutput bounds(620, 30, 70, 50), identchannel("bpm")

rslider bounds (330, 235, 55, 55), channel ("DelayTime"), text("Time"), range(0.1, 2, 0.2)

rslider bounds (420, 235, 55, 55), channel ("Feedback"), text("Feedback"), range(0, 1, 0.8)

rslider bounds (500, 235, 55, 55), channel ("FXLevel"), text("FX Level"), range(0, 1, 1)

hslider bounds (30, 340, 540, 30), channel ("reverbgain"), range(0, 0.25, 0, 1, 0.001)

rslider bounds (625, 150, 55, 55), channel ("depth"), range(0, 1, 0, 1, 0.01), text("Depth")

rslider bounds (625, 250, 55, 55), channel ("freq"), range(1, 4, 2, 1, 0.01), text("Rate")

 

</Cabbage>

<CsoundSynthesizer>

<CsOptions>

-n -d -+rtmidi=NULL -M0 -m0d --midi-key-cps=4 --midi-velocity-amp=5

</CsOptions>

<CsInstruments>

; Initialize the global variables.

ksmps = 32

nchnls = 2

0dbfs = 1

 

ga1 init 0

ga2 init 0

;instrument will be triggered by keyboard widget

kBPM chnget ("HOST_BPM")

;chnset kBPM, ("bpm")

if changed:k(kBPM)==1 then

                SMess sprintfk "text(\"BPM: %d\")", kBPM

                chnset SMess, "bpm"

endif

 

instr 1

;-----------control variables-----------------

kDt1 chnget ("DT1")

kDt2 chnget ("DT2")

kDt3 chnget ("DT3")

kGain1 chnget ("gainone")

kGain2 chnget ("gaintwo")

kGain3 chnget ("gainthree")

iwaveone chnget ("combobox")

kfc chnget ("X")

kfr chnget ("Y")

khpfc chnget ("hpcutoff")

;----------oscilators with waveforms------------

 

if (iwaveone==1) then

  imode = 12

 kpw = 1

  kphs = 1

  inyx = 1

elseif (iwaveone==2) then

  imode = 0

  kpw = 0

  kphs = 1

  inyx = 1

elseif (iwaveone==3) then

  imode = 2

  kpw = 0.5

  kphs = 1

  inyx = 1

elseif (iwaveone==4) then

  imode = 6

  kpw = 0

  kphs = 1

  inyx = 1

 

endif

 

aOut vco2 p5, p4*kDt1, imode, kpw, kphs, inyx

 

iwavetwo chnget ("combobox2")

 

if (iwavetwo==1) then

  imode2 = 12

  kpw2 = 1

  kphs2 = 1

  inyx2 = 1

elseif (iwavetwo==2) then

  imode2 = 0

  kpw2 = 0

  kphs2 = 1

  inyx2 = 1

elseif (iwavetwo==3) then

  imode2 = 2

  kpw2 = 0.5

  kphs2 = 1

  inyx2 = 1

elseif (iwavetwo==4) then

  imode2 = 6

  kpw2 = 0

  kphs2 = 1

  inyx2 = 1

 

endif

 

aOut2 vco2 p5, p4*kDt2, imode2, kpw2, kphs2, inyx2

 

 

iwavethree chnget ("combobox3")

 

if (iwavethree==1) then

  imode3 = 12

  kpw3 = 1

  kphs3 = 1

  inyx3 = 1

elseif (iwavethree==2) then

  imode3 = 0

  kpw3 = 0

  kphs3 = 1

  inyx3 = 1

elseif (iwavethree==3) then

  imode3 = 2

  kpw3 = 0.5

  kphs3 = 1

  inyx3 = 1

elseif (iwavethree==4) then

  imode3 = 6

  kpw3 = 0

  kphs3 = 1

  inyx3 = 1

 

endif

 

aOut3 vco2 p5, p4*kDt3, imode3, kpw3, kphs3, inyx3

 

;-------------gain----------------------------------

 

aOut1 gain aOut, kGain1

aOut21 gain aOut2, kGain2

aOut31 gain aOut3, kGain3

 

;--------------lowpass/resonance and highpass filter---------

aOutlpf moogladder (aOut31+aOut21+aOut1), kfc, kfr

 

aOuthpf butterhp aOutlpf, khpfc

 

;lfo------------------------------------------------

kdepth chnget ("depth")

kfreq chnget ("freq")

kMod oscili kdepth, kfreq   

 

outs aOuthpf*kMod, aOuthpf*kMod

 

 

chnmix aOuthpf, "send"

 

ga1 += aOuthpf

endin

;-----------------reverb----------------------------------

instr 2

 

kRv1 chnget ("reverb")

kRv2 chnget ("reverb2")

 

aL, aR reverbsc ga1, ga1, kRv1, kRv2, sr, 0.5, 0

 

 

outs aL, aR

 

ga2 += aL

 

ga1 = 0

endin

;------------delay---------------------------------------

instr 3

 

aOuthpf chnget "send"

       

        chnclear "send"

       

krgain chnget "reverbgain"

      

areverbgain gain ga2, krgain

       

kTime chnget "DelayTime"

 

kPortTime linseg 0, 0.01, 0.1

 

kTime portk kTime, kPortTime                           

 

kFB chnget "Feedback"

 

iMaxTime = 4

 

aInDel vdelay aOuthpf + areverbgain, a(kTime)*1000, iMaxTime*1000

 

aBufL delayr iMaxTime

 

aTapL deltapi a(kTime) * 2

 

delayw aOuthpf + areverbgain + (aTapL * kFB)

 

aBufR delayr iMaxTime

 

aTapR deltapi a(kTime) * 2

 

 

 

kFXLevel chnget "FXLevel"

 

outs aOuthpf + areverbgain + (aTapL * kFXLevel), aOuthpf+ areverbgain + ((( aTapR * ceil(kFB)) + aInDel) * kFXLevel)

 

 

ga2 = 0

               

endin

</CsInstruments>

<CsScore>

;causes Csound to run for about 7000 years...

f0 z

i 2 0 z

i 3 0 z

;i 3 0 25

</CsScore>

</CsoundSynthesizer>

Cabbage code for a vst synth I’ve been working on any ideas or input would be welcome first synth I’ve made :face_with_monocle:

Interesting. Sounds like morse code sender - definitely some “SOS synth”. :slight_smile:

Also I noticed there were some pops after I tweaked some parameters.