[Csnd] Score and controls

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

[Csnd] Score and controls

lorangeverte
Dear list,

User of csound~ and antescofo~ I write a kind of "false" scores for Csound,
I mean that I use a special syntax to sequence Csound events via a Max
strategy (without MIDI).

I would like to transform my patch and system to obtain a similar result and
write Csound scores in "real and true" syntax.

Then I have a simple question about scoring in Csound. This example of code
allows me to control instances of an instrument inside the score:

instr 1

giInstance_1 = p4
idur = p3
ijb = p5
iNstru = p6
gkcps = p7

SChannel1 sprintf "Aa1_%d", p4
chnset p7, SChannel1

if (ijb==1) then
event_i "i", iNstru, 0, idur
endif

endin

instr 2

SChannel1 sprintf "Aa1_%d", giInstance_1
gkcps chnget SChannel1

asig oscil 0.5, gkcps, 1

     outs asig,asig

endin

The problem appears in the score of this code... Could tell me why the first
version works while the second not (and I would like to use both version, of
course!):

1/ works for me

f0 3600
f1 0 16384 10 1                              

i1.01 *0* -4 1 1 2.01 200

i1.02 *1* -4 2 1 2.02 100

i1.01 2 -4 1 0 2.01 150


2/ dosent work (only i1.02 is sequenced)

f0 3600
f1 0 16384 10 1    

i1.01 *0* -4 1 1 2.01 200

i1.02 * 0* -4 2 1 2.02 100

i1.01 2 -4 1 0 2.01 150


Thank you for your responses,

Regards,

Lorangeverte



--
Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html

Csound mailing list
[hidden email]
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
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] Score and controls

joachim-3
hi lorangeverte -

i think you can see the reason when you insert
        puts SChannel1, 1
in your instrument 2 (after the sprintf line).

your first call prints:
Aa1_1
Aa1_2

whereas your second score version prints:
Aa1_2
Aa1_2

i believe it is not at all a good idea to use global variables in the
way you do:
giInstance_1 = p4
gkcps = p7

why can't you use local variables and pass them to the instance you call
as p-fields?

best -
        joachim



On 22/05/18 08:58, lorangeverte wrote:

> Dear list,
>
> User of csound~ and antescofo~ I write a kind of "false" scores for Csound,
> I mean that I use a special syntax to sequence Csound events via a Max
> strategy (without MIDI).
>
> I would like to transform my patch and system to obtain a similar result and
> write Csound scores in "real and true" syntax.
>
> Then I have a simple question about scoring in Csound. This example of code
> allows me to control instances of an instrument inside the score:
>
> instr 1
>
> giInstance_1 = p4
> idur = p3
> ijb = p5
> iNstru = p6
> gkcps = p7
>
> SChannel1 sprintf "Aa1_%d", p4
> chnset p7, SChannel1
>
> if (ijb==1) then
> event_i "i", iNstru, 0, idur
> endif
>
> endin
>
> instr 2
>
> SChannel1 sprintf "Aa1_%d", giInstance_1
> gkcps chnget SChannel1
>
> asig oscil 0.5, gkcps, 1
>
>      outs asig,asig
>
> endin
>
> The problem appears in the score of this code... Could tell me why the first
> version works while the second not (and I would like to use both version, of
> course!):
>
> 1/ works for me
>
> f0 3600
> f1 0 16384 10 1
>
> i1.01 *0* -4 1 1 2.01 200
>
> i1.02 *1* -4 2 1 2.02 100
>
> i1.01 2 -4 1 0 2.01 150
>
>
> 2/ dosent work (only i1.02 is sequenced)
>
> f0 3600
> f1 0 16384 10 1
>
> i1.01 *0* -4 1 1 2.01 200
>
> i1.02 * 0* -4 2 1 2.02 100
>
> i1.01 2 -4 1 0 2.01 150
>
>
> Thank you for your responses,
>
> Regards,
>
> Lorangeverte
>
>
>
> --
> Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html
>
> Csound mailing list
> [hidden email]
> 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
>

Csound mailing list
[hidden email]
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
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] Score and controls

lorangeverte
Hi Joachim!

Thank you for your answer, I've changed the "giInstance_1" global variable
to a local and it's works perfectly. however, I need to keep as global
variable every control values of i2 (in my exemple, gkcps) — in my Max patch
(now it's just a GUI adapted to Csound for me, and maybe that explain
behaviors of my codes), I set a lot of control values in real time, then
output line score at Csound format...

Anyway, could you take a look of this short csd and tell me if something
wrong a priori?

Thanks again Joachim,

Regards,

Lorangeverte

<CsoundSynthesizer>
<CsOptions>
; Select audio/midi flags here according to platform
-odac     ;;;realtime audio out
;-iadc    ;;;uncomment -iadc if realtime audio input is needed too
; For Non-realtime ouput leave only the line below:
; -o oscil.wav -W ;;; for file output any platform
</CsOptions>
<CsInstruments>

sr = 44100
ksmps = 32
nchnls = 2
0dbfs  = 1


instr 1

idur = p3
iInstance_1 = p4
ilol = p5
iNstru = p6
gkcps = p7

SChannel1 sprintf "Aa1_%d", p4
chnset p7, SChannel1

