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>