Csound Csound-dev Csound-tekno Search About

[Csnd] csoundSession and multiple csd's

Date2018-11-25 19:28
FromRichard
Subject[Csnd] csoundSession and multiple csd's
I'm not sure how cs.resetSession(csdfile) works. The description says:

"Reset the current session, eventually loading a new csd file"

Does that replace the existing csd file or add the new csd file to the 
thread?

I am trying to convert Steven's OSCsound example to make use of 
ctcsound, not csnd6.

BTW, in order to use resetSession without errors I had to use this:

     cs = 
CsoundSession("/Users/richard/PycharmProjects/OscCtcSound/csds/Mono_Synth.csd")
     time.sleep(10)
     cs.stopPerformance()
     cs.reset()
cs.resetSession("/Users/richard/PycharmProjects/OscCtcSound/csds/vco2test.csd")

But as I said I am not sure at this point of both csd's are loaded...


Richard

Csound mailing list
Csound@listserv.heanet.ie
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

Date2018-11-25 19:43
FromFrancois PINOT
SubjectRe: [Csnd] csoundSession and multiple csd's
cs.resetSession resets the current session, eventually loading a new csd file. This means that if no csd filename is given as parameter or if the same csd filename as the actual one is given, the system just resets the csd. If a new csd filename is given as parameter, then the system is reset with this new csd which replaces the old one.

François

Le dim. 25 nov. 2018 à 20:28, Richard <zappfinger@gmail.com> a écrit :
I'm not sure how cs.resetSession(csdfile) works. The description says:

"Reset the current session, eventually loading a new csd file"

Does that replace the existing csd file or add the new csd file to the
thread?

I am trying to convert Steven's OSCsound example to make use of
ctcsound, not csnd6.

BTW, in order to use resetSession without errors I had to use this:

     cs =
CsoundSession("/Users/richard/PycharmProjects/OscCtcSound/csds/Mono_Synth.csd")
     time.sleep(10)
     cs.stopPerformance()
     cs.reset()
cs.resetSession("/Users/richard/PycharmProjects/OscCtcSound/csds/vco2test.csd")

But as I said I am not sure at this point of both csd's are loaded...


Richard

Csound mailing list
Csound@listserv.heanet.ie
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 Csound@listserv.heanet.ie 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

Date2018-11-25 20:49
FromRichard
SubjectRe: [Csnd] csoundSession and multiple csd's

Yes, but what if I need to add new instruments? In ctcsound I found the following code that I think I need:

    def compileCsd(self, csd_filename):
        """Compile a Csound input file (.csd file).
       
        The input file includes command-line arguments, but does not
        perform the file. Return a non-zero error code on failure.
        In this (host-driven) mode, the sequence of calls should be
        as follows:
       
            cs.compileCsd(args)
            while (cs.performBuffer() == 0)
                pass
            cs.cleanup()
            cs.reset()
       
        NB: this function can be called during performance to
        replace or add new instruments and events.
        On a first call and if called before start(), this function
        behaves similarly to compile_().
        """

But this is not called in csoundSession()...


Richard

On 25/11/2018 20:43, Francois PINOT wrote:
cs.resetSession resets the current session, eventually loading a new csd file. This means that if no csd filename is given as parameter or if the same csd filename as the actual one is given, the system just resets the csd. If a new csd filename is given as parameter, then the system is reset with this new csd which replaces the old one.

François

Le dim. 25 nov. 2018 à 20:28, Richard <zappfinger@gmail.com> a écrit :
I'm not sure how cs.resetSession(csdfile) works. The description says:

"Reset the current session, eventually loading a new csd file"

Does that replace the existing csd file or add the new csd file to the
thread?

I am trying to convert Steven's OSCsound example to make use of
ctcsound, not csnd6.

BTW, in order to use resetSession without errors I had to use this:

     cs =
CsoundSession("/Users/richard/PycharmProjects/OscCtcSound/csds/Mono_Synth.csd")
     time.sleep(10)
     cs.stopPerformance()
     cs.reset()
cs.resetSession("/Users/richard/PycharmProjects/OscCtcSound/csds/vco2test.csd")

But as I said I am not sure at this point of both csd's are loaded...


Richard

