Re: [Cs-dev] Score rewinding

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

Re: [Cs-dev] Score rewinding

Istvan Varga
Victor Lazzarini wrote:
> 2.Although much more clean and having trouble-free
> running, inclunding destroying-recreating *csound objects,
> the engine still has trouble with more than one concurrent
> instance. It doesn't crash, which is an achievement, but
> it doesn't work properly.

Can you provide more details about what did not work ? It would
be much easier to fix then. It is known that a number of opcodes
and features (e.g. cscore, graphs, spectral/analysis related
opcodes etc.) have problems, but the following example worked for
me on Linux, rendering two instances of "Trapped" in real time.

/* Console Csound using the Csound API. */

#include "csoundCore.h"
#include "csound.h"
#include "csmodule.h"
#include <stdio.h>
#include <stdarg.h>
#include <pthread.h>

static const int argc1 = 4;
static const int argc2 = 4;

static const char *argv1[] = {
     "csound", "examples/trapped.csd", "-o", "dac:front", NULL
};

static const char *argv2[] = {
     "csound", "examples/trapped.csd", "-o", "dac:rear", NULL
};

typedef struct {
     int   argc;
     const char  **argv;
} ARGS;

static const ARGS args1 = { argc1, &argv1[0] };
static const ARGS args2 = { argc2, &argv2[0] };

static void *foobar(void *args)
{
     int argc = ((ARGS*) args)->argc;
     char **argv = (char**) ((ARGS*) args)->argv;
     void  *csound;
     int   result;
     /*  Create Csound. */
     csound = csoundCreate(NULL);
     /*  One complete performance cycle. */
     result = csoundCompile(csound, argc, argv);
     if (!result) {
       /* do not need csoundYield(), kperf() will call it */
       while (csoundPerformKsmps(csound) == 0);
     }
     /* delete Csound instance */
     csoundDestroy(csound);
     return NULL;
}

int main(int argc, char **argv)
{
     pthread_t th1, th2;

     pthread_create(&th1, NULL, foobar, (void*) &args1);
     usleep(2000000);
     pthread_create(&th2, NULL, foobar, (void*) &args2);
     while(1);
     return 0;
}


-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7393&alloc_id=16281&op=click
_______________________________________________
Csound-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/csound-devel
Reply | Threaded
Open this post in threaded view
|

Re: [Cs-dev] Score rewinding

Victor Lazzarini
With the PD object, I only seem be able to run one csoundapi instance at a
time.
If I close one of the instances, the other one (that was muted) starts to play.

The difference between the way a PD object works and your example is
that the two instances would have to run in the same thread.

But this should work: PD will put the calls to csoundPerformKsmps of
the different instances in a certain order and collect the output.

Victor

At 12:39 10/05/2005, you wrote:

>Victor Lazzarini wrote:
>>2.Although much more clean and having trouble-free
>>running, inclunding destroying-recreating *csound objects,
>>the engine still has trouble with more than one concurrent
>>instance. It doesn't crash, which is an achievement, but
>>it doesn't work properly.
>
>Can you provide more details about what did not work ? It would
>be much easier to fix then. It is known that a number of opcodes
>and features (e.g. cscore, graphs, spectral/analysis related
>opcodes etc.) have problems, but the following example worked for
>me on Linux, rendering two instances of "Trapped" in real time.
>
>/* Console Csound using the Csound API. */
>
>#include "csoundCore.h"
>#include "csound.h"
>#include "csmodule.h"
>#include <stdio.h>
>#include <stdarg.h>
>#include <pthread.h>
>
>static const int argc1 = 4;
>static const int argc2 = 4;
>
>static const char *argv1[] = {
>     "csound", "examples/trapped.csd", "-o", "dac:front", NULL
>};
>
>static const char *argv2[] = {
>     "csound", "examples/trapped.csd", "-o", "dac:rear", NULL
>};
>
>typedef struct {
>     int   argc;
>     const char  **argv;
>} ARGS;
>
>static const ARGS args1 = { argc1, &argv1[0] };
>static const ARGS args2 = { argc2, &argv2[0] };
>
>static void *foobar(void *args)
>{
>     int argc = ((ARGS*) args)->argc;
>     char **argv = (char**) ((ARGS*) args)->argv;
>     void  *csound;
>     int   result;
>     /*  Create Csound. */
>     csound = csoundCreate(NULL);
>     /*  One complete performance cycle. */
>     result = csoundCompile(csound, argc, argv);
>     if (!result) {
>       /* do not need csoundYield(), kperf() will call it */
>       while (csoundPerformKsmps(csound) == 0);
>     }
>     /* delete Csound instance */
>     csoundDestroy(csound);
>     return NULL;
>}
>
>int main(int argc, char **argv)
>{
>     pthread_t th1, th2;
>
>     pthread_create(&th1, NULL, foobar, (void*) &args1);
>     usleep(2000000);
>     pthread_create(&th2, NULL, foobar, (void*) &args2);
>     while(1);
>     return 0;
>}
>
>
>-------------------------------------------------------
>This SF.Net email is sponsored by Oracle Space Sweepstakes
>Want to be the first software developer in space?
>Enter now for the Oracle Space Sweepstakes!
>http://ads.osdn.com/?ad_id=7393&alloc_id=16281&op=click
>_______________________________________________
>Csound-devel mailing list
>[hidden email]
>https://lists.sourceforge.net/lists/listinfo/csound-devel

