Csound Csound-dev Csound-tekno Search About

[Csnd-dev] Confused about 'e' events and csoundReadScore in API

Date2017-06-21 23:41
FromEd Costello
Subject[Csnd-dev] Confused about 'e' events and csoundReadScore in API
When I use the csoundReadScore function and input a score such as “i1 0 1 \n e”, no score is read at all and my program exits straight away, are you not allowed use “e” statements with this function?
My program is this:

int main(int argc, const char * argv[]) {
    CSOUND* csound = csoundCreate(NULL);

    char* args[3];
    args[0] = "csound";
    args[1] = "test.csd";
    args[2] = "-odac";

    

    csoundCompile(csound, 3, args);
    csoundReadScore(csound, "i1 0 1\ne");
    csoundPerform(csound);
    csoundStop(csound);

    

    return 0;
}

The csd I’m using is this:

<CsoundSynthesizer>
<CsInstruments>
sr = 44100
ksmps = 256
nchnls = 2
0dbfs = 1

instr 1

a1 vco2 0.4, 440
out a1
endin

</CsInstruments>
<CsScore>
</CsScore>
</CsoundSynthesizer>
Thanks
Ed


Date2017-06-21 23:45
FromVictor Lazzarini
SubjectRe: [Csnd-dev] Confused about 'e' events and csoundReadScore in API
No, e in RT events without any parameters means exit Csound now. In a compiled score, it means that too, but it is in effect at the end of all events.

Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy
Maynooth University
Ireland

On 21 Jun 2017, at 23:42, Ed Costello <phasereset@GMAIL.COM> wrote:

When I use the csoundReadScore function and input a score such as “i1 0 1 \n e”, no score is read at all and my program exits straight away, are you not allowed use “e” statements with this function?
My program is this:

int main(int argc, const char * argv[]) {
    CSOUND* csound = csoundCreate(NULL);

    char* args[3];
    args[0] = "csound";
    args[1] = "test.csd";
    args[2] = "-odac";

    

    csoundCompile(csound, 3, args);
    csoundReadScore(csound, "i1 0 1\ne");
    csoundPerform(csound);
    csoundStop(csound);

    

    return 0;
}

The csd I’m using is this:

<CsoundSynthesizer>
<CsInstruments>
sr = 44100
ksmps = 256
nchnls = 2
0dbfs = 1

instr 1

a1 vco2 0.4, 440
out a1
endin

</CsInstruments>
<CsScore>
</CsScore>
</CsoundSynthesizer>
Thanks
Ed


Date2017-06-21 23:53
FromEd Costello
SubjectRe: [Csnd-dev] Confused about 'e' events and csoundReadScore in API
Oh right, that makes sense, is there a way of ending a performance automatically once all the score events have been processed using csoundReadScore and  csoundPerform like the way “e” works from a score inside a csd or score file? 
Ed
 
On 21 Jun 2017, at 23:45, Victor Lazzarini <Victor.Lazzarini@NUIM.IE> wrote:

No, e in RT events without any parameters means exit Csound now. In a compiled score, it means that too, but it is in effect at the end of all events.

Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy
Maynooth University
Ireland

On 21 Jun 2017, at 23:42, Ed Costello <phasereset@GMAIL.COM> wrote:

When I use the csoundReadScore function and input a score such as “i1 0 1 \n e”, no score is read at all and my program exits straight away, are you not allowed use “e” statements with this function?
My program is this:

int main(int argc, const char * argv[]) {
    CSOUND* csound = csoundCreate(NULL);

    char* args[3];
    args[0] = "csound";
    args[1] = "test.csd";
    args[2] = "-odac";

    

    csoundCompile(csound, 3, args);
    csoundReadScore(csound, "i1 0 1\ne");
    csoundPerform(csound);
    csoundStop(csound);

    

    return 0;
}

The csd I’m using is this:

<CsoundSynthesizer>
<CsInstruments>
sr = 44100
ksmps = 256
nchnls = 2
0dbfs = 1

instr 1

a1 vco2 0.4, 440
out a1
endin

</CsInstruments>
<CsScore>
</CsScore>
</CsoundSynthesizer>
Thanks
Ed



