Cabbage Logo
Back to Cabbage Site

Big SoftSynth Project w/ Dr. Boulanger - Questions for Rory & Pros

I learned a few things about Csound in my class with Dr. B here at Berklee, though, as I endeavor to create my first serious softsynth in cabbage, I’m teaching myself everything beyond the basics we discussed in class. So, I apologize for my utter noobishness. I’ve very likely overlooked some Csound fundamentals.

I’m encountering some strange events in my patch.

First, no GUI changes occur until I press a MIDI note.

Second, I’m getting a strange clipping/aliasing sound on all outputted sound…

Third, when I feed the synth a string of evenly spaced notes, say, 16th-notes at 120bpm, the notes are performed unevenly and with constantly shifting amounts of space between them. It might be useful as a sort of “humanizing” effect if it were intentional, though it makes all of my audio demos sound poorly performed.

Here is my code. I can send snippets if necessary.

Thanks in advance for your help!

<Cabbage>
form caption("FM Implementation") size(800, 740), colour(170, 170, 170), pluginid("plu7")
image bounds(136, 8, 252, 72) colour(255, 198, 198, 255)
image bounds(10, 8, 124, 86) colour(255, 198, 198, 255)
image bounds(10, 82, 378, 72) colour(255, 198, 198, 255)
image bounds(412, 8, 378, 146) colour(255, 198, 198, 255)
image bounds(412, 156, 378, 72) colour(255, 198, 198, 255)
image bounds(10, 156, 378, 72) colour(255, 198, 198, 255)
image bounds(412, 230, 123, 220) colour(255, 198, 198, 255)
image bounds(540, 230, 123, 220) colour(255, 198, 198, 255)
image bounds(668, 230, 123, 220) colour(255, 198, 198, 255)
image bounds(412, 262, 378, 322) colour(255, 198, 198, 255)
keyboard bounds(10, 634, 780, 95) whitenotecolour(34, 34, 34, 255) arrowbackgroundcolour(91, 43, 43, 255)
rslider bounds(216, 14, 40, 60) range(0.001, 1, 0.01, 0.5, 0.001) text("A") textcolour(89, 89, 89, 255) channel("AmpA")
rslider bounds(258, 14, 40, 60) range(0.001, 1, 0.2, 0.5, 0.001) text("D") textcolour(89, 89, 89, 255) channel("AmpD") velocity(1.92)
rslider bounds(300, 14, 40, 60) range(0.0001, 1, 0.6, 1, 0.001) text("S") textcolour(89, 89, 89, 255) channel("AmpS")
rslider bounds(342, 14, 40, 60) range(0.001, 2, 0.1, 0.5, 0.001) text("R") textcolour(89, 89, 89, 255) channel("AmpR")
label bounds(134, 14, 80, 13) text("Amp. Env.") fontcolour(48, 48, 48, 255) 
rslider bounds(216, 88, 40, 60) range(0.001, 1, 0.01, 0.5, 0.001) text("A") textcolour(89, 89, 89, 255), channel("ModEnvA"), identchannel("ModEnvAident")  
rslider bounds(258, 88, 40, 60) range(0.001, 1, 0.2, 0.5, 0.001) text("D") textcolour(89, 89, 89, 255), channel("ModEnvD"), identchannel("ModEnvDident")
rslider bounds(300, 88, 40, 60) range(0.0001, 1, 0.6, 1, 0.001) text("S") textcolour(89, 89, 89, 255), channel("ModEnvS"), identchannel("ModEnvSident")
rslider bounds(342, 88, 40, 60) range(0.001, 1, 0.1, 0.5, 0.001) text("R") textcolour(89, 89, 89, 255), channel("ModEnvR"), identchannel("ModEnvRident")
label bounds(134, 88, 80, 13) text("Mod. Env.") fontcolour(48, 48, 48, 255) identchannel("ModEnvLabel")
checkbox bounds(134, 110, 80, 30) text("Static") colour:1(255, 189, 227, 255) colour:0(46, 25, 44, 255) fontcolour:1(48, 48, 48, 255) identchannel("ModEnvStatic") channel("ModEnvStatic")
nslider bounds(16, 114, 100, 22) range(1, 20, 3, 1, 0.001) velocity(50) channel("ratio")
label bounds(16, 88, 100, 13) text("Ratio") fontcolour(48, 48, 48, 255)
hslider bounds(16, 40, 119, 22) range(0, 15, 0, 1, 0.001) channel("index")
label bounds(16, 14, 100, 14) text("Index") fontcolour(48, 48, 48, 255)
hrange bounds(16, 182, 250, 40) max(1) min(0) range(0, 1, 0.5:0.5, 1, 0.001) 
label bounds(16, 162, 250, 13) text("Pan Spread") fontcolour(48, 48, 48, 255)
rslider bounds(618, 14, 40, 60) range(0.001, 1, 0.001, 0.5, 0.001) text("A") textcolour(89, 89, 89, 255) channel("FiltA"), identchannel("FiltAident")
rslider bounds(660, 14, 40, 60) range(0.001, 1, 0.001, 0.5, 0.001) text("D") textcolour(89, 89, 89, 255) channel("FiltD"), identchannel("FiltDident")
rslider bounds(702, 14, 40, 60) range(0.001, 1, 0.001, 1, 0.001) text("S") textcolour(89, 89, 89, 255) channel("FiltS"), identchannel("FiltSident")
rslider bounds(744, 14, 40, 60) range(0.001, 2, 0.001, 0.5, 0.001) text("R") textcolour(89, 89, 89, 255) channel("FiltR"), identchannel("FiltRident")
label bounds(536, 14, 80, 13) text("Filter Env.") fontcolour(48, 48, 48, 255) 
rslider bounds(618, 162, 40, 60) range(0.001, 1, 0.001, 0.5, 0.001) text("A") textcolour(89, 89, 89, 255), channel("PitchA"), identchannel("PitchAident")
rslider bounds(660, 162, 40, 60) range(0.001, 1, 0.001, 0.5, 0.001) text("D") textcolour(89, 89, 89, 255), channel("PitchD"), identchannel("PitchDident")
rslider bounds(702, 162, 40, 60) range(0.001, 1, 0.001, 1, 0.001) text("S") textcolour(89, 89, 89, 255), channel("PitchS"), identchannel("PitchSident")
rslider bounds(744, 162, 40, 60) range(0.001, 1, 0.001, 0.5, 0.001) text("R") textcolour(89, 89, 89, 255), channel("PitchR"), identchannel("PitchRident")
label bounds(536, 162, 80, 13) text("Pitch Env.") fontcolour(48, 48, 48, 255) 
checkbox bounds(536, 184, 80, 30) text("Bypass") colour:1(255, 189, 227, 255) colour:0(46, 25, 44, 255) fontcolour:1(48, 48, 48, 255) channel("PitchEnvActive") identchannel("PitchEnvActiveident")
checkbox bounds(536, 36, 80, 30) text("Bypass") colour:1(255, 189, 227, 255) colour:0(46, 25, 44, 255) fontcolour:1(48, 48, 48, 255) channel("FilterActive")
hslider bounds(416, 188, 119, 22) range(0, 20000, 0, 0.3, 0.001)  channel("PEnvAmount") identchannel("PEnvAmountident")
label bounds(416, 162, 100, 13) text("P-Env. Amount") fontcolour(48, 48, 48, 255) channel("PEnvAmountLabel") identchannel("PEnvAmountLabelident")
rslider bounds(416, 14, 50, 60) range(20, 20000, 2000, 0.35, 0.1) text("Cutoff") textcolour(89, 89, 89, 255) channel("FilterCutoff") identchannel("FilterCutoffident")
rslider bounds(476, 14, 50, 60) range(0, 1, 0, 1, 0.001) text("Reso") textcolour(89, 89, 89, 255) channel("Reso") identchannel("Resoident")
hslider bounds(416, 108, 119, 22) range(0, 20000, 0, 0.3, 0.001) channel("FEnvAmount") identchannel("FEnvAmountident")
label bounds(416, 82, 100, 13) text("F-Env. Amount") fontcolour(48, 48, 48, 255) identchannel("FEnvAmountLabelident") channel("FEnvAmountLabel")
combobox bounds(584, 102, 160, 22) channel("FilterTypeSelect") text("Filter Types:", "Item 2", "Item 3", "Item 4") identchannel("FilterTypeSelectident")
button bounds(198, 162, 54, 14) text("Mono", "Mono", "") channel("PanMono")