Victor Lazzarini
Music Technology Laboratory
Music Department
National University of Ireland, Maynooth



-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7393&alloc_id=16281&op=click
_______________________________________________
Csound-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/csound-devel
Reply | Threaded
Open this post in threaded view
|

Re: [Cs-dev] Score rewinding

istvan_v@mailbox.hu
Victor Lazzarini wrote:

> With the PD object, I only seem be able to run one csoundapi instance at a
> time.
> If I close one of the instances, the other one (that was muted) starts
> to play.

Is the muting implemented in libcsound, or the PD object ?


-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7393&alloc_id=16281&op=click
_______________________________________________
Csound-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/csound-devel
Reply | Threaded
Open this post in threaded view
|

Re: [Cs-dev] Score rewinding

Victor Lazzarini
The muting is the problem; the second instance is not supposed to be muted,
but to
play at the same time.

The code is now in CVS (frontends/csoundapi_tilde), you can look at it.

Victor
At 13:54 10/05/2005, you wrote:

>Victor Lazzarini wrote:
>
>>With the PD object, I only seem be able to run one csoundapi instance at a
>>time.
>>If I close one of the instances, the other one (that was muted) starts to
>>play.
>
>Is the muting implemented in libcsound, or the PD object ?
>
>
>-------------------------------------------------------
>This SF.Net email is sponsored by Oracle Space Sweepstakes
>Want to be the first software developer in space?
>Enter now for the Oracle Space Sweepstakes!
>http://ads.osdn.com/?ad_id=7393&alloc_id=16281&op=click
>_______________________________________________
>Csound-devel mailing list
>[hidden email]
>https://lists.sourceforge.net/lists/listinfo/csound-devel

Victor Lazzarini
Music Technology Laboratory
Music Department
National University of Ireland, Maynooth



-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7393&alloc_id=16281&op=click
_______________________________________________
Csound-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/csound-devel
Reply | Threaded
Open this post in threaded view
|

Re: [Cs-dev] Score rewinding

Istvan Varga
Victor Lazzarini wrote:

> The muting is the problem; the second instance is not supposed to be
> muted, but to
> play at the same time.

This is odd, but sounds more like a PD related issue. Code in libcsound
that does not work with multiple instances is more likely to result in
(possibly random) crashes.

> The code is now in CVS (frontends/csoundapi_tilde), you can look at it.

Not really useful. I do not use PD, and could not find out how to test
the object (other than compiling it and loading with PD).


-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7393&alloc_id=16281&op=click
_______________________________________________
Csound-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/csound-devel
Reply | Threaded
Open this post in threaded view
|

Re: [Cs-dev] Score rewinding

Victor Lazzarini
It could be PD,  but I can't see that it would. What seems to happen is that
csoundPerformKsmps() of one instance waits until the other instance has
finished performing the score and then it starts producing audio.

I have to do more tests.

Victor

At 18:13 10/05/2005, you wrote:

>Victor Lazzarini wrote:
>
>>The muting is the problem; the second instance is not supposed to be
>>muted, but to
>>play at the same time.
>
>This is odd, but sounds more like a PD related issue. Code in libcsound
>that does not work with multiple instances is more likely to result in
>(possibly random) crashes.
>
>>The code is now in CVS (frontends/csoundapi_tilde), you can look at it.
>
>Not really useful. I do not use PD, and could not find out how to test
>the object (other than compiling it and loading with PD).
>
>
>-------------------------------------------------------
>This SF.Net email is sponsored by Oracle Space Sweepstakes
>Want to be the first software developer in space?
>Enter now for the Oracle Space Sweepstakes!
>http://ads.osdn.com/?ad_id=7393&alloc_id=16281&op=click
>_______________________________________________
>Csound-devel mailing list
>[hidden email]
>https://lists.sourceforge.net/lists/listinfo/csound-devel