Date2017-06-21 23:59
FromVictor Lazzarini
SubjectRe: [Csnd-dev] Confused about 'e' events and csoundReadScore in API
Use

e 0 time

where time is the end time in secs from
now. You can also just send an event
with "e" at the time you want to stop
csound.

Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy
Maynooth University
Ireland

On 21 Jun 2017, at 23:54, Ed Costello <phasereset@GMAIL.COM> wrote:

Oh right, that makes sense, is there a way of ending a performance automatically once all the score events have been processed using csoundReadScore and  csoundPerform like the way “e” works from a score inside a csd or score file? 
Ed
 
On 21 Jun 2017, at 23:45, Victor Lazzarini <Victor.Lazzarini@NUIM.IE> wrote:

No, e in RT events without any parameters means exit Csound now. In a compiled score, it means that too, but it is in effect at the end of all events.

Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy
Maynooth University
Ireland

On 21 Jun 2017, at 23:42, Ed Costello <phasereset@GMAIL.COM> wrote:

When I use the csoundReadScore function and input a score such as “i1 0 1 \n e”, no score is read at all and my program exits straight away, are you not allowed use “e” statements with this function?
My program is this:

int main(int argc, const char * argv[]) {
    CSOUND* csound = csoundCreate(NULL);

    char* args[3];
    args[0] = "csound";
    args[1] = "test.csd";
    args[2] = "-odac";

    

    csoundCompile(csound, 3, args);
    csoundReadScore(csound, "i1 0 1\ne");
    csoundPerform(csound);
    csoundStop(csound);

    

    return 0;
}

The csd I’m using is this:

<CsoundSynthesizer>
<CsInstruments>
sr = 44100
ksmps = 256
nchnls = 2
0dbfs = 1

instr 1

a1 vco2 0.4, 440
out a1
endin

</CsInstruments>
<CsScore>
</CsScore>
</CsoundSynthesizer>
Thanks
Ed