if (ilol==1) then
event_i "i", iNstru, 0, idur, p4, p7
else
endif

endin


instr 2

iInstance_2 = p4

SChannel1 sprintf "Aa1_%d", p4
gkcps chnget SChannel1

gkcps lineto gkcps, 0.5
asig oscil 0.5, gkcps, 1

     outs asig,asig

endin

</CsInstruments>
<CsScore>

f1 0 16384 10 1                                        

i1.01 0 5 1 1 2.01 200
i1.02 0 5 2 1 2.02 120
i1.01 2 5 1 0 2.01 180

e
</CsScore>
</CsoundSynthesizer>



--
Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html

Csound mailing list
[hidden email]
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
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] Score and controls

joachim-3
hi lorangeverte -

good to know it is working for you now.

when i look in your instr 2, i cannot see why gkcps has to be global.
you receive the value from the software channel "Aa_1" or "Aa_2".  so
there must be something different in these two channels.  when you write

        kcps chnget SChannel1

then the kcps in instance 2.01 receives its value from software channel
"Aa_1", and the kcps in instance 2.02 receives its value from soaftware
channel "Aa_2".  the variable kcps carries an own (different) value in
both instances.

but when you write gkcps instead of kcps, the instance which comes last
will destroy the gkcps from the instance which comes first.

if you really want this, then i cannot see why you distinguish your
instances.  it woould work without it, i think.

best -
        joachim


On 23/05/18 10:20, lorangeverte wrote:

> Hi Joachim!
>
> Thank you for your answer, I've changed the "giInstance_1" global variable
> to a local and it's works perfectly. however, I need to keep as global
> variable every control values of i2 (in my exemple, gkcps) — in my Max patch
> (now it's just a GUI adapted to Csound for me, and maybe that explain
> behaviors of my codes), I set a lot of control values in real time, then
> output line score at Csound format...
>
> Anyway, could you take a look of this short csd and tell me if something
> wrong a priori?
>
> Thanks again Joachim,
>
> Regards,
>
> Lorangeverte
>
> <CsoundSynthesizer>
> <CsOptions>
> ; Select audio/midi flags here according to platform
> -odac     ;;;realtime audio out
> ;-iadc    ;;;uncomment -iadc if realtime audio input is needed too
> ; For Non-realtime ouput leave only the line below:
> ; -o oscil.wav -W ;;; for file output any platform
> </CsOptions>
> <CsInstruments>
>
> sr = 44100
> ksmps = 32
> nchnls = 2
> 0dbfs  = 1
>
>
> instr 1
>
> idur = p3
> iInstance_1 = p4
> ilol = p5
> iNstru = p6
> gkcps = p7
>
> SChannel1 sprintf "Aa1_%d", p4
> chnset p7, SChannel1
>
> if (ilol==1) then
> event_i "i", iNstru, 0, idur, p4, p7
> else
> endif
>
> endin
>
>
> instr 2
>
> iInstance_2 = p4
>
> SChannel1 sprintf "Aa1_%d", p4
> gkcps chnget SChannel1
>
> gkcps lineto gkcps, 0.5
> asig oscil 0.5, gkcps, 1
>
>      outs asig,asig
>
> endin
>
> </CsInstruments>
> <CsScore>
>
> f1 0 16384 10 1
>
> i1.01 0 5 1 1 2.01 200
> i1.02 0 5 2 1 2.02 120
> i1.01 2 5 1 0 2.01 180
>
> e
> </CsScore>
> </CsoundSynthesizer>
>
>
>
> --
> Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html
>
> Csound mailing list
> [hidden email]
> 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
>

Csound mailing list
[hidden email]
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
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] Score and controls

lorangeverte
Hi Joachim,

the reason that I keep gkcps as global comes from that I want to set every
control value in score by ignoring instrument initialization.

If not, the third line of the score in the attached example doesn't work for
me:

i1.01 0 5 1 1 2.01 200
i1.02 0 5 2 1 2.02 120

i1.01 2 5 1 0 2.01 180

When p5 of i1 = 1, then event_i calls an instance of i2; if p5 of i1 = 0,
then just relative controls of i2 have to be set, but there is no new
initalization of i2. Keep gkcps as global is the only way I found to obtain
this result...

Hum... I don't know if it is really clear for you... Sorry (I have some
troubles to express myself and express this kind of idea (even in my mother
tongue...))

Anyway, all of your advices or observations are very rewarding for me!

Thank you again Joachim,

Best,

Lorangeverte




--
Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html

Csound mailing list
[hidden email]
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
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] Score and controls

lorangeverte
Hi Joachim,

I am sorry... After having check once again my code regarding to your
proposition, it is works!

Thank you again!

(Mea culpa)

Lorangeverte



--
Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html

Csound mailing list
[hidden email]
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
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] Score and controls

joachim-3
good to know it works for you!
best -
        joachim



On 26/05/18 20:51, lorangeverte wrote:

> Hi Joachim,
>
> I am sorry... After having check once again my code regarding to your
> proposition, it is works!
>
> Thank you again!
>
> (Mea culpa)
>
> Lorangeverte
>
>
>
> --
> Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html
>
> Csound mailing list
> [hidden email]
> 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
>

Csound mailing list
[hidden email]
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