Victor Lazzarini
Music Technology Laboratory
Music Department
National University of Ireland, Maynooth



-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7393&alloc_id=16281&op=click
_______________________________________________
Csound-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/csound-devel
Reply | Threaded
Open this post in threaded view
|

Re: [Cs-dev] Score Rewinding

Michael Gogins
In reply to this post by Istvan Varga
What was wrong with the 'a' event is that it did not produce the proper behavior when I tested it. If you can get it to produce the proper behavior, I'll be happy to put the 'a' event back, since I do understand what you are saying about MIDI files.

The designed behavior is this. Suppose the host is performing a Csound score, and the user has set a loop that begins at bar 5 and plays through bar 8. When the use presses "Play", Csound should immediately begin playing from bar 5 in the score, play through bar 8, and immediately jump back and begin playing from bar 5 again. (In reality, the times are calculated in sample frames.)

I will try putting the 'a' code back and playing with it to see if I can get this behavior.

As for pause or mute, in this context they are functionally equivalent, because when a host loops over a section of score (which is what these APIs are all about), the host will always execute the sequence of calls that I quoted from CsoundVST. Therefore, muting instead of pausing is an acceptable implementation, because the host will immediately reset the score offset at the same time as it un-mutes, which has the same effect as un-pausing. If you can come up with a more efficient or better way of doing this, that would be great. Of course, my approach has the advantage of being brain-dead simple and apparently lackiing side effects.

In real life, in the context for which I designed and implemented this API, setting the score offset before actually performing has no meaning and no effect since the host will always do that over again when it starts looping. That's why I removed setting the score offset from Csound itself. Only the host should be setting the score offset, Csound should only be responding to it.

I feel a need to remind people that I designed and originally implemented these APIs, and they used to work. Therefore, any changes that are made simply must produce the originally designed behavior. I am glad to learn about the faults and shortcomings such as problems with MIDI files etc., and I welcome any thoughts or contributions to improve the code, but the fact is that my fixes do enable synchronization of Csound scores with notation and real-time MIDI performance in VST hosts, and this is much better than the way it was.

If anyone wants different behavior, and I don't agree that that behavior is correct for these APIs, then they should define new API calls for their desired behavior.

Regards,
Mike

-----Original Message-----
From: Istvan Varga <[hidden email]>
Sent: May 11, 2005 4:50 AM
To: [hidden email]
Subject: Re: [Cs-dev] Score Rewinding

Michael Gogins wrote:

> In musmon.c and in csound.c, I removed the code that inserted an 'a'
> score event to advance the time,

What was wrong with that ?

> and I added code that simply subtracts  the offset seconds from the current
 > score time and beat.

Which will not work at least in the case of MIDI files (unlike 'a', which
did), and beat mode.

> I also added code to test for csoundIsScorePending_. If true, processing
> is exactly as before. If false, processing is also exactly as before,
> every score event is read, times are computed, and so on, except that
> 'i' events are simply not inserted into the performance, so they don't
> sound.

However, this does not pause playback, but rather than that, mutes events.
And, needless to say, has no effect at all on notes from MIDI files.

@@ -305,11 +305,8 @@
        csound->Message(csound, Str("playing from cscore.srt\n"));
        O->usingcscore = 0;
      }
      csound->Message(csound, Str("SECTION %d:\n"), ++ST(sectno));
-    /* apply score offset if non-zero */
-    if (csound->csoundScoreOffsetSeconds_ > FL(0.0))
-      csound->SetScoreOffsetSeconds(csound, csound->csoundScoreOffsetSeconds_);

Why was this removed ?

                                       /* since we are running in components */
      return 0;                        /* we exit here to playevents later   */
  }

@@ -796,10 +795,10 @@
          case 'q':
          case 'i':
          case 'f':
          case 'a':
-          p->nxtim = (double) e->p[2] + p->timeOffs;
-          p->nxtbt = (double) e->p2orig + p->beatOffs;
+          p->nxtim = (double) e->p[2] + p->timeOffs - csound->csoundScoreOffsetSeconds_;
+          p->nxtbt = (double) e->p2orig + p->beatOffs - csound->csoundScoreOffsetSeconds_ / p->beatTime;

p->nxtbt is wrong. You did assume that tempo can never change during performance, right ?