Date2017-06-22 00:07
FromEd Costello
SubjectRe: [Csnd-dev] Confused about 'e' events and csoundReadScore in API
I tried using csoundReadScore(csound, "i1 0 1\n e 0 10”), and the program just ended without performing any score, is that unexpected? I can’t use the other option of sending the e event when the time has passed because I want to dynamically create a score for writing audio files. 
Ed

On 21 Jun 2017, at 23:59, Victor Lazzarini <Victor.Lazzarini@NUIM.IE> wrote:

Use

e 0 time

where time is the end time in secs from
now. You can also just send an event
with "e" at the time you want to stop
csound.

Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy
Maynooth University
Ireland

On 21 Jun 2017, at 23:54, Ed Costello <phasereset@GMAIL.COM> wrote:

Oh right, that makes sense, is there a way of ending a performance automatically once all the score events have been processed using csoundReadScore and  csoundPerform like the way “e” works from a score inside a csd or score file? 
Ed
 
On 21 Jun 2017, at 23:45, Victor Lazzarini <Victor.Lazzarini@NUIM.IE> wrote:

No, e in RT events without any parameters means exit Csound now. In a compiled score, it means that too, but it is in effect at the end of all events.

Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy
Maynooth University
Ireland

On 21 Jun 2017, at 23:42, Ed Costello <phasereset@GMAIL.COM> wrote:

When I use the csoundReadScore function and input a score such as “i1 0 1 \n e”, no score is read at all and my program exits straight away, are you not allowed use “e” statements with this function?
My program is this:

int main(int argc, const char * argv[]) {
    CSOUND* csound = csoundCreate(NULL);

    char* args[3];
    args[0] = "csound";
    args[1] = "test.csd";
    args[2] = "-odac";
    
    csoundCompile(csound, 3, args);
    csoundReadScore(csound, "i1 0 1\ne");
    csoundPerform(csound);
    csoundStop(csound);
    
    return 0;
}

The csd I’m using is this:

<CsoundSynthesizer>
<CsInstruments>
sr = 44100
ksmps = 256
nchnls = 2
0dbfs = 1

instr 1

a1 vco2 0.4, 440
out a1
endin

</CsInstruments>
<CsScore>
</CsScore>
</CsoundSynthesizer>
Thanks
Ed




Date2017-06-22 02:54
FromMichael Gogins
SubjectRe: [Csnd-dev] Confused about 'e' events and csoundReadScore in API
Create a CSD not an ORC and then you can have a non real-time
performance. For a better explanation see the explanation in the
Csound API reference (Git head version, not the online version). I
excerpt it below.

The Csound API defines two modes of operation for hosts. In the first
mode, a regular Csound score is performed and then performance
automatically ends. This could be called "score mode." In the second
mode, Csound continues to perform indefinitely until performance is
explicitly ended by calling csoundStop. This could be called "live
mode." Which mode is used is determined by when csoundStart is called.
In more detail:

Score Mode

The  section of the CSD file is processed.

csoundStart must be called after csoundCompileCsd or csoundReadScore.

The score is pre-processed, and events are dispatched as regular score
events. "f", "s", and "e" events are permitted in the score.

#include "csound.h"
const char *csd_text = "blah blah blah";
int main(int argc, char **argv)
{
void *csound = csoundCreate(0);
int result = csoundCompileCsdText(csound, csd_text);
result = csoundStart(csound);
while (1) {
result = csoundPerformKsmps(csound);
if (result != 0) {
break;
}
}
result = csoundCleanup(csound);
csoundReset(csound);
csoundDestroy(csound);
return result;
}

Live Mode

The  section of the CSD file not processed; options must be
set by calling csoundSetOption.

csoundStart must be called before csoundCompileCsd or csoundReadScore.

The score is not pre-processed, and events are dispatched as real-time
events. "f", "s", and "e" events are not permitted.

#include "csound.h"
const char *orc_text = "blah blah blah";
const char *sco_text = "blah blah blah";
int main(int argc, char **argv)
{
void *csound = csoundCreate(0);
int result = csoundSetOption(csound, "-d");
result = csoundSetOption(csound, "-odac");
result = csoundStart(csound);
result = csoundCompileOrc(csound, orc_text);
result = csoundReadScore(csound, sco_text);
while (1) {
result = csoundPerformKsmps(csound);
if (result != 0) {
break;
}
}
result = csoundCleanup(csound);
csoundReset(csound);
csoundDestroy(csound);
return result;
}

Victor or Steven or anyone, correct anything that is wrong with this please.

Regards,
Mike

-----------------------------------------------------
Michael Gogins
Irreducible Productions
http://michaelgogins.tumblr.com
Michael dot Gogins at gmail dot com


On Wed, Jun 21, 2017 at 7:07 PM, Ed Costello  wrote:
> I tried using csoundReadScore(csound, "i1 0 1\n e 0 10”), and the program
> just ended without performing any score, is that unexpected? I can’t use the
> other option of sending the e event when the time has passed because I want
> to dynamically create a score for writing audio files.
> Ed
>
>
> On 21 Jun 2017, at 23:59, Victor Lazzarini  wrote:
>
> Use
>
> e 0 time
>
> where time is the end time in secs from
> now. You can also just send an event
> with "e" at the time you want to stop
> csound.
>
> Victor Lazzarini
> Dean of Arts, Celtic Studies, and Philosophy
> Maynooth University
> Ireland
>
> On 21 Jun 2017, at 23:54, Ed Costello  wrote:
>
> Oh right, that makes sense, is there a way of ending a performance
> automatically once all the score events have been processed using
> csoundReadScore and  csoundPerform like the way “e” works from a score
> inside a csd or score file?
> Ed
>
>
> On 21 Jun 2017, at 23:45, Victor Lazzarini  wrote:
>
> No, e in RT events without any parameters means exit Csound now. In a
> compiled score, it means that too, but it is in effect at the end of all
> events.
>
> Victor Lazzarini
> Dean of Arts, Celtic Studies, and Philosophy
> Maynooth University
> Ireland
>
> On 21 Jun 2017, at 23:42, Ed Costello  wrote:
>
> When I use the csoundReadScore function and input a score such as “i1 0 1 \n
> e”, no score is read at all and my program exits straight away, are you not
> allowed use “e” statements with this function?
> My program is this:
>
> int main(int argc, const char * argv[]) {
>     CSOUND* csound = csoundCreate(NULL);
>
>     char* args[3];
>     args[0] = "csound";
>     args[1] = "test.csd";
>     args[2] = "-odac";
>
>     csoundCompile(csound, 3, args);
>     csoundReadScore(csound, "i1 0 1\ne");
>     csoundPerform(csound);
>     csoundStop(csound);
>
>     return 0;
> }
>
> The csd I’m using is this:
>
> 
> 
> sr = 44100
> ksmps = 256
> nchnls = 2
> 0dbfs = 1
>
> instr 1
>
> a1 vco2 0.4, 440
> out a1
> endin
>
> 
> 
> 
> 
>
> Thanks
> Ed
>
>

Date2017-06-22 17:50
FromEd Costello
SubjectRe: [Csnd-dev] Confused about 'e' events and csoundReadScore in API
Oh right, I wasn’t aware that there were two operational modes,
Thanks
Ed

> On 22 Jun 2017, at 02:54, Michael Gogins  wrote:
> 
> Create a CSD not an ORC and then you can have a non real-time
> performance. For a better explanation see the explanation in the
> Csound API reference (Git head version, not the online version). I
> excerpt it below.
> 
> The Csound API defines two modes of operation for hosts. In the first
> mode, a regular Csound score is performed and then performance
> automatically ends. This could be called "score mode." In the second
> mode, Csound continues to perform indefinitely until performance is
> explicitly ended by calling csoundStop. This could be called "live
> mode." Which mode is used is determined by when csoundStart is called.
> In more detail:
> 
> Score Mode
> 
> The  section of the CSD file is processed.
> 
> csoundStart must be called after csoundCompileCsd or csoundReadScore.
> 
> The score is pre-processed, and events are dispatched as regular score
> events. "f", "s", and "e" events are permitted in the score.
> 
> #include "csound.h"
> const char *csd_text = "blah blah blah";
> int main(int argc, char **argv)
> {
> void *csound = csoundCreate(0);
> int result = csoundCompileCsdText(csound, csd_text);
> result = csoundStart(csound);
> while (1) {
> result = csoundPerformKsmps(csound);
> if (result != 0) {
> break;
> }
> }
> result = csoundCleanup(csound);
> csoundReset(csound);
> csoundDestroy(csound);
> return result;
> }
> 
> Live Mode
> 
> The  section of the CSD file not processed; options must be
> set by calling csoundSetOption.
> 
> csoundStart must be called before csoundCompileCsd or csoundReadScore.
> 
> The score is not pre-processed, and events are dispatched as real-time
> events. "f", "s", and "e" events are not permitted.
> 
> #include "csound.h"
> const char *orc_text = "blah blah blah";
> const char *sco_text = "blah blah blah";
> int main(int argc, char **argv)
> {
> void *csound = csoundCreate(0);
> int result = csoundSetOption(csound, "-d");
> result = csoundSetOption(csound, "-odac");
> result = csoundStart(csound);
> result = csoundCompileOrc(csound, orc_text);
> result = csoundReadScore(csound, sco_text);
> while (1) {
> result = csoundPerformKsmps(csound);
> if (result != 0) {
> break;
> }
> }
> result = csoundCleanup(csound);
> csoundReset(csound);
> csoundDestroy(csound);
> return result;
> }
> 
> Victor or Steven or anyone, correct anything that is wrong with this please.
> 
> Regards,
> Mike
> 
> -----------------------------------------------------
> Michael Gogins
> Irreducible Productions
> http://michaelgogins.tumblr.com
> Michael dot Gogins at gmail dot com
> 
> 
> On Wed, Jun 21, 2017 at 7:07 PM, Ed Costello  wrote:
>> I tried using csoundReadScore(csound, "i1 0 1\n e 0 10”), and the program
>> just ended without performing any score, is that unexpected? I can’t use the
>> other option of sending the e event when the time has passed because I want
>> to dynamically create a score for writing audio files.
>> Ed
>> 
>> 
>> On 21 Jun 2017, at 23:59, Victor Lazzarini  wrote:
>> 
>> Use
>> 
>> e 0 time
>> 
>> where time is the end time in secs from
>> now. You can also just send an event
>> with "e" at the time you want to stop
>> csound.
>> 
>> Victor Lazzarini
>> Dean of Arts, Celtic Studies, and Philosophy
>> Maynooth University
>> Ireland
>> 
>> On 21 Jun 2017, at 23:54, Ed Costello  wrote:
>> 
>> Oh right, that makes sense, is there a way of ending a performance
>> automatically once all the score events have been processed using
>> csoundReadScore and  csoundPerform like the way “e” works from a score
>> inside a csd or score file?
>> Ed
>> 
>> 
>> On 21 Jun 2017, at 23:45, Victor Lazzarini  wrote:
>> 
>> No, e in RT events without any parameters means exit Csound now. In a
>> compiled score, it means that too, but it is in effect at the end of all
>> events.
>> 
>> Victor Lazzarini
>> Dean of Arts, Celtic Studies, and Philosophy
>> Maynooth University
>> Ireland
>> 
>> On 21 Jun 2017, at 23:42, Ed Costello  wrote:
>> 
>> When I use the csoundReadScore function and input a score such as “i1 0 1 \n
>> e”, no score is read at all and my program exits straight away, are you not
>> allowed use “e” statements with this function?
>> My program is this:
>> 
>> int main(int argc, const char * argv[]) {
>>    CSOUND* csound = csoundCreate(NULL);
>> 
>>    char* args[3];
>>    args[0] = "csound";
>>    args[1] = "test.csd";
>>    args[2] = "-odac";
>> 
>>    csoundCompile(csound, 3, args);
>>    csoundReadScore(csound, "i1 0 1\ne");
>>    csoundPerform(csound);
>>    csoundStop(csound);
>> 
>>    return 0;
>> }
>> 
>> The csd I’m using is this:
>> 
>> 
>> 
>> sr = 44100
>> ksmps = 256
>> nchnls = 2
>> 0dbfs = 1
>> 
>> instr 1
>> 
>> a1 vco2 0.4, 440
>> out a1
>> endin
>> 
>> 
>> 
>> 
>> 
>> 
>> Thanks
>> Ed
>> 
>> 

Date2017-06-22 18:58
FromVictor Lazzarini
SubjectRe: [Csnd-dev] Confused about 'e' events and csoundReadScore in API
If you call readScore before csoundCompileOrc, then the score should be in 'score' mode (ie not RT events)

Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy
Maynooth University
Ireland

> On 22 Jun 2017, at 17:50, Ed Costello  wrote:
> 
> Oh right, I wasn’t aware that there were two operational modes,
> Thanks
> Ed
> 
>> On 22 Jun 2017, at 02:54, Michael Gogins  wrote:
>> 
>> Create a CSD not an ORC and then you can have a non real-time
>> performance. For a better explanation see the explanation in the
>> Csound API reference (Git head version, not the online version). I
>> excerpt it below.
>> 
>> The Csound API defines two modes of operation for hosts. In the first
>> mode, a regular Csound score is performed and then performance
>> automatically ends. This could be called "score mode." In the second
>> mode, Csound continues to perform indefinitely until performance is
>> explicitly ended by calling csoundStop. This could be called "live
>> mode." Which mode is used is determined by when csoundStart is called.
>> In more detail:
>> 
>> Score Mode
>> 
>> The  section of the CSD file is processed.
>> 
>> csoundStart must be called after csoundCompileCsd or csoundReadScore.
>> 
>> The score is pre-processed, and events are dispatched as regular score
>> events. "f", "s", and "e" events are permitted in the score.
>> 
>> #include "csound.h"
>> const char *csd_text = "blah blah blah";
>> int main(int argc, char **argv)
>> {
>> void *csound = csoundCreate(0);
>> int result = csoundCompileCsdText(csound, csd_text);
>> result = csoundStart(csound);
>> while (1) {
>> result = csoundPerformKsmps(csound);
>> if (result != 0) {
>> break;
>> }
>> }
>> result = csoundCleanup(csound);
>> csoundReset(csound);
>> csoundDestroy(csound);
>> return result;
>> }
>> 
>> Live Mode
>> 
>> The  section of the CSD file not processed; options must be
>> set by calling csoundSetOption.
>> 
>> csoundStart must be called before csoundCompileCsd or csoundReadScore.
>> 
>> The score is not pre-processed, and events are dispatched as real-time
>> events. "f", "s", and "e" events are not permitted.
>> 
>> #include "csound.h"
>> const char *orc_text = "blah blah blah";
>> const char *sco_text = "blah blah blah";
>> int main(int argc, char **argv)
>> {
>> void *csound = csoundCreate(0);
>> int result = csoundSetOption(csound, "-d");
>> result = csoundSetOption(csound, "-odac");
>> result = csoundStart(csound);
>> result = csoundCompileOrc(csound, orc_text);
>> result = csoundReadScore(csound, sco_text);
>> while (1) {
>> result = csoundPerformKsmps(csound);
>> if (result != 0) {
>> break;
>> }
>> }
>> result = csoundCleanup(csound);
>> csoundReset(csound);
>> csoundDestroy(csound);
>> return result;
>> }
>> 
>> Victor or Steven or anyone, correct anything that is wrong with this please.
>> 
>> Regards,
>> Mike
>> 
>> -----------------------------------------------------
>> Michael Gogins
>> Irreducible Productions
>> http://michaelgogins.tumblr.com
>> Michael dot Gogins at gmail dot com
>> 
>> 
>>> On Wed, Jun 21, 2017 at 7:07 PM, Ed Costello  wrote:
>>> I tried using csoundReadScore(csound, "i1 0 1\n e 0 10”), and the program
>>> just ended without performing any score, is that unexpected? I can’t use the
>>> other option of sending the e event when the time has passed because I want
>>> to dynamically create a score for writing audio files.
>>> Ed
>>> 
>>> 
>>> On 21 Jun 2017, at 23:59, Victor Lazzarini  wrote:
>>> 
>>> Use
>>> 
>>> e 0 time
>>> 
>>> where time is the end time in secs from
>>> now. You can also just send an event
>>> with "e" at the time you want to stop
>>> csound.
>>> 
>>> Victor Lazzarini
>>> Dean of Arts, Celtic Studies, and Philosophy
>>> Maynooth University
>>> Ireland
>>> 
>>> On 21 Jun 2017, at 23:54, Ed Costello  wrote:
>>> 
>>> Oh right, that makes sense, is there a way of ending a performance
>>> automatically once all the score events have been processed using
>>> csoundReadScore and  csoundPerform like the way “e” works from a score
>>> inside a csd or score file?
>>> Ed
>>> 
>>> 
>>> On 21 Jun 2017, at 23:45, Victor Lazzarini  wrote:
>>> 
>>> No, e in RT events without any parameters means exit Csound now. In a
>>> compiled score, it means that too, but it is in effect at the end of all
>>> events.
>>> 
>>> Victor Lazzarini
>>> Dean of Arts, Celtic Studies, and Philosophy
>>> Maynooth University
>>> Ireland
>>> 
>>> On 21 Jun 2017, at 23:42, Ed Costello  wrote:
>>> 
>>> When I use the csoundReadScore function and input a score such as “i1 0 1 \n
>>> e”, no score is read at all and my program exits straight away, are you not
>>> allowed use “e” statements with this function?
>>> My program is this:
>>> 
>>> int main(int argc, const char * argv[]) {
>>>   CSOUND* csound = csoundCreate(NULL);
>>> 
>>>   char* args[3];
>>>   args[0] = "csound";
>>>   args[1] = "test.csd";
>>>   args[2] = "-odac";
>>> 
>>>   csoundCompile(csound, 3, args);
>>>   csoundReadScore(csound, "i1 0 1\ne");
>>>   csoundPerform(csound);
>>>   csoundStop(csound);
>>> 
>>>   return 0;
>>> }
>>> 
>>> The csd I’m using is this:
>>> 
>>> 
>>> 
>>> sr = 44100
>>> ksmps = 256
>>> nchnls = 2
>>> 0dbfs = 1
>>> 
>>> instr 1
>>> 
>>> a1 vco2 0.4, 440
>>> out a1
>>> endin
>>> 
>>> 
>>> 
>>> 
>>> 
>>>