I am experiencing a weird behaviour that I cannot understand using a combination of vco2
, distort
and the moogvcf2
filter. With certain parameter settings, the output simply stops working and cannot be recovered (so it stays silent even after changing the parameters back to values that were producing sound before). I guess something is getting zeroed, but I cannot understand why it can happen.
I have a single instrument that gets triggered once and stays alive for the whole performance.
This is the shortest code that reproduces this behaviour. Controls are made in Cabbage but you can easily reproduce the issue setting kDist
to 0.99, kFiltFreq
to 3000 and kFiltRes
to anything above 0.44:
Interestingly, if I set kFiltRes
to 0.43 (I tried values up to 0.430178396377), it is working for some seconds, then it stops, after producing some strange modulation, that looks very suspicious. Any value above that simply doesnât produce sound from the start.
<Cabbage>
form caption("DIST FILT VCO") size(400, 300), guiMode("queue"), pluginId("def1")
vslider bounds(10, 10, 60, 150), valueTextBox(1), textBox(1), text("Distortion"), channel("dist"), range(0.05, 0.99, 0.75)
rslider bounds(80, 10, 80, 80), valueTextBox(1), textBox(1), text("Filter Freq"), channel("filtFreq"), range(0.01, 3000, 1200)
rslider bounds(80, 90, 80, 80), valueTextBox(1), textBox(1), text("Filter Res"), channel("filtRes"), range(0.01, 0.99, 0.2)
</Cabbage>
<CsoundSynthesizer>
<CsOptions>
-n -d
</CsOptions>
<CsInstruments>
ksmps = 32
nchnls = 2
0dbfs = 1
;giTanh ftgen 0,0, 257, 9, .5,1,270,1.5,.33,90,2.5,.2,270,3.5,.143,90,4.5,.111,270
giTanh ftgen 2,0,257,"tanh",-10,10,0 ; same behaviour with both tanh functions
instr 1
kDist init 0.99
kFiltFreq init 3000
kFiltRes init 0.43 ; change this to 0.430178396377 and it stops producing sound
kDist chnget "dist"
kFiltFreq chnget "filtFreq"
kFiltRes chnget "filtRes"
aVco vco2 0.9, 200
aDist distort aVco, 1 - kDist, giTanh
aFilt moogvcf2 aDist, kFiltFreq, kFiltRes
aEnv madsr 0.1, 0.001, 1, 0.1
aSig = aFilt * aEnv
outs aSig, aSig
endin
</CsInstruments>
<CsScore>
i1 0 z
</CsScore>
</CsoundSynthesizer>
It would be nice to understand what Iâm doing wrong!
I strongly suspect that a combination of the hyperbolic tangent function with the filter can lead to no output, but Iâm not sure why, so Iâd like to know if I can overcome this in some way.
Also Iâm not completely sure why I have to invert the kDist value if using vco2, the distort
opcode behaves in the opposite way with it compared to other oscillators.