-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7393&alloc_id=16281&op=click
_______________________________________________
Csound-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/csound-devel





-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7393&alloc_id=16281&op=click
_______________________________________________
Csound-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/csound-devel
Reply | Threaded
Open this post in threaded view
|

Re: [Cs-dev] Score Rewinding

Istvan Varga
Michael Gogins wrote:

> What was wrong with the 'a' event is that it did not produce
 > the proper behavior when I tested it. If you can get it to produce
 > the proper behavior, I'll be happy to put the 'a' event back, since
 > I do understand what you are saying about MIDI files.

You still did not describe what the expected "proper behavior" is in the
context of the API (and not Cubase and CsoundVST of which I use neither).
However, I guess that while skipping time you do not want the perform
functions to return for every single skipped frame. So, I reverted to the
old code, but changed csoundPerformKsmps and related functions to not return
until the advance is complete and the requested time is reached.

> As for pause or mute, in this context they are functionally equivalent,

No, an API call should do what it is documented and expected to do,
and not just what is functionally equivalent for a single specific host
application. It may very well make sense to have a function that mutes
notes in this particular way, but then it would better be named something
like csoundMuteNonMIDINotes().

> Of course, my approach has the advantage of being brain-dead simple and
 > apparently lackiing side effects.

It also mutes all non-MIDI real time events (line events, event, schedkwhen, etc.).
Does that count as a side effect ?



-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7393&alloc_id=16281&op=click
_______________________________________________
Csound-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/csound-devel
Reply | Threaded
Open this post in threaded view
|

Re: [Cs-dev] Score Rewinding

Michael Gogins
In reply to this post by Istvan Varga
The API comments are perfectly clear about what the score offset is.

But I admit, the score pending idea is not clarified, and the reader could easily be mystified.

I will amend the comments this evening to provide a complete description of the previous behavior.

Regards,
Mike

-----Original Message-----
From: Istvan Varga <[hidden email]>
Sent: May 11, 2005 11:04 AM
To: [hidden email]
Subject: Re: [Cs-dev] Score Rewinding

Michael Gogins wrote:

> What was wrong with the 'a' event is that it did not produce
 > the proper behavior when I tested it. If you can get it to produce
 > the proper behavior, I'll be happy to put the 'a' event back, since
 > I do understand what you are saying about MIDI files.

You still did not describe what the expected "proper behavior" is in the
context of the API (and not Cubase and CsoundVST of which I use neither).
However, I guess that while skipping time you do not want the perform
functions to return for every single skipped frame. So, I reverted to the
old code, but changed csoundPerformKsmps and related functions to not return
until the advance is complete and the requested time is reached.

> As for pause or mute, in this context they are functionally equivalent,

No, an API call should do what it is documented and expected to do,
and not just what is functionally equivalent for a single specific host
application. It may very well make sense to have a function that mutes
notes in this particular way, but then it would better be named something
like csoundMuteNonMIDINotes().

> Of course, my approach has the advantage of being brain-dead simple and
 > apparently lackiing side effects.

It also mutes all non-MIDI real time events (line events, event, schedkwhen, etc.).
Does that count as a side effect ?



-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7393&alloc_id=16281&op=click
_______________________________________________
Csound-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/csound-devel





-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7393&alloc_id=16281&op=click
_______________________________________________
Csound-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/csound-devel
Reply | Threaded
Open this post in threaded view
|

Re: [Cs-dev] Score Rewinding

Michael Gogins
In reply to this post by Istvan Varga
I have updated the comments in csound.h to clarify the original and intended
behavior of csoundSetScoreOffsetSeconds and csoundSetScorePending.

I have tested the latest code, and I found that the "a" event implementation
now works better, at least in Cubase. However, it is still not quite
correct. The problem is as follows:

I set up a Csound score to perform in Cubase, with a loop from 5 through 10
seconds.

Performing from 0, to the end of the loop, and looping any number of times
between 5 and 10 worked correctly.

However, first pausing the performance, then restarting it, caused the
performance to begin at time 0 in the host with the score advanced to time
5, but when the loop jumps back to the time 5, the time is correct again.

Also, I found that my score pending update was removed, so I put it back,
with a change to not mute score events that are realtime events. This seems
to work in Cubase. Istvan, do you think this will work in other contexts?

I am quite willing to rename these API functions to make their intended
function clearer. How about:

csoundSetScoreStartTime instead of csoundSetScoreOffsetSeconds,

and

csoundMuteScore instead of csoundSetScorePending?

Regards,
Mike

