Csound Csound-dev Csound-tekno Search About

[Csnd] vco2 issue

Date2018-08-06 17:01
FromJohn
Subject[Csnd] vco2 issue
Just a small thought which may be very wrong

lfo3 has a range of [o-1] in the slider so as it is a sine oscillator
that is klfo3 is in range {-1,+1].

In use you multiply it by 0.5 so kpw is in range [-0.5,+0.5]
Perhaps you mean 0.5+klfo3 ?

Ignore me if this is rubbish.....
==John ffitch

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Date2018-08-07 15:07
Frombrian@AMSYNTH.COM
SubjectRe: [Csnd] vco2 issue (SOLVED)

Solved! Thanks a million, John!

I had tried addition rather than multiplication, but the min/max values were probably still too out of range. From what I see (and seems to confirm in the Csound Manual about VCO2, waveform 2) is that around the 0 and 1 values there can be glitches. So, staying away from those extremes, things sound fine. For the record, below is the new code, with the error eliminated. Thanks again!

 

<CsoundSynthesizer>
<CsOptions>

-odac -+rtaudio=jack -+rtmidi=alsa -Ma -dm0
</CsOptions>
<CsInstruments>

sr=48000
ksmps=64
nchnls=2
0dbfs=1

;panel
FLcolor        233, 185, 110, 0, 0, 0
FLpanel     "Adventure StartsMalter",1010,550,300,100,4,-1,1
FLvkeybd    "keyboard.map",960,90,20,430
gkonoff,ihb2    FLbutton "On/Off",0,1,2,100,30,20,20,0,1,0,0
gk3,ihb4    FLbutton "Exit",1,0,21,100,30,20,70,0,2,0,0


;displays for Cut-Q-LFO Flsliders
ihval1    FLvalue    "",60,30,520,20
ihval2    FLvalue "",60,30,520,70
ihval3    FLvalue "",60,30,520,120
ihval3b    FLvalue "",60,30,520,155

;display for Detune Flknob
ihval3c    FLvalue "",60,30,110,135

;displays for Amp Env Flsliders
ihval4    FLvalue "",60,30,260,120+80
ihval5    FLvalue "",60,30,260,120+130
ihval6    FLvalue "",60,30,260,120+180
ihval7    FLvalue "",60,30,260,120+230

;displays for Fil Env Flsliders
ihval8    FLvalue "",60,30,520,120+80
ihval9    FLvalue "",60,30,520,120+130
ihval10    FLvalue "",60,30,520,120+180
ihval11    FLvalue "",60,30,520,120+230

;display for Volume
ihval12    FLvalue "",60,30,780,20


;displays for extra LFOs
ihval13    FLvalue "",60,30,780,70
ihval14    FLvalue "",60,30,780,120
ihval15    FLvalue "",60,30,780,170
ihval16    FLvalue "",60,30,780,220


;kout,ihandle    Flslider  "", imin, imax, iexp, itype, idisp, iwidth, iheight,  ix, iy

gkfreq,gih1 FLslider    "Cutoff", 300, (sr)/2, 0, 25, ihval1, 355, 25, 143, 20
gkreso,gih2 FLslider    "Resonance", 0.1, 0.80, 0, 25, ihval2, 355, 25, 143, 70
gklfo,gih3  FLslider    "LFO-level", 0, 30, 0, 25, ihval3, 155, 25, 343, 120
gkrate,gih3b FLslider    "LFO-rate", 0, 30, 0, 25, ihval3b, 155, 25, 343, 160
gkdet,gih3c   FLknob   "Detune", 0, 4.0, 0, 1, ihval3c, 60, 40, 120
;FLTK-COUNTERS                        MIN | MAX | STEP1 | STEP2 | TYPE | WIDTH | HEIGHT | X | Y | OPCODE
gkBendRange, ihBendRange     FLcount  "Bend Range",    -48,   48,    1,      1,      2,     100,     25,  210, 120,   -1


;adsr volume
gkatt,gih4    FLslider    "A. attack",0.001, 4, 0, 25, ihval4, 155, 30, 90, 200
gkdec,gih5    FLslider    "A. decay",0.001, 4, 0, 25, ihval5, 155, 30, 90, 250
gksus,gih6    FLslider    "A. sustain",0.001, 1, 0, 25, ihval6, 155, 30, 90, 300
gkrel,gih7    FLslider    "A. release",0.001, 4, 0, 25, ihval7, 155, 30, 90, 350

;adsr moog filter
gkatt2,gih8    FLslider    "F. attack",0.001, 4, 0, 25, ihval8, 155, 30, 343, 200
gkdec2,gih9    FLslider    "F. decay",0.001, 4, 0, 25, ihval9, 155, 30, 343, 250
gksus2,gih10    FLslider    "F. sustain",0.001, 1, 0, 25, ihval10, 155, 30, 343, 300
gkrel2,gih11    FLslider    "F. release",0.001, 4, 0, 25, ihval11, 155, 30, 343, 350