image bounds(535, 262, 256, 3) colour(170, 170, 170, 255) channel("Distortionbar") identchannel("Distortionbarident")
image bounds(412, 262, 256, 3) colour(170, 170, 170, 255) channel("Reverbbar") identchannel("Reverbbarident")

checkbox bounds(420, 238, 16, 16) shape("circle") colour:0(99, 99, 99, 255) channel("DistortionOnOff")
checkbox bounds(548, 238, 16, 16) shape("circle") colour:0(99, 99, 99, 255) channel("ChorusOnOff")
checkbox bounds(676, 238, 16, 16) shape("circle") colour:0(99, 99, 99, 255) channel("ReverbOnOff")
button bounds(446, 232, 80, 24) colour:0(255, 198, 198, 255) colour:1(255, 198, 198, 255) fontcolour:1(0, 0, 0, 255) fontcolour:0(0, 0, 0, 255) text("Distortion", "Distortion") channel("DistortionButton")
button bounds(574, 232, 80, 24) colour:0(255, 198, 198, 255) colour:1(255, 198, 198, 255) fontcolour:1(0, 0, 0, 255) fontcolour:0(0, 0, 0, 255) text("Chorus", "Chorus") channel("ChorusButton")
button bounds(702, 232, 80, 24) colour:0(255, 198, 198, 255) colour:1(255, 198, 198, 255) fontcolour:1(0, 0, 0, 255) fontcolour:0(0, 0, 0, 255) text("Reverb", "Reverb") channel("ReverbButton") active(0)

rslider bounds(650, 274, 130, 150), channel("DistortionPostGain"), range(0, 1, 0.1, 1, 0.001), text("Post Gain"), , outlinecolour(0, 0, 0, 50), textcolour(0, 0, 0, 255) colour(255, 188, 77, 255) identchannel("DistortionPostGainident")

rslider bounds(432, 274, 130, 150), channel("DistortionPreGain") range(0, 5, 0.5, 1, 0.01) text("Pre Gain"), , outlinecolour(0, 0, 0, 50), textcolour(0, 0, 0, 255) colour(255, 188, 77, 255) identchannel("DistortionPreGainident")

vslider bounds(580, 274, 50, 150) range(0, 0.5, 0, 1, 0.001) text("Shape") channel("DistortionShape") textcolour(0, 0, 0, 255) colour(255, 188, 77, 255) identchannel("DistortionShapeident")
rslider bounds(676, 454, 80, 100) range(0, 1, 0, 1, 0.001) channel("DistortionMix") text("Dry/Wet") textcolour(0, 0, 0, 255) identchannel("DistortionMixident")

hslider bounds(432, 482, 150, 50) range(0, 1, 0, 1, 0.001) colour(0, 0, 0, 0) trackercolour(42, 255, 243, 255) channel("DistortionMeter") identchannel("DistortionMeterident")


rslider bounds(174, 34, 40, 40) range(0, 1, 0, 1, 0.001)
label bounds(136, 46, 38, 14) text("Gain") fontcolour(48, 48, 48, 255) channel("Osc1Gain")
nslider bounds(156, 608, 40, 20) range(-100, 100, 0, 1, 0.01) velocity(50) channel("tuneroot")
nslider bounds(210, 608, 40, 20) range(-100, 100, 0, 1, 0.01) velocity(50) channel("tuneflattwo")
nslider bounds(264, 608, 40, 20) range(-100, 100, 0, 1, 0.01) velocity(50) channel("tunetwo")
nslider bounds(318, 608, 40, 20) range(-100, 100, 0, 1, 0.01) velocity(50) channel("tuneflatthree")
nslider bounds(372, 608, 40, 20) range(-100, 100, 0, 1, 0.01) velocity(50) channel("tunethree")
nslider bounds(426, 608, 40, 20) range(-100, 100, 0, 1, 0.01) velocity(50) channel("tunefour")
nslider bounds(480, 608, 40, 20) range(-100, 100, 0, 1, 0.01) velocity(50) channel("tunetritone")
nslider bounds(534, 608, 40, 20) range(-100, 100, 0, 1, 0.01) velocity(50) channel("tunefive")
nslider bounds(588, 608, 40, 20) range(-100, 100, 0, 1, 0.01) velocity(50) channel("tuneflatsix")
nslider bounds(642, 608, 40, 20) range(-100, 100, 0, 1, 0.01) velocity(50) channel("tunesix")
nslider bounds(696, 608, 40, 20) range(-100, 100, 0, 1, 0.01) velocity(50) channel("tuneflatseven")
nslider bounds(750, 608, 40, 20) range(-100, 100, 0, 1, 0.01) velocity(50) channel("tuneseven")
combobox bounds(106, 608, 34, 20)  channel("tunescaleroot")    text("C", "Db", "D", "Eb", "E", "F", "Gb", "G", "Ab", "A", "Bb", "B") 
label bounds(106, 588, 34, 15) text("Root") fontcolour(48, 48, 48, 255)
label bounds(156, 588, 40, 15) text("1") fontcolour(48, 48, 48, 255)
label bounds(210, 588, 40, 15) text("2") fontcolour(48, 48, 48, 255)
label bounds(264, 588, 40, 15) text("3") fontcolour(48, 48, 48, 255)
label bounds(318, 588, 40, 15) text("4") fontcolour(48, 48, 48, 255)
label bounds(372, 588, 40, 15) text("5") fontcolour(48, 48, 48, 255)
label bounds(426, 588, 40, 15) text("6") fontcolour(48, 48, 48, 255)
label bounds(480, 588, 40, 15) text("7") fontcolour(48, 48, 48, 255)
label bounds(534, 588, 40, 15) text("8") fontcolour(48, 48, 48, 255)
label bounds(588, 588, 40, 15) text("9") fontcolour(48, 48, 48, 255)
label bounds(642, 588, 40, 15) text("10") fontcolour(48, 48, 48, 255)
label bounds(696, 588, 40, 15) text("11") fontcolour(48, 48, 48, 255)
label bounds(750, 590, 40, 15) text("12") fontcolour(48, 48, 48, 255)
label bounds(10, 600, 80, 15) text("Microtuning") fontcolour(48, 48, 48, 255)
</Cabbage>
<CsoundSynthesizer>
<CsOptions>
-n -d -+rtmidi=NULL -M0 -m0d --midi-key=4 --midi-velocity-amp=5
</CsOptions>
<CsInstruments>
; Initialize the global variables. 
ksmps = 32
nchnls = 2
0dbfs = 1