----- Original Message -----
From: "Istvan Varga" <[hidden email]>
To: <[hidden email]>
Sent: Wednesday, May 11, 2005 11:04 AM
Subject: Re: [Cs-dev] Score Rewinding


> Michael Gogins wrote:
>
>> What was wrong with the 'a' event is that it did not produce
> > the proper behavior when I tested it. If you can get it to produce
> > the proper behavior, I'll be happy to put the 'a' event back, since
> > I do understand what you are saying about MIDI files.
>
> You still did not describe what the expected "proper behavior" is in the
> context of the API (and not Cubase and CsoundVST of which I use neither).
> However, I guess that while skipping time you do not want the perform
> functions to return for every single skipped frame. So, I reverted to the
> old code, but changed csoundPerformKsmps and related functions to not
> return
> until the advance is complete and the requested time is reached.
>
>> As for pause or mute, in this context they are functionally equivalent,
>
> No, an API call should do what it is documented and expected to do,
> and not just what is functionally equivalent for a single specific host
> application. It may very well make sense to have a function that mutes
> notes in this particular way, but then it would better be named something
> like csoundMuteNonMIDINotes().
>
>> Of course, my approach has the advantage of being brain-dead simple and
> > apparently lackiing side effects.
>
> It also mutes all non-MIDI real time events (line events, event,
> schedkwhen, etc.).
> Does that count as a side effect ?
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by Oracle Space Sweepstakes
> Want to be the first software developer in space?
> Enter now for the Oracle Space Sweepstakes!
> http://ads.osdn.com/?ad_id=7393&alloc_id=16281&op=click
> _______________________________________________
> Csound-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/csound-devel
>




-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7393&alloc_id=16281&op=click
_______________________________________________
Csound-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/csound-devel
Reply | Threaded
Open this post in threaded view
|

Re: [Cs-dev] Score rewinding

Istvan Varga
In reply to this post by Istvan Varga
Victor Lazzarini wrote:

> This is becoming a bit boring to everyone, but I can't
> get rewinding to work, after updating from CVS.

Are you using csoundCleanup() before rewinding ? If yes, then that is
the reason why csoundRewind() does not seem to work. After calling
csoundCleanup() (which will close the score file, by the way), you can
no longer expect csoundPerformKsmps() to work corretly.


-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7393&alloc_id=16281&op=click
_______________________________________________
Csound-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/csound-devel
Reply | Threaded
Open this post in threaded view
|

Re: [Cs-dev] Score rewinding

Victor Lazzarini
A-ha!

I'll try that.

Victor

At 11:17 12/05/2005, you wrote:

>Victor Lazzarini wrote:
>
>>This is becoming a bit boring to everyone, but I can't
>>get rewinding to work, after updating from CVS.
>
>Are you using csoundCleanup() before rewinding ? If yes, then that is
>the reason why csoundRewind() does not seem to work. After calling
>csoundCleanup() (which will close the score file, by the way), you can
>no longer expect csoundPerformKsmps() to work corretly.
>
>
>-------------------------------------------------------
>This SF.Net email is sponsored by Oracle Space Sweepstakes
>Want to be the first software developer in space?
>Enter now for the Oracle Space Sweepstakes!
>http://ads.osdn.com/?ad_id=7393&alloc_id=16281&op=click
>_______________________________________________
>Csound-devel mailing list
>[hidden email]
>https://lists.sourceforge.net/lists/listinfo/csound-devel

Victor Lazzarini
Music Technology Laboratory
Music Department
National University of Ireland, Maynooth



-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7393&alloc_id=16281&op=click
_______________________________________________
Csound-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/csound-devel
Reply | Threaded
Open this post in threaded view
|

Re: [Cs-dev] Score Rewinding

Istvan Varga
In reply to this post by Michael Gogins
Michael Gogins wrote:

> I have updated the comments in csound.h to clarify the original and
> intended behavior of csoundSetScoreOffsetSeconds and csoundSetScorePending.

I cannot see any changes, and SF is down for at least 13 hours now.

> However, first pausing the performance, then restarting it, caused the
> performance to begin at time 0 in the host with the score advanced to
> time 5, but when the loop jumps back to the time 5, the time is correct
> again.

This coule be explained better. I do not use Cubase or CsoundVST, nor do I
have any idea about how pausing and restarting the performance is implemented
by CsoundVST.

