[Csnd] Waiting for Trigger in CsScore?

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

[Csnd] Waiting for Trigger in CsScore?

Yeh Z.
Hi Friends,

I made a piece of music by csound, which includes some different sessions in CsScore (using "s" statement).

I would like to performance it in live, thus, I am trying to find out a way:

* to wait at the end of a session, keeping the last instrument; then,

* to trigger the next session by a signal such as from computer keyboard.

any ideas?

Thanks a lot!

Yeh Z.

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] Waiting for Trigger in CsScore?

joachim-3
hi yeh -

not sure it is possible anyhow in the score.  but you could put your
score sections in different instruments, using the scoreline_i opcode:

instr section_1
  scoreline_i scoreline_i {{
             i 2  0  3  "flute.aiff"
             i 2  1  3  "beats.wav"
             }}
endin

instr section_2
  scoreline_i scoreline_i {{
             i 2  5  3  "flute.aiff"
             i 2  0  3  "beats.wav"
             }}
endin

the you can trigger these instrument at any time of your performance by
MIDI, or widgets (if you use CsoundQt for instance), or by the computer
keyboard with code like this:

instr ReceiveKey
  ;get key number and moment be pressed
  kKey, kDown sensekey
  ;if pressed
  if kDown == 1 then
   ;trigger instr section_1 via number key 1
   if kKey == 49 then
    event "i", "section_1", 0, 1
   ;other instruments ...
   elseif kKey == 50 then
    event "i", "section_2", 0, 1
   endif
  endif
endin
schedule "ReceiveKey", 0, 99999

best -
        joachim


On 30/08/18 10:57, Yeh Z. wrote:

> Hi Friends,
>
> I made a piece of music by csound, which includes some different sessions in CsScore (using "s" statement).
>
> I would like to performance it in live, thus, I am trying to find out a way:
>
> * to wait at the end of a session, keeping the last instrument; then,
>
> * to trigger the next session by a signal such as from computer keyboard.
>
> any ideas?
>
> Thanks a lot!
>
> Yeh Z.
>
> 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] Waiting for Trigger in CsScore?

Steven Yi
This is a bit hackish using eval to dynamically read in .sco files and
trigger them.  In this case, it's using random triggering, but one
could do so by other means.  I think for a realtime setup, it might be
better to pre-read in the .sco files into strings and put the strings
into an array.  I'm not used to using pre-generated .sco files myself,
but I imagine this could be a nice tool to have in case the situation
pops up.
On Thu, Aug 30, 2018 at 6:01 AM joachim heintz <[hidden email]> wrote:

>
> hi yeh -
>
> not sure it is possible anyhow in the score.  but you could put your
> score sections in different instruments, using the scoreline_i opcode:
>
> instr section_1
>   scoreline_i scoreline_i {{
>              i 2  0  3  "flute.aiff"
>              i 2  1  3  "beats.wav"
>              }}
> endin
>
> instr section_2
>   scoreline_i scoreline_i {{
>              i 2  5  3  "flute.aiff"
>              i 2  0  3  "beats.wav"
>              }}
> endin
>
> the you can trigger these instrument at any time of your performance by
> MIDI, or widgets (if you use CsoundQt for instance), or by the computer
> keyboard with code like this:
>
> instr ReceiveKey
>   ;get key number and moment be pressed
>   kKey, kDown sensekey
>   ;if pressed
>   if kDown == 1 then
>    ;trigger instr section_1 via number key 1
>    if kKey == 49 then
>     event "i", "section_1", 0, 1
>    ;other instruments ...
>    elseif kKey == 50 then
>     event "i", "section_2", 0, 1
>    endif
>   endif
> endin
> schedule "ReceiveKey", 0, 99999
>
> best -
>         joachim
>
>
> On 30/08/18 10:57, Yeh Z. wrote:
> > Hi Friends,
> >
> > I made a piece of music by csound, which includes some different sessions in CsScore (using "s" statement).
> >
> > I would like to performance it in live, thus, I am trying to find out a way:
> >
> > * to wait at the end of a session, keeping the last instrument; then,
> >
> > * to trigger the next session by a signal such as from computer keyboard.
> >
> > any ideas?
> >
> > Thanks a lot!
> >
> > Yeh Z.
> >
> > 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
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