instr 1


;;; - Trigger for Disappearnce of the Controls of Disabled Envelopes (LARGELY UNFINISHED)

kFilterEnvActive chnget "FilterActive"
kTrigAlpha changed kFilterEnvActive
kTrigAlpha init 1
if kTrigAlpha == 1 then
reinit alphachangefilterenv
endif
alphachangefilterenv:
if kFilterEnvActive == 1 then
chnset "alpha(0.3)", "FiltAident"
chnset "alpha(0.3)", "FiltDident"
chnset "alpha(0.3)", "FiltSident"
chnset "alpha(0.3)", "FiltRident"
chnset "alpha(0.3)", "FilterCutoffident"
chnset "alpha(0.3)", "Resoident"
chnset "alpha(0.3)", "FEnvAmountident"
chnset "alpha(0.3)", "FEnvAmountLabelident"
chnset "alpha(0.3)", "FilterTypeSelectident"
;chnset 0.001, "FiltA"
;chnset 0.001, "FiltD"
;chnset 0.001, "FiltS"
;chnset 0.001, "FiltR"
;chnset 0.00, "FEnvAmount"
;chnset 0.00, "Reso"
;chnset 20000, "FilterCutoff"
elseif kFilterEnvActive == 0 then
chnset "alpha(1)", "FiltAident"
chnset "alpha(1)", "FiltDident"
chnset "alpha(1)", "FiltSident"
chnset "alpha(1)", "FiltRident"
chnset "alpha(1)", "FilterCutoffident"
chnset "alpha(1)", "Resoident"
chnset "alpha(1)", "FEnvAmountident"
chnset "alpha(1)", "FEnvAmountLabelident"
chnset "alpha(1)", "FilterTypeSelectident"
endif
rireturn
kPitchEnvActive chnget "PitchEnvActive"
kTrigAlpha changed kPitchEnvActive
kTrigAlpha init 1
if kTrigAlpha == 1 then
reinit alphachangepitchenv
endif
alphachangepitchenv:
if kPitchEnvActive == 1 then
chnset "alpha(0.3)", "PitchAident"
chnset "alpha(0.3)", "PitchDident"
chnset "alpha(0.3)", "PitchSident"
chnset "alpha(0.3)", "PitchRident"
chnset "alpha(0.3)", "PEnvAmountident"
chnset "alpha(0.3)", "PEnvAmountLabelident"
;chnset 0.001, "PitchA"
;chnset 0.001, "PitchD"
;chnset 0.001, "PitchS"
;chnset 0.001, "PitchR"
;chnset 0.00, "PEnvAmount"
elseif kFilterEnvActive == 0 then
chnset "alpha(1)", "PitchAident"
chnset "alpha(1)", "PitchDident"
chnset "alpha(1)", "PitchSident"
chnset "alpha(1)", "PitchRident"
chnset "alpha(1)", "PEnvAmountident"
chnset "alpha(1)", "PEnvAmountLabelident"
endif
rireturn
kTrigDistortionButton init 1
kDistortionButton chnget "DistortionButton"
kTrigDistortionButton changed kDistortionButton
if kTrigDistortionButton == 1 then
reinit OpenDistortionTab
OpenDistortionTab:
chnset "alpha(1)", "Distortionbarident"
chnset "alpha(0)", "Reverbbarident"
chnset "alpha(1)", "DistortionPreGainident"
chnset "alpha(1)", "DistortionPostGainident"
chnset "alpha(1)", "DistortionShapeident"
chnset "alpha(1)", "DistortionMixident"
chnset "alpha(1)", "DistortionMeterident"
endif
;kTrigDistortionButton = 0
rireturn
kTrigReverbButton init 1
kReverbButton chnget "ReverbButton"
kTrigReverbButton changed kReverbButton
if kTrigReverbButton == 1 then
reinit OpenReverbTab
OpenReverbTab:
chnset "alpha(1)", "Reverbbarident"
chnset "alpha(0)", "Distortionbarident"
chnset "alpha(0)", "DistortionPreGainident"
chnset "alpha(0)", "DistortionPostGainident"
chnset "alpha(0)", "DistortionShapeident"
chnset "alpha(0)", "DistortionMixident"
chnset "alpha(0)", "DistortionMeterident"
endif
;kTrigReverbButton = 0
rireturn