> Also, I found that my score pending update was removed, so I put it
> back, with a change to not mute score events that are realtime events.
> This seems to work in Cubase. Istvan, do you think this will work in
> other contexts?
>
> I am quite willing to rename these API functions to make their intended
> function clearer. How about:
>
> csoundSetScoreStartTime instead of csoundSetScoreOffsetSeconds,
>
> and
>
> csoundMuteScore instead of csoundSetScorePending?

I removed the change exactly because its purpose is not sufficiently well
defined yet. Issues like this should be discussed first rather than trying
to hack a quick solution. The event system in Csound is much too crippled
already with arcane, vaguely defined, and partly or not at all working
"features" (one example is "beat mode" which would better be removed), and
adding more without making all details clear first is not a good thing.


-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7393&alloc_id=16281&op=click
_______________________________________________
Csound-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/csound-devel
Reply | Threaded
Open this post in threaded view
|

Re: [Cs-dev] Score Rewinding

Michael Gogins
In reply to this post by Istvan Varga
I agree that features should be documented, but it is not right for you to remove a feature that is working and that working code depends upon. I improved the documentation immediately you remarked on it, and I will continue to improve it if that seems necessary.

You are not the only judge or the final arbiter of what is good or bad code, what works or what does not work, or what belongs or does not belong in Csound.

You have NO right to remove code that is working, and that working code depends on -- even more so, once the original designer and author protests. It is not the case that the purpose of these APIs was not defined; all you had to do was run CsoundVST in a VST host to see what they do.

Anyone who has been using CsoundVST to overdub or notate tracks on top of Csound scores, and has updated their code base, is now helpless. Just because you don't know how CsoundVST works is the opposite of an excuse -- you could easily build it, run it, and test it, as indeed you should if you modify code that it depends on, although so far I have been willing to do this for you.

Whether or not you place any personal value on CsoundVST is utterly beside the point, also. The maintainers of an API have more responsibility than the maintainers of an application without an API, since an API that works soon gains clients (such as CsoundVST and now csoundapi_tilde) that depend on its stability for proper functioning.

I also would like to say, I place a tremendous value on your contributions to Csound development. You have really speeded up the pace of development, speeded up the code itself, fixed many bugs, and added many useful new features. I've really enjoyed working with you on Csound, and I look forward to continuing this collaboration.

Regards,
Mike

-----Original Message-----
From: Istvan Varga <[hidden email]>
Sent: May 12, 2005 6:41 AM
To: [hidden email]
Subject: Re: [Cs-dev] Score Rewinding

Michael Gogins wrote:

> I have updated the comments in csound.h to clarify the original and
> intended behavior of csoundSetScoreOffsetSeconds and csoundSetScorePending.

I cannot see any changes, and SF is down for at least 13 hours now.

> However, first pausing the performance, then restarting it, caused the
> performance to begin at time 0 in the host with the score advanced to
> time 5, but when the loop jumps back to the time 5, the time is correct
> again.

This coule be explained better. I do not use Cubase or CsoundVST, nor do I
have any idea about how pausing and restarting the performance is implemented
by CsoundVST.

> Also, I found that my score pending update was removed, so I put it
> back, with a change to not mute score events that are realtime events.
> This seems to work in Cubase. Istvan, do you think this will work in
> other contexts?
>
> I am quite willing to rename these API functions to make their intended
> function clearer. How about:
>
> csoundSetScoreStartTime instead of csoundSetScoreOffsetSeconds,
>
> and
>
> csoundMuteScore instead of csoundSetScorePending?

I removed the change exactly because its purpose is not sufficiently well
defined yet. Issues like this should be discussed first rather than trying
to hack a quick solution. The event system in Csound is much too crippled
already with arcane, vaguely defined, and partly or not at all working
"features" (one example is "beat mode" which would better be removed), and
adding more without making all details clear first is not a good thing.


-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7393&alloc_id=16281&op=click
_______________________________________________
Csound-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/csound-devel





-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7393&alloc_id=16281&op=click
_______________________________________________
Csound-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/csound-devel
Reply | Threaded
Open this post in threaded view
|

csoundapi~

vanDongen/Gilcher
In reply to this post by Victor Lazzarini
On Tue, 10 May 2005 14:30:01 +0200, Victor Lazzarini  
<[hidden email]> wrote:

> With the PD object, I only seem be able to run one csoundapi instance at  
> a time.
> If I close one of the instances, the other one (that was muted) starts  
> to play.
>

Hi victor,

I finally had a change to play around with the cousndapi~ object.
(and many thanks for coding it!)
I can run 2 instances fine, as long as they use different orcs/sco.
I tried it with the examples you included, and then added a csoundapi~  
that just played back trapped.csd.
I can play notes on the example at the same time as trapped in convert was  
playing.
Trying to play 2 instances that both played back trapped.csd failed. The  
second one would not play back at all.
I will examine it a bit further and see if I can find out what is going  
wrong.

