| I've a problem with the .csd below. The $DEPTH macro (0 or 1) either routes
output additionally through a global reverb (i17, reverbsc) or not. CPU
usage with $DEPTH = 0 (no reverb) is 20%; with reverb ($DEPTH = 1) it is a
whopping 80% (with occasional audio breakup). This is far too much of a
"reverb premium" - even processing 15 voices.
A comparable .csd, which does the same with 7 (also always on) voices uses
15% CPU without reverb, 20% with reverb. This is the kind of premium (33%)
that I expect.
Question: what is causing the excessive CPU usage below when $DEPTH = 1?
The issue is crucial because this is one of a series of .csd's I intend to
convert to Activities soon for the OLPC project.
Incidentally, you can run this without MIDI controller as long as at least
one MIDI input device is in your system. All voices are active at all times,
so CPU usage is constant.
Thanks for any and all insight.
Art Hunkins
; ON THE SIXTH DAY: Family (2008) for realtime Csound5 - by Arthur B.
Hunkins
; Sixth-Fam.csd - requires MIDI device with 16 pots/sliders
-odac0 -m0d -M0 --expression-opt -b128 -B2048 -+raw_controller_mode=1
#define CHAN #1# ; 0 = CC7, CHAN 1-16
#define CTRL1 #20# ; bank 1 - 1st # (of 8); valid = 0 - 120
#define CTRL2 #28# ; bank 2 - 1st # (of 8); valid = 0 - 120
#define DEPTH #0# ; 1 = depth; 0 = no depth
#define SRATE #44100# ; SampleRATE choices: 44100, 48000
sr = $SRATE
ksmps = 10
nchnls = 2
seed 0
ga1 init 0
ga2 init 0
gkpan init .5
gkperc init 0
instr 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16
if $DEPTH = 0 goto skip
event_i "i", 17, 0, 3600
skip:
indx = p1 - 1
imult tab_i indx, 3
imult = imult * 55
ictrl = (p1 > 8? $CTRL2 + indx - 8: $CTRL1 + indx)
kamp2 ctrl7 ($CHAN > 0? $CHAN: indx + 1), ($CHAN > 0? ictrl: 7), 0, 1
kamp table kamp2 * 512, 1
kamp port kamp, .01
kmod2 rspline 1.4, 2, 1.5, 2.5
kmod rspline (p1 > 1? .85: .89), 1, 25, 30
kfreq jspline (p1 > 12? .2: .25), 1, 2
kpw jspline p7, 1, 2
kfmod lfo p4, imult
aout vco2 p4 * kamp * kmod * kmod2, imult + (p1 > 1? kfreq: 0) +
(p1 > 12? kfmod: 0), p5, p6 + kpw
ktrig trigger kamp2, .01, 0
if ktrig == 0 goto skip2
krand rnd31 .5, .7
krand = (p1 > 1? krand: 0)
if ($DEPTH = 0) || (p1 = 1) goto skip2
kdepth unirand .9
kdepth = (p1 > 1? kdepth: 0)
skip2:
a1,a2,a3,a4 pan aout, .5 + (kamp2 * krand), 1, 2, 1
if ($DEPTH = 0) || (p1 = 1) goto skip3
ga1 = ga1 + (a1 * kdepth)
ga2 = ga2 + (a2 * kdepth)
a1a = a1 * (1 - kdepth)
a2a = a2 * (1 - kdepth)
outs a1a - (.2 * a2a), a2a - (.2 * a1a)
goto fin
skip3:
outs a1 - (.2 * a2), a2 - (.2 * a1)
fin: endin
instr 17
aL, aR reverbsc ga1, ga2, .95, 800, sr, .25
outs aL * .4, aR * .4
ga1 = 0
ga2 = 0
endin
f1 0 512 16 1 511 2.2 1000
f2 0 8193 7 0 8193 1
f3 0 16 -2 1 2 3 5 7 8 9 10 1 2 3 4 5 6 7 8
i1 0 3600 3000 4 .5 .015 0
i2 0 3600 1700 4 .6 .02 0
i3 0 3600 1600 4 .7 .02 0
i4 0 3600 1200 4 .8 .017 0
i5 0 3600 700 4 .9 .014 0
i6 0 3600 700 4 .95 .01 0
i7 0 3600 400 2 .5 .02 0
i8 0 3600 400 2 .6 .02 0
i9 0 3600 750 2 .7 .02 0
i10 0 3600 950 2 .8 .02 0
i11 0 3600 950 2 .9 .017 0
i12 0 3600 1000 2 .95 .014 0
i13 0 3600 1500 4 .6 .02
i14 0 3600 1500 4 .7 .02
i15 0 3600 1300 4 .8 .02
i16 0 3600 1450 4 .9 .02
e
|