;;; - Receiving Info from Channels
kmod chnget "ratio"
kndx chnget "index"
kPanMin chnget "rangesliderMin"
kPanMax chnget "rangesliderMax"
kcar = 1
kAmpA chnget "AmpA"
kAmpD chnget "AmpD"
kAmpS chnget "AmpS"
kAmpR chnget "AmpR"
kModEnvA chnget "ModEnvA"
kModEnvD chnget "ModEnvD"
kModEnvS chnget "ModEnvS"
kModEnvR chnget "ModEnvR"
kFltEnvA chnget "FiltA"
kFltEnvD chnget "FiltD"
kFltEnvS chnget "FiltS"
kFltEnvR chnget "FiltR"
kPitchEnvA chnget "PitchA"
kPitchEnvD chnget "PitchD"
kPitchEnvS chnget "PitchS"
kPitchEnvR chnget "PitchR"
gkamp chnget "Osc1Gain"
kMono chnget "PanMono"
kTrigMono changed kMono
ktunescaleroot chnget "tunescaleroot"
ktuneroot chnget "tuneroot"
ktuneflattwo chnget "tuneflattwo"
ktunetwo chnget "tunetwo"
ktuneflatthree chnget "tuneflatthree"
ktunethree chnget "tunethree"
ktunefour chnget "tunefour"
ktunetritone chnget "tunetritone"
ktunefive chnget "tunefive"
ktuneflatsix chnget "tuneflatsix"
ktunesix chnget "tunesix"
ktuneflatseven chnget "tuneflatseven"
ktuneseven chnget "tuneseven"
if kTrigMono = 1 then
;chnset 0.5, "rangesliderMin"
;chnset 0.5, "rangesliderMax"
endif

;;; - Converting Data from Channels into i-rate
iAmpA = i(kAmpA)
iAmpD = i(kAmpD)
iAmpS = i(kAmpS)
iAmpR = i(kAmpR)
iModEnvA = i(kModEnvA)
iModEnvD = i(kModEnvD)
iModEnvS = i(kModEnvS)
iModEnvR = i(kModEnvR)
iFltEnvA = i(kFltEnvA)
iFltEnvD = i(kFltEnvD)
iFltEnvS = i(kFltEnvS)
iFltEnvR = i(kFltEnvR)
iPitchEnvA = i(kPitchEnvA)
iPitchEnvD = i(kPitchEnvD)
iPitchEnvS = i(kPitchEnvS)
iPitchEnvR = i(kPitchEnvR)
kCutoff chnget "FilterCutoff"
kFilterEnvAmount chnget "FEnvAmount"
kPitchEnvAmount chnget "PEnvAmount"
kRes chnget "Reso"