cheers

gerard


-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7393&alloc_id=16281&op=click
_______________________________________________
Csound-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/csound-devel
Reply | Threaded
Open this post in threaded view
|

Re: csoundapi~

Doctor B
Gerard,

Since most of my teaching at Berklee and NYU involves Max/MSP/Jitter and
csound~, I haven't don't much work with PD.  I've checked it out of course,
but haven't produced any compositions or teaching materials with PD.  I plan
to do that now - of course and would be most grateful to anyone who would be
willing to share PD examples - especially those that involve csoundapi~.

Gerera, would you share some of your examples with the list and with me?

Hope so.  Can't wait to see all that you come up with.

Dr. B.

on 5/15/05 10:21 AM, gerard van dongen at [hidden email] wrote:

> On Tue, 10 May 2005 14:30:01 +0200, Victor Lazzarini
> <[hidden email]> wrote:
>
>> With the PD object, I only seem be able to run one csoundapi instance at
>> a time.
>> If I close one of the instances, the other one (that was muted) starts
>> to play.
>>
>
> Hi victor,
>
> I finally had a change to play around with the cousndapi~ object.
> (and many thanks for coding it!)
> I can run 2 instances fine, as long as they use different orcs/sco.
> I tried it with the examples you included, and then added a csoundapi~
> that just played back trapped.csd.
> I can play notes on the example at the same time as trapped in convert was
> playing.
> Trying to play 2 instances that both played back trapped.csd failed. The
> second one would not play back at all.
> I will examine it a bit further and see if I can find out what is going
> wrong.
>
> cheers
>
> gerard
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by Oracle Space Sweepstakes
> Want to be the first software developer in space?
> Enter now for the Oracle Space Sweepstakes!
> http://ads.osdn.com/?ad_id=7393&alloc_id=16281&op=click
> _______________________________________________
> Csound-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/csound-devel

_______________________________________________________________________
 +  Dr. Richard Boulanger, Professor
 +  Music Synthesis Department, Berklee College of Music
 +  1140 Boylston Street  - Boston, MA  02215-3693
 +  Office Phone: (617) 747-2485   Office Fax: (617) 747-2564
 +  eMail: [hidden email]
 +  WebPage: http://csounds.com/boulanger/
________________________________________________________________________
 +  Almost Everything Csound @ http://csounds.com/
 +  The Csound Instrument Catalog @ http://csounds.com/catalog/
 +  The Csound Book @ http://csounds.com/book/
 +  The Csound Magazine @ http://csounds.com/ezine/
________________________________________________________________________



-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7393&alloc_id=16281&op=click
_______________________________________________
Csound-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/csound-devel
Reply | Threaded
Open this post in threaded view
|

Re: csoundapi~

Istvan Varga
In reply to this post by vanDongen/Gilcher
gerard van dongen wrote:

> Trying to play 2 instances that both played back trapped.csd failed.
> The  second one would not play back at all.

Is this only in PD ? I was able to play two instances of "Trapped" with
this simple C program.


/* Console Csound using the Csound API. */

#include "csoundCore.h"
#include "csound.h"
#include "csmodule.h"
#include <stdio.h>
#include <stdarg.h>
#include <pthread.h>

static const int argc1 = 10;
static const int argc2 = 10;

static const char *argv1[] = {
    "csound", "-d", "-m231", "-H0", "-s", "-h", "-+rtaudio=alsa",
              "-o", "dac:hw:0", "examples/trapped.csd", NULL
};

static const char *argv2[] = {
    "csound", "-d", "-m231", "-H0", "-s", "-h", "-+rtaudio=alsa",
              "-o", "dac:hw:0", "examples/trapped.csd", NULL
};

typedef struct {
    int   argc;
    const char  **argv;
} ARGS;

static const ARGS args1 = { argc1, &argv1[0] };
static const ARGS args2 = { argc2, &argv2[0] };

static void *foobar(void *args)
{
    int argc = ((ARGS*) args)->argc;
    char **argv = (char**) ((ARGS*) args)->argv;
    void  *csound;
    int   result;
    /*  Create Csound. */
    csound = csoundCreate(NULL);
    /*  One complete performance cycle. */
    result = csoundCompile(csound, argc, argv);
    csoundSetScoreOffsetSeconds(csound, FL(30.0));
    if (!result) {
      /* do not need csoundYield(), kperf() will call it */
      while (csoundPerformKsmps(csound) == 0);
    }
    /* delete Csound instance */
    csoundDestroy(csound);
    return NULL;
}