Csound mailing list
Csound@listserv.heanet.ie
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 Csound@listserv.heanet.ie 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

Date2018-11-26 11:08
FromFrancois PINOT
SubjectRe: [Csnd] csoundSession and multiple csd's
CsoundSession is a subclass of ctcsound.Csound and so it has de facto all the methods of ctcsound, particularly compileCsd, compileOrc, and compileOrcAsync which can be used to add instr on the fly.

François

Le dim. 25 nov. 2018 à 21:49, Richard <zappfinger@gmail.com> a écrit :

Yes, but what if I need to add new instruments? In ctcsound I found the following code that I think I need:

    def compileCsd(self, csd_filename):
        """Compile a Csound input file (.csd file).
       
        The input file includes command-line arguments, but does not
        perform the file. Return a non-zero error code on failure.
        In this (host-driven) mode, the sequence of calls should be
        as follows:
       
            cs.compileCsd(args)
            while (cs.performBuffer() == 0)
                pass
            cs.cleanup()
            cs.reset()
       
        NB: this function can be called during performance to
        replace or add new instruments and events.
        On a first call and if called before start(), this function
        behaves similarly to compile_().
        """

But this is not called in csoundSession()...


Richard

On 25/11/2018 20:43, Francois PINOT wrote:
cs.resetSession resets the current session, eventually loading a new csd file. This means that if no csd filename is given as parameter or if the same csd filename as the actual one is given, the system just resets the csd. If a new csd filename is given as parameter, then the system is reset with this new csd which replaces the old one.

François

Le dim. 25 nov. 2018 à 20:28, Richard <zappfinger@gmail.com> a écrit :
I'm not sure how cs.resetSession(csdfile) works. The description says:

"Reset the current session, eventually loading a new csd file"

Does that replace the existing csd file or add the new csd file to the
thread?

I am trying to convert Steven's OSCsound example to make use of
ctcsound, not csnd6.

BTW, in order to use resetSession without errors I had to use this:

     cs =
CsoundSession("/Users/richard/PycharmProjects/OscCtcSound/csds/Mono_Synth.csd")
     time.sleep(10)
     cs.stopPerformance()
     cs.reset()
cs.resetSession("/Users/richard/PycharmProjects/OscCtcSound/csds/vco2test.csd")

But as I said I am not sure at this point of both csd's are loaded...


Richard

Csound mailing list
Csound@listserv.heanet.ie
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 Csound@listserv.heanet.ie 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 Csound@listserv.heanet.ie 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 Csound@listserv.heanet.ie 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

Date2018-11-26 12:19
FromVictor Lazzarini
SubjectRe: [Csnd] csoundSession and multiple csd's
I hadn’t come across it before, that’s a very interesting one.
========================
Prof. Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy,
Maynooth University,
Maynooth, Co Kildare, Ireland
Tel: 00 353 7086936
Fax: 00 353 1 7086952 

> On 26 Nov 2018, at 11:08, Francois PINOT  wrote:
> 
> CsoundSession is a subclass of ctcsound.Csound and so it has de facto all the methods of ctcsound, particularly compileCsd, compileOrc, and compileOrcAsync which can be used to add instr on the fly.
> 
> François
> 
> Le dim. 25 nov. 2018 à 21:49, Richard  a écrit :
> Yes, but what if I need to add new instruments? In ctcsound I found the following code that I think I need:
> 
>     def compileCsd(self, csd_filename):
>         """Compile a Csound input file (.csd file).
>         
>         The input file includes command-line arguments, but does not
>         perform the file. Return a non-zero error code on failure.
>         In this (host-driven) mode, the sequence of calls should be
>         as follows:
>         
>             cs.compileCsd(args)
>             while (cs.performBuffer() == 0)
>                 pass
>             cs.cleanup()
>             cs.reset()
>         
>         NB: this function can be called during performance to
>         replace or add new instruments and events.
>         On a first call and if called before start(), this function
>         behaves similarly to compile_().
>         """
> 
> But this is not called in csoundSession()...
> 
> 
> 
> Richard
> 
> On 25/11/2018 20:43, Francois PINOT wrote:
>> cs.resetSession resets the current session, eventually loading a new csd file. This means that if no csd filename is given as parameter or if the same csd filename as the actual one is given, the system just resets the csd. If a new csd filename is given as parameter, then the system is reset with this new csd which replaces the old one.
>> 
>> François
>> 
>> Le dim. 25 nov. 2018 à 20:28, Richard  a écrit :
>> I'm not sure how cs.resetSession(csdfile) works. The description says:
>> 
>> "Reset the current session, eventually loading a new csd file"
>> 
>> Does that replace the existing csd file or add the new csd file to the 
>> thread?
>> 
>> I am trying to convert Steven's OSCsound example to make use of 
>> ctcsound, not csnd6.
>> 
>> BTW, in order to use resetSession without errors I had to use this:
>> 
>>      cs = 
>> CsoundSession("/Users/richard/PycharmProjects/OscCtcSound/csds/Mono_Synth.csd")
>>      time.sleep(10)
>>      cs.stopPerformance()
>>      cs.reset()
>> cs.resetSession("/Users/richard/PycharmProjects/OscCtcSound/csds/vco2test.csd")
>> 
>> But as I said I am not sure at this point of both csd's are loaded...
>> 
>> 
>> Richard
>> 
>> Csound mailing list
>> Csound@listserv.heanet.ie
>> 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 Csound@listserv.heanet.ie 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 Csound@listserv.heanet.ie 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 Csound@listserv.heanet.ie 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
Csound@listserv.heanet.ie
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

