[Csnd] RewindScore() usage in Python
Date | 2014-05-07 21:55 |
From | zappfinger |
Subject | [Csnd] RewindScore() usage in Python |
How do I use RewindScore()? When I pause the performanceThread, and then call csound.RewindScore(), I get an error, 'cannot rewind score'. When I let the perf thread finish, and then rewind, it complains there is no score in memory... Richard -- View this message in context: http://csound.1045644.n5.nabble.com/RewindScore-usage-in-Python-tp5735016.html Sent from the Csound - General mailing list archive at Nabble.com. |
Date | 2014-05-07 22:05 |
From | Victor Lazzarini |
Subject | Re: [Csnd] RewindScore() usage in Python |
It could be that you never had any score in memory to start with. In order to load a score you either 1) have a score in the CSD 2) Call csoundReadScore() BEFORE csoundStart() otherwise Csound will start without a score in memory. All further score events will be passed as realtime events. ======================== Dr Victor Lazzarini Senior Lecturer NUI Maynooth, Ireland victor dot lazzarini at nuim dot ie On 7 May 2014, at 21:55, zappfinger |
Date | 2014-05-07 22:18 |
From | zappfinger |
Subject | [Csnd] Re: RewindScore() usage in Python |
Ok, I use score events sent to the perf thread, like: for scor in track('track1.sco'): self.csPerfThread.InputMessage(scor) and RewindScore works on the csound object, so I see a challenge here.. Richard -- View this message in context: http://csound.1045644.n5.nabble.com/RewindScore-usage-in-Python-tp5735016p5735019.html Sent from the Csound - General mailing list archive at Nabble.com. |
Date | 2014-05-07 22:22 |
From | Victor Lazzarini |
Subject | Re: [Csnd] RewindScore() usage in Python |
Those events are not placed in the score memory, they are RT events, so you can’t rewind them. But if you are doing this, surely you can just keep them as a python list and do the rewinding there. ======================== Dr Victor Lazzarini Senior Lecturer NUI Maynooth, Ireland victor dot lazzarini at nuim dot ie On 7 May 2014, at 22:18, zappfinger |
Date | 2014-05-07 22:36 |
From | David Worrall |
Subject | Re: [Csnd] RewindScore() usage in Python |
to jump into this thread… When I run a real time csound from python (under OSX), using the sequence: cs=csnd6.Csound() cs.SetOption('-dac') csPerf = csnd6.CsoundPerformanceThread(cs) cs.Start() csPerf.Play() cs.CompileOrch(… cs.ReadScore(… Everything goes fine, leaving the python in a usable state, for all but a repeat run. What is the best way to return the Python interpreter to a state in which allows it the run another version of the above? Thanks, David On 07.05.2014, at 23:18, zappfinger <zappfinger@gmail.com> wrote: Ok, I use score events sent to the perf thread, like: ______________________________________ Prof. Dr. David Worrall Emerging Audio Research (EAR) Audio Department International Audio Laboratories Erlangen Fraunhofer-Institut für Integrierte Schaltungen IIS Am Wolfsmantel 33 91058 Erlangen Telefon +49 (0) 91 31 / 7 76-62 44 Fax +49 (0) 91 31 / 7 76-20 99 E-Mail: david.worrall@iis.fraunhofer.de Internet: www.iis.fraunhofer.de --- Adjunct Senior Research Fellow School of Music, Australian National University |
Date | 2014-05-07 22:43 |
From | zappfinger |
Subject | [Csnd] Re: RewindScore() usage in Python |
I see. So I can't use the GetScoreTime, etc. calls either, I have to provide my own when working with RT events... Richard -- View this message in context: http://csound.1045644.n5.nabble.com/RewindScore-usage-in-Python-tp5735016p5735023.html Sent from the Csound - General mailing list archive at Nabble.com. |
Date | 2014-05-07 22:45 |
From | Victor Lazzarini |
Subject | Re: [Csnd] Re: RewindScore() usage in Python |
yep. ======================== Dr Victor Lazzarini Senior Lecturer NUI Maynooth, Ireland victor dot lazzarini at nuim dot ie On 7 May 2014, at 22:43, zappfinger |
Date | 2014-05-07 22:46 |
From | Victor Lazzarini |
Subject | Re: [Csnd] RewindScore() usage in Python |
I would do cs=csnd6.Csound() cs.SetOption('-dac’) cs.CompileOrch(… cs.ReadScore(“f 0 36000 \n” + sco... csPerf = csnd6.CsoundPerformanceThread(cs) cs.Start() csPerf.Play() ... cs.RewindScore() The reason for f 0 36000 is to keep Csound running after the score events are done, otherwise the perf thread ends and the csound instance is cleaned up. (not tested) ======================== Dr Victor Lazzarini Senior Lecturer NUI Maynooth, Ireland victor dot lazzarini at nuim dot ie On 7 May 2014, at 22:36, David Worrall |
Date | 2014-05-07 22:55 |
From | zappfinger |
Subject | [Csnd] Re: RewindScore() usage in Python |
Good question, I would not now. In my csound midi recorder I convert midi events to score, and then send the recorded score to the perf. thread while recording another score, so I do not use ReadScore(). Maybe someone else knows? Richard -- View this message in context: http://csound.1045644.n5.nabble.com/RewindScore-usage-in-Python-tp5735016p5735026.html Sent from the Csound - General mailing list archive at Nabble.com. |
Date | 2014-05-07 23:42 |
From | David Worrall |
Subject | Re: [Csnd] RewindScore() usage in Python |
Thanks Victor. I'm getting a "too few p-fields" with “f 0 36000 \n” + sco… know idea why… just checked “f0 36000 \n” in case but same result. In any event I was trying to avoid f 0 36000 if possible … as I want to it to run weeks, not hours… do you know how large the "36000" argument can be? Perhaps I can send the 'f 0 command multiple times? D. On 07.05.2014, at 23:46, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote: I would do csPerf = csnd6.CsoundPerformanceThread(cs) ______________________________________ Prof. Dr. David Worrall Emerging Audio Research (EAR) Audio Department International Audio Laboratories Erlangen Fraunhofer-Institut für Integrierte Schaltungen IIS Am Wolfsmantel 33 91058 Erlangen Telefon +49 (0) 91 31 / 7 76-62 44 Fax +49 (0) 91 31 / 7 76-20 99 E-Mail: david.worrall@iis.fraunhofer.de Internet: www.iis.fraunhofer.de --- Adjunct Senior Research Fellow School of Music, Australian National University |
Date | 2014-05-08 06:52 |
From | Victor Lazzarini |
Subject | Re: [Csnd] RewindScore() usage in Python |
In f 0 N , N can be very large (years, rather than weeks). It’s in seconds. Try this: import csnd6 import time cs=csnd6.Csound() cs.SetOption('-odac') cs.CompileOrc("instr 1 \n out(oscili(1000,440)) \n endin \n") cs.ReadScore("f 0 36000 \n" + "i1 0 1 \n") csPerf = csnd6.CsoundPerformanceThread(cs) cs.Start() csPerf.Play() time.sleep(2) cs.RewindScore() time.sleep(2) ======================== Dr Victor Lazzarini Senior Lecturer NUI Maynooth, Ireland victor dot lazzarini at nuim dot ie On 7 May 2014, at 23:42, David Worrall |
Date | 2014-05-08 07:53 |
From | jpff@cs.bath.ac.uk |
Subject | [Csnd] Re: |
Attachments | None |
Date | 2014-05-08 10:52 |
From | Victor Lazzarini |
Subject | Re: [Csnd] |
It does work. I did not know about this, is it documented? ======================== Dr Victor Lazzarini Senior Lecturer NUI Maynooth, Ireland victor dot lazzarini at nuim dot ie On 8 May 2014, at 07:53, jpff@cs.bath.ac.uk wrote: > Does "f 0 z" work? > > Quoting David Worrall |
Date | 2014-05-08 11:03 |
From | jpff@cs.bath.ac.uk |
Subject | [Csnd] Re: |
Attachments | None |
Date | 2014-05-08 11:37 |
From | jpff@cs.bath.ac.uk |
Subject | [Csnd] Re: |
Attachments | None |
Date | 2014-05-08 13:36 |
From | luis jure |
Subject | Re: [Csnd] Re: |
el 2014-05-08 a las 11:37 jpff@cs.bath.ac.uk escribió: > Apparently not documented. I have added a bit now, but not sure it is > in the best place. and perhaps posting also a short description to the list? i really hope i'm not the only one who doesn't have an idea what you guys are talking about... |
Date | 2014-05-08 14:20 |
From | joachim heintz |
Subject | Re: [Csnd] Re: |
apparently this is an expression which lets csound run for z beats or hours or weeks. (z is something like the speed of light in the theory of relativity -- so it doesn't matter whether you count this time in beats hours weeks or lifetimes.) =) j Am 08.05.2014 14:36, schrieb luis jure: > > el 2014-05-08 a las 11:37 jpff@cs.bath.ac.uk escribió: > >> Apparently not documented. I have added a bit now, but not sure it is >> in the best place. > > and perhaps posting also a short description to the list? i really hope > i'm not the only one who doesn't have an idea what you guys are talking > about... > > > > Send bugs reports to > https://github.com/csound/csound/issues > Discussions of bugs and features can be posted here > To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound" > > > > |
Date | 2014-05-08 14:21 |
From | jpff@cs.bath.ac.uk |
Subject | [Csnd] Re: |
Attachments | None |
Date | 2014-05-08 14:44 |
From | joachim heintz |
Subject | Re: [Csnd] Re: |
well i'd say: except the fact that 25367 is not a power of two, this is not bad. thanks for the implementation and the explanation - j Am 08.05.2014 15:21, schrieb jpff@cs.bath.ac.uk: > > >> and perhaps posting also a short description to the list? i really hope >> i'm not the only one who doesn't have an idea what you guys are talking >> about... >> >> > > I apologise -- I thought this had been documented and explained but it > seems that I was wrong > > There was a call for a large time constant fir people doing > installations in particular. As a result the score reader was changed > so in addition to the usual number format the single character z is read > as a number -- actually > 800000000000.0 which is approximately 25367 years in seconds. > > So > f 0 z > creates table 0 (actually does not ...) in 25k years time if your > computer is still running, there is still electricity and humans have > failed to destroy themselves in some other way. > > > Not sure if that explains it or not > > ==John ff > > > > > Send bugs reports to > https://github.com/csound/csound/issues > Discussions of bugs and features can be posted here > To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe > csound" > > > > |
Date | 2014-05-08 15:05 |
From | Anders Genell |
Subject | Re: [Csnd] Re: |
I agree completely!
How can an experienced computer programmer come up with a completely biźarre number like 800 000 000 000.0? I can only assume 16384 years was too little and 32768 years was overkill.
/Anders On Thu, May 8, 2014 at 3:44 PM, joachim heintz <jh@joachimheintz.de> wrote: well i'd say: except the fact that 25367 is not a power of two, this is not bad. |
Date | 2014-05-08 15:09 |
From | luis jure |
Subject | Re: [Csnd] Re: |
> Not sure if that explains it or not yes, thank you! i actually suspected it was something like "run forever", or something like that. it's good to know what it actually means. great idea. not that i think i'll ever use it, but i see the point. |
Date | 2014-05-08 15:21 |
From | mskala@ansuz.sooke.bc.ca |
Subject | Re: [Csnd] Re: |
On Thu, 8 May 2014, Anders Genell wrote: > How can an experienced computer programmer come up with a completely biźarre > number like 800 000 000 000.0?I can only assume 16384 years was too little > and 32768 years was overkill. Since the internal unit is almost certainly seconds, not years, it'd make more sense to have a power-of-two number of seconds. -- Matthew Skala mskala@ansuz.sooke.bc.ca People before principles. http://ansuz.sooke.bc.ca/ |
Date | 2014-05-08 15:28 |
From | Anders Genell |
Subject | Re: [Csnd] Re: |
That is true.
2³⁹ = 549755813888 seconds = 17432 years 2⁴⁰ = 1099511627780 seconds = 34865 years i'd go for the latter just to be on the safe side... On Thu, May 8, 2014 at 4:21 PM, <mskala@ansuz.sooke.bc.ca> wrote:
|
Date | 2014-05-08 16:21 |
From | joachim heintz |
Subject | Re: [Csnd] Re: |
"not that i think i'll ever use it" luis: please think at your children as well. and the children of your children, and ... Am 08.05.2014 16:09, schrieb luis jure: > >> Not sure if that explains it or not > > yes, thank you! i actually suspected it was something like "run forever", > or something like that. it's good to know what it actually means. great > idea. not that i think i'll ever use it, but i see the point. > > > Send bugs reports to > https://github.com/csound/csound/issues > Discussions of bugs and features can be posted here > To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound" > > > > |
Date | 2014-05-08 21:05 |
From | David Worrall |
Subject | Re: [Csnd] RewindScore() usage in Python |
Apologies for my delay in replying - I wanted to wait until the z-long process had completed…. Victor, you example works. in fact so does cs.ReadScore("f 0 36000 \n i1 0 1 \n")i.e. no need to split it into 2 strings. and it works for z as well. You will have noticed that I was cs.CompileOrc()ing I was compiling Orch Options, not the instruments, which I did later (once a Perf thread had been instantiated and was running.cs.CompileOrch(… That works fine. I have discovered that: 1. If I use: cs.ReadsScore("f 0 36000 0 \n") The error does not appear. Not sure if the f statement is "active". 2. If I do a cs.ReadScore("f 0 36000 \n") _before_ instantiating the PerformanceThread, the error doesn't appear. I don't know if either of these options actually work in the situation - didn't wait to find out :-) Which prompts the question, how can I query from within python which fstatements are currently active? D. On 08.05.2014, at 07:52, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote: In f 0 N , N can be very large (years, rather than weeks). It’s in seconds. ______________________________________ Prof. Dr. David Worrall Emerging Audio Research (EAR) Audio Department International Audio Laboratories Erlangen Fraunhofer-Institut für Integrierte Schaltungen IIS Am Wolfsmantel 33 91058 Erlangen Telefon +49 (0) 91 31 / 7 76-62 44 Fax +49 (0) 91 31 / 7 76-20 99 E-Mail: david.worrall@iis.fraunhofer.de Internet: www.iis.fraunhofer.de --- Adjunct Senior Research Fellow School of Music, Australian National University |
Date | 2014-05-08 21:21 |
From | Victor Lazzarini |
Subject | Re: [Csnd] RewindScore() usage in Python |
Ok, the reason I split into two strings was just to follow my first example and have the second string in lieu of 'sco'. ReadScore works like this: 1) before the call to Start(), it reads a score in the same way the score is read from the CSD file. In other words, the score gets loaded as the 'main' score in memory. This means that a statement like 'f 0 z' will work as expected (it just keeps Csound open). 2) after Start(), ReadScore() sorts the score etc but issues the events as RT events (similar to InputMessage, ScoreEvent etc). In this case, the 'f 0 z' does not work as expected, because csound has already started and the 'f 0 z' instruction has already been passed to Csound (because there is no score, Csound will be open indefinitely). So the difference is whether the Csound engine has started or not. Once it's started, you cannot load a score into memory. So in that case, there is also nothing to rewind(). If you kill the thread, and call Reset(), then you can load a score and start Csound again. You will also need a new perf thread object. I hope this makes it clear. Regards Victor On 8 May 2014, at 21:05, David Worrall wrote: > Apologies for my delay in replying - I wanted to wait until the z-long process had completed…. > > Victor, you example works. > in fact so does >> cs.ReadScore("f 0 36000 \n i1 0 1 \n") > i.e. no need to split it into 2 strings. > and it works for z as well. > > You will have noticed that I was cs.CompileOrc()ing >>>> cs.CompileOrch(… > I was compiling Orch Options, not the instruments, which I did later (once a Perf thread had been instantiated and was running. > That works fine. > > I have discovered that: > 1. If I use: cs.ReadsScore("f 0 36000 0 \n") The error does not appear. Not sure if the f statement is "active". > 2. If I do a cs.ReadScore("f 0 36000 \n") _before_ instantiating the PerformanceThread, the error doesn't appear. > > I don't know if either of these options actually work in the situation - didn't wait to find out :-) > > Which prompts the question, how can I query from within python which fstatements are currently active? > > D. > > > On 08.05.2014, at 07:52, Victor Lazzarini |
Date | 2014-05-08 22:25 |
From | David Worrall |
Subject | Re: [Csnd] RewindScore() usage in Python |
Pretty clear, thanks Victor. I've got it running much more smoothly And ReadScore() sorts the score - in real time. Is there a way of switching the sort off? (with multiple BG process doing streamed data acquisition, I honing for speed…) [I notice the manual mentions "extract" but not in the context of RT] or, to put it another way: I have multiple threads producing ReadScore() events. If Readscore() sorts them, it is likely to do it faster than Python can, so perhaps I don't need to sort them b4 "dumping" them into RT CS perf. Does that sound logical? D. On 08.05.2014, at 22:21, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote: Ok, the reason I split into two strings was just to follow my first example and have the second string in lieu of 'sco'. ______________________________________ Prof. Dr. David Worrall Emerging Audio Research (EAR) Audio Department International Audio Laboratories Erlangen Fraunhofer-Institut für Integrierte Schaltungen IIS Am Wolfsmantel 33 91058 Erlangen Telefon +49 (0) 91 31 / 7 76-62 44 Fax +49 (0) 91 31 / 7 76-20 99 E-Mail: david.worrall@iis.fraunhofer.de Internet: www.iis.fraunhofer.de --- Adjunct Senior Research Fellow School of Music, Australian National University |
Date | 2014-05-08 22:43 |
From | Victor Lazzarini |
Subject | Re: [Csnd] RewindScore() usage in Python |
If you don't need sorting, use inputMessage() instead, it does not sort anything, just schedules the events. I really don't know what would be best in your case, but I suspect inputMessage() might be simpler. Victor On 8 May 2014, at 22:25, David Worrall wrote: > Pretty clear, thanks Victor. I've got it running much more smoothly > > And ReadScore() sorts the score - in real time. Is there a way of switching the sort off? > (with multiple BG process doing streamed data acquisition, I honing for speed…) > [I notice the manual mentions "extract" but not in the context of RT] > > or, to put it another way: > I have multiple threads producing ReadScore() events. If Readscore() sorts them, it is likely to do it faster than Python can, so perhaps I don't need to sort them b4 "dumping" them into RT CS perf. > Does that sound logical? > > D. > > On 08.05.2014, at 22:21, Victor Lazzarini |