int main(int argc, char **argv)
{
    pthread_t th1, th2;

    pthread_create(&th1, NULL, foobar, (void*) &args1);
    usleep(1500000);
    pthread_create(&th2, NULL, foobar, (void*) &args2);
    usleep(20000000);
    return 0;
}

Reply | Threaded
Open this post in threaded view
|

Re: csoundapi~

Victor Lazzarini
In reply to this post by vanDongen/Gilcher
I suggested that perhaps the fact that Istvan's
program runs two separate threads is the difference.

Gerard, thanks for testing it.

Victor

>
>
> gerard van dongen wrote:
>
> > Trying to play 2 instances that both played back
> > trapped.csd failed.  The  second one would not play back
> at all.
>
> Is this only in PD ? I was able to play two instances of
> "Trapped" with this simple C program.
>
>
>
> [Attachment: test.c]


-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7393&alloc_id=16281&op=click
_______________________________________________
Csound-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/csound-devel
Reply | Threaded
Open this post in threaded view
|

Re: csoundapi~

Michael Gogins
In reply to this post by vanDongen/Gilcher
If one thread performs multiple instances of Csound, this is possible, but it is then necessary for that thread to call performKsmps for each instance -- I haven't looked at your code. If you're doing that, then there's some other problem. Are you feeding audio to PD or putting it directly out to the sound card? I think it would work better to put it out to PD, the same way CsoundVST copies from its output buffer to the plugin audio output buffer.

PS I will go look at your code now...

Regards,
Mike

-----Original Message-----
From: Victor Lazzarini <[hidden email]>
Sent: May 15, 2005 1:29 PM
To: [hidden email]
Subject: Re: [Cs-dev] csoundapi~

I suggested that perhaps the fact that Istvan's
program runs two separate threads is the difference.

Gerard, thanks for testing it.

Victor

>
>
> gerard van dongen wrote:
>
> > Trying to play 2 instances that both played back
> > trapped.csd failed.  The  second one would not play back
> at all.
>
> Is this only in PD ? I was able to play two instances of
> "Trapped" with this simple C program.
>
>
>
> [Attachment: test.c]


-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7393&alloc_id=16281&op=click
_______________________________________________
Csound-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/csound-devel





-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7393&alloc_id=16281&op=click
_______________________________________________
Csound-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/csound-devel
Reply | Threaded
Open this post in threaded view
|

Re: csoundapi~

Michael Gogins
In reply to this post by vanDongen/Gilcher
I took a hasty glance through your code, and it seems to copy spout to PD and spin from PD.

Perhaps the problem with 2 instances playing 1 Csound score/orchestra is that the file(s) get(s) locked by the first instance? It would be easy to test that by making an identical copy of the score/orchestra with a different name, and then try running 2 instances in PD.

Regards,
Mike

-----Original Message-----
From: Michael Gogins <[hidden email]>
Sent: May 15, 2005 1:39 PM
To: [hidden email]
Subject: Re: [Cs-dev] csoundapi~

If one thread performs multiple instances of Csound, this is possible, but it is then necessary for that thread to call performKsmps for each instance -- I haven't looked at your code. If you're doing that, then there's some other problem. Are you feeding audio to PD or putting it directly out to the sound card? I think it would work better to put it out to PD, the same way CsoundVST copies from its output buffer to the plugin audio output buffer.

PS I will go look at your code now...

Regards,
Mike

-----Original Message-----
From: Victor Lazzarini <[hidden email]>
Sent: May 15, 2005 1:29 PM
To: [hidden email]
Subject: Re: [Cs-dev] csoundapi~

I suggested that perhaps the fact that Istvan's
program runs two separate threads is the difference.

Gerard, thanks for testing it.

Victor

>
>
> gerard van dongen wrote:
>
> > Trying to play 2 instances that both played back
> > trapped.csd failed.  The  second one would not play back
> at all.
>
> Is this only in PD ? I was able to play two instances of
> "Trapped" with this simple C program.
>
>
>
> [Attachment: test.c]


-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7393&alloc_id=16281&op=click
_______________________________________________
Csound-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/csound-devel





-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7393&alloc_id=16281&op=click
_______________________________________________
Csound-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/csound-devel





-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7393&alloc_id=16281&op=click
_______________________________________________
Csound-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/csound-devel
12