;;; - Pitchbend & Portamento
	;if p4!=0 then														;MIDI
		;ioct		= p4										;READ OCT VALUE FROM MIDI INPUT
		;iamp		= p5 * 0.5											;READ IN A NOTE VELOCITY VALUE FROM THE MIDI INPUT
		;kamp = iamp * gkamp												;SET kamp TO MIDI KEY VELOCITY MULTIPLIED BY FLTK SLIDER VALUE gkamp

		;PITCH BEND===========================================================================================================================================================
		;iSemitoneBendRange	= (cpsmidi									;PITCH BEND RANGE IN SEMITONES (WILL BE DEFINED FURTHER LATER) - SUGGESTION - THIS COULD BE CONTROLLED BY AN FLTK COUNTER
		;imin				= 0											;EQUILIBRIUM POSITION
		;imax				= iSemitoneBendRange * .0833333					;MAX PITCH DISPLACEMENT (IN oct FORMAT)
		;kbend			pchbend	imin, imax							;PITCH BEND VARIABLE (IN oct FORMAT)
		;kfund			= cpsoct	(ioct + kbend)
		;=====================================================================================================================================================================
	;else	
		;iporttime		= 0.05											;PORTAMENTO TIME VARIABLE
		;kporttime		linseg	0,0.001,iporttime,1,iporttime					;CREATE A RAMPING UP FUNCTION TO REPRESENT PORTAMENTO TIME
		;kfund		    portk	p4, kporttime							;APPLY PORTAMENTO SMOOTHING
		;kamp			portk	gkamp, kporttime							;APPLY PORTAMENTO SMOOTHING
	;endif

;kRandRaw = rnd(100)
;kRand = ((kRandRaw/100))
;iRand = i(kRand)
;print iRand
;iPanMin = i(kPanMin)
;print iPanMin
;iPanMax = i(kPanMax)
;print iPanMax
;imod = i(kmod)
;print imod

;ktrig1 changed p5
;ktrig1 init 1
;orderchange:
;imod = i(kmod)
;print imod
;iRand = i(kRand)
;print iRand
;iPMP = i(kPanMidpoint)
;print iPMP
;iPR = i(kPanRange)
;print iPR
;rireturn
;if ktrig1 == 1 then ;at first k-cycle ...
;reinit orderchange
;endif 

;;; - Envelopes
kEnv madsr iAmpA, iAmpD, iAmpS, iAmpR
kFilterEnv madsr iFltEnvA, iFltEnvD, iFltEnvS, iFltEnvR
kFMEnv madsr iModEnvA, iModEnvD, iModEnvS, iModEnvR
kPitchEnv madsr iPitchEnvA, iPitchEnvD, iPitchEnvS, iPitchEnvR


;;; - Microtuning Setup
;ktuner() init 1
ktunescalerootpositive = 1-((ktunescaleroot/12)-(1/12))
ktunescalerootint = int(ktunescalerootpositive)
ktunescalerootdegree = (ktunescalerootpositive-ktunescalerootint)
knote = octmidinn (p4)
koct = int(knote)
kdegree1 = (knote-koct)
kdegree2 = int(kdegree1*100000)
kdegree3 = (kdegree2/100000)+ktunescalerootdegree
kdegree4 = int(kdegree3)
kdegree = (kdegree3-kdegree4)
printk 1, kdegree, 10
printk 1, ktunescalerootdegree, 20
if kdegree == 0.00000 then
knote = knote + (0.0008333 * ktuneroot)
endif
if kdegree == 0.08333 then
knote = knote + (0.0008333 * ktuneflattwo)
endif
if kdegree == 0.16666 then
knote = knote + (0.0008333 * ktunetwo)
endif
if kdegree = 0.25000 then
knote = knote + (0.0008333 * ktuneflatthree)
printk 1, knote, 5
endif
if kdegree = 0.33333 then
knote = knote + (0.0008333 * ktunethree)
endif
if kdegree = 0.41666 then
knote = knote + (0.0008333 * ktunefour)
endif
if kdegree = 0.50000 then
knote = knote + (0.0008333 * ktunetritone)
endif
if kdegree = 0.58333 then
knote = knote + (0.0008333 * ktunefive)
endif
if kdegree = 0.66667 then
knote = knote + (0.0008333 * ktuneflatsix)
endif
if kdegree = 0.75000 then
knote = knote + (0.0008333 * ktunesix)
endif
if kdegree = 0.83333 then
knote = knote + (0.0008333 * ktuneflatseven)
endif
if kdegree = 0.91666 then
knote = knote + (0.0008333 * ktuneseven)
endif



;;; - Oscilator
kbend pchbend 0, .166667
;kpch = pchmidinn (p4)
kcps cpsoct knote+kbend
aOut foscil p5, (kcps+(kPitchEnv*kPitchEnvAmount)), kcar, kmod, kndx*kFMEnv, 1
printk 20, knote


;;; - Pan Randomizer
kRandom random kPanMin, kPanMax
iRandom = i(kRandom)
aOut1, aOut2 pan2 aOut, iRandom


;;; - Distortion
kGain chnget "DistortionPostGain"
kPregain chnget "DistortionPreGain"
kShape chnget "DistortionShape"
kMix chnget "DistortionMix"
kMixNeg = (1*(1-kMix))

kDistortionOnOff chnget "DistortionOnOff"
if kDistortionOnOff == 0 then
kMix = 0.0
kMixNeg = 1.0
endif

aOutDist1	distort1	aOut1, kPregain, kGain, kShape, kShape, 1
aOutDist2	distort1	aOut2, kPregain, kGain, kShape, kShape, 1

aoutgainL = (aOutDist1*kMix)
aoutgainR = (aOutDist2*kMix)
aoutcleanL = (aOut1*kMixNeg)
aoutcleanR = (aOut2*kMixNeg)
aoutL = aoutgainL+aoutcleanL
aoutR = aoutgainR+aoutcleanR

kMeter = abs(aoutL*aoutR)
chnset kMeter, "meter"


;;; - Filter
aOut1FINAL moogladder aoutL, (kCutoff+(kFilterEnv*kFilterEnvAmount)), kRes
aOut2FINAL moogladder aoutR, (kCutoff+(kFilterEnv*kFilterEnvAmount)), kRes


;;; - Outs
outs aOut1FINAL*kEnv, aOut2FINAL*kEnv


endin




;;; Current Problems
;     - Aliasing
;     - Must play a note to initialize alpha change for diabled effects
;     - Mono Button 





</CsInstruments>
<CsScore>
;causes Csound to run for about 7000 years...
f0 z
f 1 0 16384 10 1
</CsScore>
</CsoundSynthesizer>

Hey @sambyrdmusic. I edited your post to format the code. Don’t be annoyed, I’m really pedantic about it! Ask anyone, they’ll all tell you :joy:

You GUI won’t update until instr 1 is performing, or someone moves the sliders themselves. If you need GUI to be updating all the time, or even between notes, you’ll need to put the GUI stuff into an instrument that is always on. In your case it might take a bit of reworking, but it’s a better strategy long term to separate things.

I’m not hearing any distortion here? But, if you remove the -m0d from your CsOptions section you will start to get some Csound console messages that might prove helpful when developing the instruments. For a start, it will report if there are samples out of range.

You’re doing this:

kAmpA chnget "AmpA"
kAmpD chnget "AmpD"
kAmpS chnget "AmpS"
kAmpR chnget "AmpR"

And later casting them as i-rate. You can just do this:

iAmpA chnget "AmpA"
iAmpD chnget "AmpD"
iAmpS chnget "AmpS"
iAmpR chnget "AmpR"

This I can’t say much about that at the minute because I’m writing from a laptop with pretty awful speakers. Are you saying that simply repeating the very same note in fairly quick succession gives you inconsistent results?

If so, perhaps you might try building a much simpler instrument to showcase this particular problem. Note that if you have overlapping notes this might cause some interesting side-effects, but I suspect this is not the case here?

Thank you for formatting my text! I wasn’t sure how to do it myself.

I have applied your advice and have made significant progress.
The “aliasing” sound i mentioned seems to have disappeared… I don’t know how I got rid of it.
Presently I’m struggling with polyphony.
When I have all of my oscillators and effects in one instrument, my synth allows for polyphony, but the tail of the Reverb is cut short once the note ends.
When I separate my sound generators from the rest of my effects, the reverb tail goes uncut and sounds lush- but my synth only allows for monophonic playback.
What am I missing?

I apologize for my very sloppy code, I know it must be tiring to sift through.
I am omitting my widget code, and an instrument dedicated to receiving info from widgets, as they make this message too large.

instr 100


;;; - Receiving Info from Channels
gkmod chnget "ratio"
gkndx chnget "index"
gk2mod chnget "2ratio"
gk2ndx chnget "2index"
gkPanMin chnget "pansliderMin"
gkPanMax chnget "pansliderMax"
gk2PanMin chnget "2pansliderMin"
gk2PanMax chnget "2pansliderMax"
gkcar = 1
;iAmpA chnget "AmpA"
gkAmpA chnget "AmpA"
gkAmpD chnget "AmpD"
gkAmpS chnget "AmpS"
gkAmpR chnget "AmpR"
;kAmpA init iAmpA
;printk 0.5, kAmpA, 30
gkModEnvA chnget "ModEnvA"
gkModEnvD chnget "ModEnvD"
gkModEnvS chnget "ModEnvS"
gkModEnvR chnget "ModEnvR"
gk2AmpA chnget "2AmpA"
gk2AmpD chnget "2AmpD"
gk2AmpS chnget "2AmpS"
gk2AmpR chnget "2AmpR"
gk2ModEnvA chnget "2ModEnvA"
gk2ModEnvD chnget "2ModEnvD"
gk2ModEnvS chnget "2ModEnvS"
gk2ModEnvR chnget "2ModEnvR"
gkFltEnvA chnget "FiltA"
gkFltEnvD chnget "FiltD"
gkFltEnvS chnget "FiltS"
gkFltEnvR chnget "FiltR"
gkPitchEnvA chnget "PitchA"
gkPitchEnvD chnget "PitchD"
gkPitchEnvS chnget "PitchS"
gkPitchEnvR chnget "PitchR"
gkOsc1amp chnget "Osc1Gain"
gkOsc2amp chnget "Osc2Gain"
gkMono chnget "PanMono"
gktunescaleroot chnget "tunescaleroot"
gktuneroot chnget "tuneroot"
gktuneflattwo chnget "tuneflattwo"
gktunetwo chnget "tunetwo"
gktuneflatthree chnget "tuneflatthree"
gktunethree chnget "tunethree"
gktunefour chnget "tunefour"
gktunetritone chnget "tunetritone"
gktunefive chnget "tunefive"
gktuneflatsix chnget "tuneflatsix"
gktunesix chnget "tunesix"
gktuneflatseven chnget "tuneflatseven"
gktuneseven chnget "tuneseven"
gkCutoff chnget "FilterCutoff"
gkFilterEnvAmount chnget "FEnvAmount"
gkPitchEnvAmount chnget "PEnvAmount"
gkRes chnget "Reso"
gkOsc1DistOut chnget "Osc1DistOut"
gkOsc1ChorOut chnget "Osc1ChorOut"
gkOsc1VerbOut chnget "Osc1VerbOut"
gkOsc1CleanOut chnget "Osc1CleanOut"
gkOsc2DistOut chnget "Osc2DistOut"
gkOsc2ChorOut chnget "Osc2ChorOut"
gkOsc2VerbOut chnget "Osc2VerbOut"
gkOsc2CleanOut chnget "Osc2CleanOut"
gkDistChorOut chnget "DistChorOut"
gkDistVerbOut chnget "DistVerbOut"
gkDistCleanOut chnget "DistCleanOut"
gkChorDistOut chnget "ChorDistOut"
gkChorVerbOut chnget "ChorVerbOut"
gkChorCleanOut chnget "ChorCleanOut"
;gkVerbDistOut chnget "VerbDistOut"
;gkVerbChorOut chnget "VerbChorOut"
gkVerbCleanOut chnget "VerbCleanOut"
gkVerbSize chnget "VerbSize"
gkVerbBrilliance chnget "VerbBrilliance"

;;; - MicroTuning LFOs
ktuneLFOamountroot chnget "tuneLFOamountroot"
ktuneLFOfrequencyroot chnget "tuneLFOfrequencyroot"
gktuneLFOroot oscil (ktuneLFOamountroot/12), ktuneLFOfrequencyroot

ktuneLFOamountflattwo chnget "tuneLFOamountflattwo"
ktuneLFOfrequencyflattwo chnget "tuneLFOfrequencyflattwo"
gktuneLFOflattwo oscil (ktuneLFOamountflattwo/12), ktuneLFOfrequencyflattwo

ktuneLFOamounttwo chnget "tuneLFOamounttwo"
ktuneLFOfrequencytwo chnget "tuneLFOfrequencytwo"
gktuneLFOtwo oscil (ktuneLFOamounttwo/12), ktuneLFOfrequencytwo

ktuneLFOamountflatthree chnget "tuneLFOamountflatthree"
ktuneLFOfrequencyflatthree chnget "tuneLFOfrequencyflatthree"
gktuneLFOflatthree oscil (ktuneLFOamountflatthree/12), ktuneLFOfrequencyflatthree

ktuneLFOamountthree chnget "tuneLFOamountthree"
ktuneLFOfrequencythree chnget "tuneLFOfrequencythree"
gktuneLFOthree oscil (ktuneLFOamountthree/12), ktuneLFOfrequencythree

ktuneLFOamountfour chnget "tuneLFOamountfour"
ktuneLFOfrequencyfour chnget "tuneLFOfrequencyfour"
gktuneLFOfour oscil (ktuneLFOamountfour/12), ktuneLFOfrequencyfour

ktuneLFOamounttritone chnget "tuneLFOamounttritone"
ktuneLFOfrequencytritone chnget "tuneLFOfrequencytritone"
gktuneLFOtritone oscil (ktuneLFOamounttritone/12), ktuneLFOfrequencytritone

ktuneLFOamountfive chnget "tuneLFOamountfive"
ktuneLFOfrequencyfive chnget "tuneLFOfrequencyfive"
gktuneLFOfive oscil (ktuneLFOamountfive/12), ktuneLFOfrequencyfive


ktuneLFOamountflatsix chnget "tuneLFOamountflatsix"
ktuneLFOfrequencyflatsix chnget "tuneLFOfrequencyflatsix"
gktuneLFOflatsix oscil (ktuneLFOamountflatsix/12), ktuneLFOfrequencyflatsix

ktuneLFOamountsix chnget "tuneLFOamountsix"
ktuneLFOfrequencysix chnget "tuneLFOfrequencysix"
gktuneLFOsix oscil (ktuneLFOamountsix/12), ktuneLFOfrequencysix

ktuneLFOamountflatseven chnget "tuneLFOamountflatseven"
ktuneLFOfrequencyflatseven chnget "tuneLFOfrequencyflatseven"
gktuneLFOflatseven oscil (ktuneLFOamountflatseven/12), ktuneLFOfrequencyflatseven

ktuneLFOamountseven chnget "tuneLFOamountseven"
ktuneLFOfrequencyseven chnget "tuneLFOfrequencyseven"
gktuneLFOseven oscil (ktuneLFOamountseven/12), ktuneLFOfrequencyseven


;;; - Pitchbend & Portamento
;if p4!=0 then														;MIDI
	;ioct		= p4										;READ OCT VALUE FROM MIDI INPUT
	;iamp		= p5 * 0.5											;READ IN A NOTE VELOCITY VALUE FROM THE MIDI INPUT
	;kamp = iamp * gkamp												;SET kamp TO MIDI KEY VELOCITY MULTIPLIED BY FLTK SLIDER VALUE gkamp

	;PITCH BEND===========================================================================================================================================================
	;iSemitoneBendRange	= (cpsmidi									;PITCH BEND RANGE IN SEMITONES (WILL BE DEFINED FURTHER LATER) - SUGGESTION - THIS COULD BE CONTROLLED BY AN FLTK COUNTER
	;imin				= 0											;EQUILIBRIUM POSITION
	;imax				= iSemitoneBendRange * .0833333					;MAX PITCH DISPLACEMENT (IN oct FORMAT)
	;kbend			pchbend	imin, imax							;PITCH BEND VARIABLE (IN oct FORMAT)
	;kfund			= cpsoct	(ioct + kbend)
	;=====================================================================================================================================================================
;else	
	;iporttime		= 0.05											;PORTAMENTO TIME VARIABLE
	;kporttime		linseg	0,0.001,iporttime,1,iporttime					;CREATE A RAMPING UP FUNCTION TO REPRESENT PORTAMENTO TIME
	;kfund		    portk	p4, kporttime							;APPLY PORTAMENTO SMOOTHING
	;kamp			portk	gkamp, kporttime							;APPLY PORTAMENTO SMOOTHING
;endif

;kRandRaw = rnd(100)
;kRand = ((kRandRaw/100))
;iRand = i(kRand)
;print iRand
;iPanMin = i(kPanMin)
;print iPanMin
;iPanMax = i(kPanMax)
;print iPanMax
;imod = i(kmod)
;print imod

;ktrig1 changed p5
;ktrig1 init 1
;orderchange:
;imod = i(kmod)
;print imod
;iRand = i(kRand)
;print iRand
;iPMP = i(kPanMidpoint)
;print iPMP
;iPR = i(kPanRange)
;print iPR
;rireturn
;if ktrig1 == 1 then ;at first k-cycle ...
;reinit orderchange
;endif 
endin



prealloc 1, 16
maxalloc 1, 16



instr 1


;;; - Envelopes
gkEnv madsr i(gkAmpA), i(gkAmpD), i(gkAmpS), i(gkAmpR)
gk2Env madsr i(gk2AmpA), i(gk2AmpD), i(gk2AmpS), i(gk2AmpR)
gkFilterEnv madsr i(gkFltEnvA), i(gkFltEnvD), i(gkFltEnvS), i(gkFltEnvR)
gkFMEnv madsr i(gkModEnvA), i(gkModEnvD), i(gkModEnvS), i(gkModEnvR)
gk2FMEnv madsr i(gk2ModEnvA), i(gk2ModEnvD), i(gk2ModEnvS), i(gk2ModEnvR)
gkPitchEnv madsr i(gkPitchEnvA), i(gkPitchEnvD), i(gkPitchEnvS), i(gkPitchEnvR)


;;; - Microtuning Setup
;ktuner() init 1
ktunescalerootpositive1 = 1-((gktunescaleroot/12)-(1/12))
ktunescalerootpositive2 = int(ktunescalerootpositive1*100000)
ktunescalerootpositive = (ktunescalerootpositive2/100000)
ktunescalerootint = int(ktunescalerootpositive)
ktunescalerootdegree = (ktunescalerootpositive-ktunescalerootint)
knote = octmidinn (p4)
koct = int(knote)
kdegree1 = (knote-koct)
kdegree2 = int(kdegree1*100000)
kdegree3 = (kdegree2/100000)+ktunescalerootdegree
kdegree4 = int(kdegree3)
kdegree = (kdegree3-kdegree4)
if kdegree == 0.00000 then
knote = knote + (0.0008333 * gktuneroot)+(gktuneLFOroot)
endif
if kdegree == 0.08333 then
knote = knote + (0.0008333 * gktuneflattwo)+(gktuneLFOflattwo)
endif
if kdegree == 0.16666 then
knote = knote + (0.0008333 * gktunetwo)+(gktuneLFOtwo)
endif
if kdegree = 0.25000 then
knote = knote + (0.0008333 * gktuneflatthree)+(gktuneLFOflatthree)
endif
if kdegree = 0.33333 then
knote = knote + (0.0008333 * gktunethree)+(gktuneLFOthree)
endif
if kdegree = 0.41666 then
knote = knote + (0.0008333 * gktunefour)+(gktuneLFOfour)
endif
if kdegree = 0.50000 then
knote = knote + (0.0008333 * gktunetritone)+(gktuneLFOtritone)
endif
if kdegree = 0.58333 then
knote = knote + (0.0008333 * gktunefive)+(gktuneLFOfive)
endif
if kdegree = 0.66666 then
knote = knote + (0.0008333 * gktuneflatsix)+(gktuneLFOflatsix)
endif
if kdegree = 0.75000 then
knote = knote + (0.0008333 * gktunesix)+(gktuneLFOsix)
endif
if kdegree = 0.83333 then
knote = knote + (0.0008333 * gktuneflatseven)+(gktuneLFOflatseven)
endif
if kdegree = 0.91666 then
knote = knote + (0.0008333 * gktuneseven)+(gktuneLFOseven)
endif


;;; - Oscilator 1
;ivel		ampmidi	1
kbend pchbend 0, .166667
;kpch = pchmidinn (p4)
kcps cpsoct knote+kbend
aOut foscil p5*gkOsc1amp*gkEnv, (kcps+(gkPitchEnv*gkPitchEnvAmount)), 1, gkmod, gkndx*gkFMEnv, 1
;printk 20, knote


;;; - Pan Randomizer 1
kRandom random gkPanMin, gkPanMax
iRandom = i(kRandom)
aOut1, aOut2 pan2 aOut, iRandom

ga1OutDist1 = (aOut1*gkOsc1DistOut)
ga1OutDist2 = (aOut2*gkOsc1DistOut)
ga1OutChor1 = (aOut1*gkOsc1ChorOut)
ga1OutChor2 = (aOut2*gkOsc1ChorOut)
ga1OutVerb1 = (aOut1*gkOsc1VerbOut)
ga1OutVerb2 = (aOut2*gkOsc1VerbOut)
ga1OutClean1 = (aOut1*gkOsc1CleanOut)
ga1OutClean2 = (aOut2*gkOsc1CleanOut)
;MixerSend ga1OutDist1, 1, 1, 1
;MixerSend ga1OutDist2, 1, 1, 2

;;; - Oscilator 2
;ivel		ampmidi	1
;kbend pchbend 0, .166667
;kpch = pchmidinn (p4)
;kcps cpsoct knote+kbend
a2Out foscil p5*gkOsc2amp*gk2Env, (kcps+(gkPitchEnv*gkPitchEnvAmount)), 1, gk2mod, gk2ndx*gk2FMEnv, 1

;;; - Pan Randomizer 2
k2Random random gk2PanMin, gk2PanMax
i2Random = i(k2Random)
a2Out1, a2Out2 pan2 a2Out, i2Random

ga2OutDist1 = (a2Out1*gkOsc2DistOut)
ga2OutDist2 = (a2Out2*gkOsc2DistOut)
ga2OutChor1 = (a2Out1*gkOsc2ChorOut)
ga2OutChor2 = (a2Out2*gkOsc2ChorOut)
ga2OutVerb1 = (a2Out1*gkOsc2VerbOut)
ga2OutVerb2 = (a2Out2*gkOsc2VerbOut)
ga2OutClean1 = (a2Out1*gkOsc2CleanOut)
ga2OutClean2 = (a2Out2*gkOsc2CleanOut)

;;; - Distortion
kGain chnget "DistortionPostGain"
kPregain chnget "DistortionPreGain"
kShape chnget "DistortionShape"
kMix chnget "DistortionMix"
kMixNeg = (1*(1-kMix))

kDistortionOnOff chnget "DistortionOnOff"
if kDistortionOnOff == 0 then
kMix = 0.0
kMixNeg = 1.0
elseif kDistortionOnOff == 1 then
kMix = 1.0
kMixNeg = 0.0
endif

aDistIn1 = (ga1OutDist1+ga2OutDist1*kMix)
aDistIn2 = (ga1OutDist2+ga2OutDist2*kMix)
;aDistIn1 MixerReceive 1, 1
;aDistIn2 MixerReceive 1, 2

aOutDist1	distort1	aDistIn1, kPregain, kGain, kShape, kShape, 1
aOutDist2	distort1	aDistIn2, kPregain, kGain, kShape, kShape, 1

aOutDistToChor1 = (aOutDist1*gkDistChorOut)
aOutDistToChor2 = (aOutDist2*gkDistChorOut)
gaOutDistToVerb1 = (aOutDist1*gkDistVerbOut)
gaOutDistToVerb2 = (aOutDist2*gkDistVerbOut)
gaOutDistToClean1 = (aOutDist1*gkDistCleanOut)
gaOutDistToClean2 = (aOutDist2*gkDistCleanOut)

;aoutgainL = (aOutDist1*kMix)
;aoutgainR = (aOutDist2*kMix)
;aoutcleanL = (aDistIn1*kMixNeg) ;+ (ga2Out1*kMixNeg)
;aoutcleanR = (aDistIn2*kMixNeg) ;+ (ga2Out2*kMixNeg)
;aoutL = aoutgainL+aoutcleanL
;aoutR = aoutgainR+aoutcleanR
;kMeter = abs(aoutL*aoutR)
;chnset kMeter, "meter"


;;; - Chorus
kChorusDelayTime chnget "ChorusDelay"
kChorusFeedback chnget "ChorusFeedback"
kChorusFilterCutoff chnget "ChorusFilterCutoff"
aChorusInL = (ga1OutChor1+ga2OutChor1+aOutDistToChor1);+aVerbChorOut1)
aChorusInR = (ga1OutChor2+ga2OutChor2+aOutDistToChor2);+aVerbChorOut2)
;aChorusInL MixerReceive 2, 1
;aChorusInR MixerReceive 2, 2
aChorusOutL wguide1 aChorusInL, kChorusDelayTime, kChorusFilterCutoff, kChorusFeedback
aChorusOutR wguide1 aChorusInR, kChorusDelayTime, kChorusFilterCutoff, kChorusFeedback
;gaChorDistOut1 = (aChorusInL*gkChorDistOut)
;gaChorDistOut2 = (aChorusInR*gkChorDistOut)
gaChorVerbOut1 = (aChorusInL*gkChorVerbOut)
gaChorVerbOut2 = (aChorusInR*gkChorVerbOut)
gaChorCleanOut1 = (aChorusInL*gkChorCleanOut)
gaChorCleanOut2 = (aChorusInR*gkChorCleanOut)
;MixerSend gaChorDistOut1, 1, 1, 1
;MixerSend gaChorDistOut1, 1, 1, 2
;MixerSend gaChorVerbOut1, 1, 3, 1
;MixerSend gaChorVerbOut1, 1, 3, 2
;MixerSend gaChorCleanOut1, 1, 10, 1
;MixerSend gaChorCleanOut1, 1, 10, 2
endin 