Date2018-11-26 19:45
FromRichard
SubjectRe: [Csnd] csoundSession and multiple csd's

Of course. BTW, there should be more info on how to use this, maybe in a Csound Journal article?
For instance, the first csd loaded with CsoundSession() is a normal csd file with header containing <CsOptions>,  sr, kr, etc, and a generic orc section.
The next csd, loaded with compileCsd() cannot contain <CsOptions> and a section with sr, kr, etc. (Csound complains about global variables already set)
It can contain a global orc section, however.

Richard

On 26/11/2018 12:08, Francois PINOT wrote:
CsoundSession is a subclass of ctcsound.Csound and so it has de facto all the methods of ctcsound, particularly compileCsd, compileOrc, and compileOrcAsync which can be used to add instr on the fly.

François

Le dim. 25 nov. 2018 à 21:49, Richard <zappfinger@gmail.com> a écrit :

Yes, but what if I need to add new instruments? In ctcsound I found the following code that I think I need:

    def compileCsd(self, csd_filename):
        """Compile a Csound input file (.csd file).
       
        The input file includes command-line arguments, but does not
        perform the file. Return a non-zero error code on failure.
        In this (host-driven) mode, the sequence of calls should be
        as follows:
       
            cs.compileCsd(args)
            while (cs.performBuffer() == 0)
                pass
            cs.cleanup()
            cs.reset()
       
        NB: this function can be called during performance to
        replace or add new instruments and events.
        On a first call and if called before start(), this function
        behaves similarly to compile_().
        """

But this is not called in csoundSession()...


Richard

On 25/11/2018 20:43, Francois PINOT wrote:
cs.resetSession resets the current session, eventually loading a new csd file. This means that if no csd filename is given as parameter or if the same csd filename as the actual one is given, the system just resets the csd. If a new csd filename is given as parameter, then the system is reset with this new csd which replaces the old one.

François

Le dim. 25 nov. 2018 à 20:28, Richard <zappfinger@gmail.com> a écrit :
I'm not sure how cs.resetSession(csdfile) works. The description says:

"Reset the current session, eventually loading a new csd file"

Does that replace the existing csd file or add the new csd file to the
thread?

I am trying to convert Steven's OSCsound example to make use of
ctcsound, not csnd6.

BTW, in order to use resetSession without errors I had to use this:

     cs =
CsoundSession("/Users/richard/PycharmProjects/OscCtcSound/csds/Mono_Synth.csd")
     time.sleep(10)
     cs.stopPerformance()
     cs.reset()
cs.resetSession("/Users/richard/PycharmProjects/OscCtcSound/csds/vco2test.csd")

But as I said I am not sure at this point of both csd's are loaded...


Richard

Csound mailing list
Csound@listserv.heanet.ie
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 Csound@listserv.heanet.ie 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 Csound@listserv.heanet.ie 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 Csound@listserv.heanet.ie 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