sco_trigger.zip (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] Waiting for Trigger in CsScore?

Yeh Z.
In reply to this post by Yeh Z.
Hi Joachim and Steven,

Thank you very much for your help.

I have just tried the codes; they work, although, they are not exactly what I am looking for.

the problem of "scoreline_i" is that:

it doesn't work with score statements including "s" and "{}" (loops).

For sco trigger, it is a little bit complex to me, I am still trying to understand it; it executes only a part of my score.

Actually, I am looking for something like:

<CsScore>
; Section 1
{32 N
i "Tapes" [$N*1] 0.25 $N*0.1
i "Tapes" +         0.25 $N*0.1
i "Tapes" +         0.25 $N*0.1
i "Tapes" +         0.25 $N*0.1
}
i99 32 "Holding till trigger to finish" ; <== a mean like this: as long as it is triggered, the section be marked finished, and jump to the next section.
s

; Section 2
; ... codes
s
; Section 3
; ... and so on
; ...
; Section 9
; codes...
e
</CsScore>

I think this function would be useful for ElectroAcoustics and live electronics.
Is there any way have already be done?

Many thanks again :)

Regards,
Yeh Z.

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] Waiting for Trigger in CsScore?

jpff
Thinking aloud....  would it be a solution if there was an opcode like
exitnow which ended section now?  Not sure if that is implementable or
just hard.....

On Sun, 9 Sep 2018, Yeh Z. wrote:

> Hi Joachim and Steven,
>
> Thank you very much for your help.
>
> I have just tried the codes; they work, although, they are not exactly what I am looking for.
>
> the problem of "scoreline_i" is that:
>
> it doesn't work with score statements including "s" and "{}" (loops).
>
> For sco trigger, it is a little bit complex to me, I am still trying to understand it; it executes only a part of my score.
>
> Actually, I am looking for something like:
>
> <CsScore>
> ; Section 1
> {32 N
> i "Tapes" [$N*1] 0.25 $N*0.1
> i "Tapes" +         0.25 $N*0.1
> i "Tapes" +         0.25 $N*0.1
> i "Tapes" +         0.25 $N*0.1
> }
> i99 32 "Holding till trigger to finish" ; <== a mean like this: as long as it is triggered, the section be marked finished, and jump to the next section.
> s
>
> ; Section 2
> ; ... codes
> s
> ; Section 3
> ; ... and so on
> ; ...
> ; Section 9
> ; codes...
> e
> </CsScore>
>
> I think this function would be useful for ElectroAcoustics and live electronics.
> Is there any way have already be done?
>
> Many thanks again :)
>
> Regards,
> Yeh Z.
>
> 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] Waiting for Trigger in CsScore?

Steven Yi
I'm not sure we need an opcode.  I put together a generative CSD
example that has:

* two score generating process instruments
* one conductor instrument

The two process instruments play instr 1 until klimit number of times,
then play a held note.  They each signal via increment of global
variable.  A conductor instrument checks the global var and when both
processes are done it resets the variable.  The process instruments
then see the signal and turn off their held notes and restart their
processes.  The process repeats ad infinitum.

The example illustrates the coding style but the parts could easily be
replaced. The signal from the conductor could be instead  from a user
input, the score generation could be from playing a sco fragment, etc.
Hopefully there's enough here to show an approach that might be usable
as a starting point for other coding.  I imagine instead of hard-coded
processes, one could make some reusable instruments. For example, one
that takes in a score file as a pfield and checks different global
signal states to figure out what to do.

Cheers!
steven




On Sun, Sep 9, 2018 at 11:09 AM jpff <[hidden email]> wrote:

>
> Thinking aloud....  would it be a solution if there was an opcode like
> exitnow which ended section now?  Not sure if that is implementable or
> just hard.....
>
> On Sun, 9 Sep 2018, Yeh Z. wrote:
>
> > Hi Joachim and Steven,
> >
> > Thank you very much for your help.
> >
> > I have just tried the codes; they work, although, they are not exactly what I am looking for.
> >
> > the problem of "scoreline_i" is that:
> >
> > it doesn't work with score statements including "s" and "{}" (loops).
> >
> > For sco trigger, it is a little bit complex to me, I am still trying to understand it; it executes only a part of my score.
> >
> > Actually, I am looking for something like:
> >
> > <CsScore>
> > ; Section 1
> > {32 N
> > i "Tapes" [$N*1] 0.25 $N*0.1
> > i "Tapes" +         0.25 $N*0.1
> > i "Tapes" +         0.25 $N*0.1
> > i "Tapes" +         0.25 $N*0.1
> > }
> > i99 32 "Holding till trigger to finish" ; <== a mean like this: as long as it is triggered, the section be marked finished, and jump to the next section.
> > s
> >
> > ; Section 2
> > ; ... codes
> > s
> > ; Section 3
> > ; ... and so on
> > ; ...
> > ; Section 9
> > ; codes...
> > e
> > </CsScore>
> >
> > I think this function would be useful for ElectroAcoustics and live electronics.
> > Is there any way have already be done?
> >
> > Many thanks again :)
> >
> > Regards,
> > Yeh Z.
> >
> > 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
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

process_signalling.csd (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] Waiting for Trigger in CsScore?

joachim heintz
In reply to this post by Yeh Z.
hi yeh -

you are right about the limitations of the scoreline opcode, but on the
other hand: it is not hard to implement them.  i attach a small example
below, showing how you can loop over an array (can be compared to a
section i think), and then have a bigger loop to call this section again
and again.

i personally are not using any more scores, even if i work out a tape
piece in csound.  i find it more flexible, and more straightforward to
create the events in instruments.  then i can do anything what is
possible in the csound language; and this is a lot ...

for instance, rather than using
         iStart += 2
in the code below, i can write
        iStart += random:i(1,3)
thus creating a pause between the sections which is not always the same.
  this is so easy, and i think your actually interactive model ("waiting
for a trigger") is really easy to implement in the orchestra, but more
or less a pain in the score.

the score is neither csound language not any programming language at
all, but an event list.  some features has been added, but these remain
crutches, in my opinion.

i just read steven's mail and i think his (much complexer) example goes
in a similar direction.  best -

        joachim



<CsoundSynthesizer>
<CsOptions>
-m128
</CsOptions>
<CsInstruments>

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

giNotes[] fillarray 60, 61, 63, 66, 67

instr Loop
iNumLoops = p4
iLoopCount = 0
iStart = 0
while iLoopCount < iNumLoops do
  iNumLines = 5
  iLineCount = 0
  while iLineCount < iNumLines do
   S_call sprintf "i 100 %f 1 %d", iStart, giNotes[iLineCount]
   scoreline_i S_call
   iStart += 1/4
   iLineCount += 1
  od
  iStart += 2
  iLoopCount += 1
od
endin
schedule "Loop", 0, 0, 5

instr 100
aEnv transeg .2, p3, -6, 0
aOut poscil aEnv, cpsmidinn(p4+12)
out aOut, aOut
endin

</CsInstruments>
<CsScore>
</CsScore>
</CsoundSynthesizer>


On 09/09/18 04:51, Yeh Z. wrote:

> Hi Joachim and Steven,
>
> Thank you very much for your help.
>
> I have just tried the codes; they work, although, they are not exactly what I am looking for.
>
> the problem of "scoreline_i" is that:
>
> it doesn't work with score statements including "s" and "{}" (loops).
>
> For sco trigger, it is a little bit complex to me, I am still trying to understand it; it executes only a part of my score.
>
> Actually, I am looking for something like:
>
> <CsScore>
> ; Section 1
> {32 N
> i "Tapes" [$N*1] 0.25 $N*0.1
> i "Tapes" +         0.25 $N*0.1
> i "Tapes" +         0.25 $N*0.1
> i "Tapes" +         0.25 $N*0.1
> }
> i99 32 "Holding till trigger to finish" ; <== a mean like this: as long as it is triggered, the section be marked finished, and jump to the next section.
> s
>
> ; Section 2
> ; ... codes
> s
> ; Section 3
> ; ... and so on
> ; ...
> ; Section 9
> ; codes...
> e
> </CsScore>
>
> I think this function would be useful for ElectroAcoustics and live electronics.
> Is there any way have already be done?
>
> Many thanks again :)
>
> Regards,
> Yeh Z.
>
> 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