prealloc 2, 16
maxalloc 2, 16
instr 2

;;; - Reverb
;instr 1
aVerbInL = (ga1OutVerb1+ga2OutVerb1+gaOutDistToVerb1+gaChorVerbOut1)
aVerbInR = (ga1OutVerb2+ga2OutVerb2+gaOutDistToVerb2+gaChorVerbOut2)

denorm aVerbInL, aVerbInR
aVerbOut1, aVerbOut2 freeverb aVerbInL, aVerbInR, gkVerbSize, gkVerbBrilliance
;aVerbOutWetL = (aVerbOut1*kVerbMix)
;aVerbOutWetR = (aVerbOut2*kVerbMix)
;aVerbOutDryL = (aVerbInL*kVerbMixNeg)
;aVerbOutDryR = (aVerbInR*kVerbMixNeg)
;aVerbOutL = aVerbOutWetL+aVerbOutDryL
;aVerbOutR = aVerbOutWetR+aVerbOutDryR
;outs aoutL*kGain, aoutR*kGain
;aVerbDistOut1 = (aVerbOut1*gkVerbDistOut)
;aVerbDistOut2 = (aVerbOut2*gkVerbDistOut)
;aVerbChorOut1 = (aVerbOut1*gkVerbChorOut)
;aVerbChorOut2 = (aVerbOut2*gkVerbChorOut)
aVerbCleanOut1 = (aVerbOut1*gkVerbCleanOut)
aVerbCleanOut2 = (aVerbOut2*gkVerbCleanOut)