;volume
gkamp,gih12    FLslider    "Volume", 0, .5, 0, 25, ihval12, 155, 30, 600, 20

;extra LFOs
gklfo2,gih13    FLslider    "Reso-LFO Level", 0, 0.3, 0, 25, ihval13, 155, 30, 600, 70
gkrate2,gih14    FLslider    "Reso-LFO Rate", 0, 10, 0, 25, ihval14, 155, 30, 600, 120
gklfo3,gih15    FLslider    "PWM-LFO Level", 0.1, 0.5, 0, 25, ihval15, 155, 30, 600, 170
gkrate3,gih16    FLslider    "PWM-LFO Rate", 0, 10, 0, 25, ihval16, 155, 30, 600, 220

FLpanel_end
FLrun

;initial values
FLsetVal_i    19148,gih1    ;init Cutoff value
FLsetVal_i    0.59055,gih2    ;init Q value
FLsetVal_i    2.126,gih3    ;init LFO level
FLsetVal_i    5.7353,gih3b    ;init LFO rate
FLsetVal_i    1.0079,gih3c    ;init Detune value
FLsetVal_i    2,ihBendRange    ;init Pitch Bend value

;amplitude envelope:
FLsetVal_i    0.01,gih4    ;init value attack
FLsetVal_i    2.5263,gih5    ;init value decay
FLsetVal_i    0.70706,gih6     ;init value sustain
FLsetVal_i    1.9248,gih7    ;init value release

;filter envelope:
FLsetVal_i    0.01,gih8    ;init value attack
FLsetVal_i    2.3459,gih9    ;init value decay
FLsetVal_i    0.09113,gih10    ;init value sustain
FLsetVal_i    1.8947,gih11    ;init value release

;initial volume level
FLsetVal_i    0.14567,gih12        ;init value volume

;initial sens level
FLsetVal_i    0.12782,gih13        ;init value filtLFOlevel
FLsetVal_i    9.9248,gih14        ;init value filtLFOrate
FLsetVal_i    0.28,gih15        ;init value PWMLFOlevel
FLsetVal_i    0.5,gih16        ;init value PWMLFOrate

instr 1

if gkonoff    =    1    then
turnoff
endif

iamp    ampmidi    .5
ifreq    cpsmidi

kamp = iamp
kmax = 10
kmin = 0
imin = 0
imax = 1
ichan = 1
ictlno = 1
ivel1 veloc 0,1
ivel2 veloc 0,1

print ivel1

kdest    ctrl7    ichan, ictlno, kmin, kmax

k1    ctrl7    1,1,0,30
ktrig    changed    k1
FLsetVal    ktrig,k1,gih3

k2    ctrl7    1,91,0,(sr)/2
ktrig    changed    k2
FLsetVal    ktrig,k2,gih12

k3    ctrl7    1,73,0.1,0.99
ktrig    changed    k3
FLsetVal    ktrig,k3,gih2

k4    ctrl7    1,74,0,4.0
ktrig    changed    k4
FLsetVal    ktrig,k4,gih3c

k5    ctrl7    1,71,0,30
ktrig    changed    k5
FLsetVal    ktrig,k5,gih3b

k6    ctrl7    1,72,300,24000
ktrig    changed    k6
FLsetVal    ktrig,k6,gih1


kbend    pchbend    imin,imax
kbend = kbend*gkBendRange
kbend = semitone(kbend)

kporttime    linseg    0,0.1,0.01
kbend    portk    kbend,kporttime

klfo    lfo    gklfo,gkrate,1
klfo2    lfo    gklfo2,gkrate2,1
klfo3    lfo    gklfo3,gkrate3,1

avco1 vco2    gkamp,(ifreq*kbend)+(klfo*kdest),4,(0.1+ivel1)
avco2 vco2    gkamp,(ifreq*kbend*gkdet)+(klfo*kdest),2,(0.5+klfo3)
asum    sum    avco1*ivel1,avco2*ivel1
kadsrfilt    madsr        i(gkatt2),i(gkdec2),i(gksus2),i(gkrel2),0,1
afilt    moogladder    asum,(gkfreq*kadsrfilt)*ivel2,gkreso+(klfo2)

kadsr         madsr        i(gkatt),i(gkdec),i(gksus),i(gkrel),0,1
outs    afilt*kadsr,afilt*kadsr

endin

instr 2
exitnow
endin


</CsInstruments>
<CsScore>

i 1  0 [3600*24*7]

</CsScore>
</CsoundSynthesizer>

 

brian

 

 

On Mon, 6 Aug 2018 17:01:07 +0100, John wrote:

Just a small thought which may be very wrong

lfo3 has a range of [o-1] in the slider so as it is a sine oscillator
that is klfo3 is in range {-1,+1].

In use you multiply it by 0.5 so kpw is in range [-0.5,+0.5]
Perhaps you mean 0.5+klfo3 ?

Ignore me if this is rubbish.....
==John ffitch

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here