Csound Csound-dev Csound-tekno Search About

[Csnd] Instrument design, efficiency and compilation in Csound6

Date2014-04-04 10:51
FromDave Mooney
Subject[Csnd] Instrument design, efficiency and compilation in Csound6
Hi just question about instrument design, efficiency and compilation with
cs6: If for example I build an instrument which contains say 1000 oscilli
oscillator opcodes (or really any number of sound producing/ processing
opcodes) when I compile this instrument and trigger it a MIDI keyboard my
cpu is at 30%; Is it possible with Csound 6 or possibly even with Csound 5
to deactivate sections of code perhaps using if statements to release the
CPU power back? 

Say I have an instrument with 1000 oscillators in it and 999 of these are
placed in an if statement block such that they only run when a UI toggle
switch is enabled; With the button on in total we have 1000 oscillators
going, with the button off we should have one oscillator going. Is it
possible to do this with Csound 6 so that when one oscillator is going only
the signal for that one oscillator is calculated, and when 1000 signal are
going the cpu resources required go up and then switching back to one
oscillator they go back down again? I found that with cs5 when I deactivated
section of code during run time the resources were not reallocated and the
test described above would require the roughly same level CPU even though
there were large differences in what was being output. 

In a general sense I’m wondering how to isolate sections of code during run
time and release resource back if sections are not being used. Can anybody
advise me on how best to do this or whether I’ve been approaching this
problem the wrong way?  Thanks a million!




--
View this message in context: http://csound.1045644.n5.nabble.com/Instrument-design-efficiency-and-compilation-in-Csound6-tp5733874.html
Sent from the Csound - General mailing list archive at Nabble.com.


Date2014-04-04 12:19
FromOeyvind Brandtsegg
SubjectRe: [Csnd] Instrument design, efficiency and compilation in Csound6
I haven't testet recently, but seem to recall that I have bypassed
sections of processing like you want to do (also with csound5, as this
was a while ago).
As far as I understand, if you use a conditional block, the work
inside the block will not be done and should not require CPU
resources.
say we have

a2 init 0
a3 init 0
a1 oscil ...
if kswitch > 0 then
a2 oscil ...
a3 oscil ...
endif
aout = a1+a2+a3

Here I'd expect oscillator 2 and 3 to not use CPU power during a
k-cycle where the kswitch is zero.
They will be initialized though, and need to be, otherwise we'd get
problems when turning the kswitch on while the instr is running

Oeyvind


2014-04-04 11:51 GMT+02:00 Dave Mooney :
> Hi just question about instrument design, efficiency and compilation with
> cs6: If for example I build an instrument which contains say 1000 oscilli
> oscillator opcodes (or really any number of sound producing/ processing
> opcodes) when I compile this instrument and trigger it a MIDI keyboard my
> cpu is at 30%; Is it possible with Csound 6 or possibly even with Csound 5
> to deactivate sections of code perhaps using if statements to release the
> CPU power back?
>
> Say I have an instrument with 1000 oscillators in it and 999 of these are
> placed in an if statement block such that they only run when a UI toggle
> switch is enabled; With the button on in total we have 1000 oscillators
> going, with the button off we should have one oscillator going. Is it
> possible to do this with Csound 6 so that when one oscillator is going only
> the signal for that one oscillator is calculated, and when 1000 signal are
> going the cpu resources required go up and then switching back to one
> oscillator they go back down again? I found that with cs5 when I deactivated
> section of code during run time the resources were not reallocated and the
> test described above would require the roughly same level CPU even though
> there were large differences in what was being output.
>
> In a general sense I'm wondering how to isolate sections of code during run
> time and release resource back if sections are not being used. Can anybody
> advise me on how best to do this or whether I've been approaching this
> problem the wrong way?  Thanks a million!
>
>
>
>
> --
> View this message in context: http://csound.1045644.n5.nabble.com/Instrument-design-efficiency-and-compilation-in-Csound6-tp5733874.html
> Sent from the Csound - General mailing list archive at Nabble.com.
>
>
> Send bugs reports to
>         https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>
>
>



-- 

Oeyvind Brandtsegg
Professor of Music Technology
NTNU
7491 Trondheim
Norway
Cell: +47 92 203 205

http://flyndresang.no/
http://www.partikkelaudio.com/
http://soundcloud.com/brandtsegg
http://soundcloud.com/t-emp

Date2014-04-05 01:02
FromDave Mooney
Subject[Csnd] Re: Instrument design, efficiency and compilation in Csound6
Cheers Oeyvind thanks for your help, i'll try it that out and report back!



--
View this message in context: http://csound.1045644.n5.nabble.com/Instrument-design-efficiency-and-compilation-in-Csound6-tp5733874p5733907.html
Sent from the Csound - General mailing list archive at Nabble.com.