;;; - Filter
aMoogInL = (ga1OutClean1+ga2OutClean1+gaOutDistToClean1+aVerbCleanOut1)
aMoogInR = (ga1OutClean2+ga2OutClean2+gaOutDistToClean2+aVerbCleanOut2)
aOut1FINAL moogladder aMoogInL, (gkCutoff+(gkFilterEnv*gkFilterEnvAmount)), gkRes
aOut2FINAL moogladder aMoogInR, (gkCutoff+(gkFilterEnv*gkFilterEnvAmount)), gkRes


;;; - Outs
;aOut1FINAL MixerReceive 10, 1
;aOut2FINAL MixerReceive 10, 2
outs aOut1FINAL, aOut2FINAL
;MixerClear

endin





</CsInstruments>
<CsScore>
;causes Csound to run for about 7000 years...
f0 z
f 1 0 16384 10 1
;i 1 0 36000000 p4 p5
i 1 0 36000000
i 2 0 36000000
i 99 0 36000000
i 100 0 36000000

</CsScore>
</CsoundSynthesizer>

Also, a few other questions:

You can see some semicoloned lines with MiserSend and MixerReceive opcodes. Whenever i tried to implement them so that i could establish feedback between my effect widgets, cabbage would crash. Is this because of the feedback? How might I make that feedback a possibility?

I dream of selling and digitally distributing my plugins eventually. I saw somewhere that I should ask you how to hide my code from the end user. Further, how could one install my plugins? Do they need to have Csound installed?

This makes sense and is expected.

This should work just fine. I suspect that you are overwriting the signal from the previous instance of your instruments. You should be mixing the output of the instances rather than overwriting them. My advice is to create a simple example and see if it works there. I’d also stay clear of the Miser opcodes. I’m not a fan of them at all, and you can achieve more using plain old channels. In your case you could output your synth signal using an a-rate channel and then chnmix to sum them in your effects instrument. As always, I’d start with a much simpler example and see if you can get it working there first. Then apply the same approach to your large example. Btw, why are you using prealloac and maxalloc?

It’s hard to say. If you can recreate the issue with a full, simple, example I can take a look and see, but I don’t have time to run over hundreds of lines of code right now. Feedback can also be done using channels. But if you want through feedback in the order of a single sample, you’ll need to set ksmps to 1. This will reduce the efficiency of your instrument. But without this, all your feedback will be delayed by ksmps.

You can find more detail about this topic here.