Re: varga csound5 python opcodes
Date | 2005-10-13 14:59 |
From | Michael Gogins |
Subject | Re: varga csound5 python opcodes |
Same thread. Regards, Mike -----Original Message----- From: Oeyvind Brandtsegg |
Date | 2005-10-13 16:47 |
From | Dave Phillips |
Subject | CsoundVST problem |
Greetings: I've successfully built and installed Cs5 from CVS sources on AGNULA/Demudi 1.2.1. GCC is 3.3.5, all other required packages are up to date and correctly installed. The csound binary works fine, realtime appears to be working perfectly in my very brief tests, but CsoundVST won't start. It complains : CsoundVST: error while loading shared libraries: _CsoundVST.so: cannot open shared object file: Error 40 Any suggestions ? My PYTHONPATH includes /usr/local/lib, where the file resides. Best, dp |
Date | 2005-10-13 17:24 |
From | Oeyvind Brandtsegg |
Subject | Re: varga csound5 python opcodes |
Thanks. I'm wondering about the best place to put a clock for generating precise rhythms, when woring with Python and Csound in realtime. I started implementing the clock in python, as some of my algorithms in python will generate rhythm data. But then I realized that python does not seem to have rock solid timing (understatement), maybe it's better with the pygame timer but I certainly could not use Python's time module. Now, I've implemented a clock and rhythmic trigger in csound, calling python for data (data that e.g. determines the delta time until the next rhythm trigger should happen). Since csound maybe will wait for python to return the value, I wonder if this is a bad way to design a stable clock for rhythm generation. Also, if the python process is complicated (takes a long time to compute), will this create discontinuities in Csound's audio output ? If my current approach does not work well, the next thing I'd try is to just send a query (via OSC or otherwise) from the csound clock to a python function, asking for the next timing value. The return value would then be a "timestamp", hopefully returning to csound before it's activation time (or the event would have to be discarded). If anyone has ideas on how to implement a stable clock for realtime algorithmic composition, or views on my approach as described above, I'm most grateful for input on this. Oeyvind > From: Michael Gogins [gogins@pipeline.com] > > Same thread. > > > -----Original Message----- > From: Oeyvind Brandtsegg |
Date | 2005-10-13 23:29 |
From | Martin Peach |
Subject | Re: varga csound5 python opcodes |
Oeyvind Brandtsegg wrote: >Thanks. >I'm wondering about the best place to put a clock for generating precise rhythms, when woring with Python and Csound in realtime. > >I started implementing the clock in python, as some of my algorithms in python will generate rhythm data. But then I realized that python does not seem to have rock solid timing (understatement), maybe it's better with the pygame timer but I certainly could not use Python's time module. >Now, I've implemented a clock and rhythmic trigger in csound, calling python for data (data that e.g. determines the delta time until the next rhythm trigger should happen). >Since csound maybe will wait for python to return the value, I wonder if this is a bad way to design a stable clock for rhythm generation. Also, if the python process is complicated (takes a long time to compute), will this create discontinuities in Csound's audio output ? >If my current approach does not work well, the next thing I'd try is to just send a query (via OSC or otherwise) from the csound clock to a python function, asking for the next timing value. The return value would then be a "timestamp", hopefully returning to csound before it's activation time (or the event would have to be discarded). >If anyone has ideas on how to implement a stable clock for realtime algorithmic composition, or views on my approach as described above, I'm most grateful for input on this. > > Pure Data has both python and csound externals available. In pd you can build rock-steady timing objects that can trigger arbitrary events in csound or python. Martin |
Date | 2005-10-14 01:15 |
From | Iain Duncan |
Subject | Re: varga csound5 python opcodes |
I think that should be really easy if you use a python host with csound embedded as the audio engine. You could call csound in csoundperforming loop and just check for the clock value. If you look at the example I posted of the C api, you can see multi threads with one holding csound. I think it would be easy to add a check on a clock value there, and trigger whatever you need in other parts of the program to run accordingly. Iain Oeyvind Brandtsegg wrote: > Thanks. > I'm wondering about the best place to put a clock for generating precise rhythms, when woring with Python and Csound in realtime. > > I started implementing the clock in python, as some of my algorithms in python will generate rhythm data. But then I realized that python does not seem to have rock solid timing (understatement), maybe it's better with the pygame timer but I certainly could not use Python's time module. > Now, I've implemented a clock and rhythmic trigger in csound, calling python for data (data that e.g. determines the delta time until the next rhythm trigger should happen). > Since csound maybe will wait for python to return the value, I wonder if this is a bad way to design a stable clock for rhythm generation. Also, if the python process is complicated (takes a long time to compute), will this create discontinuities in Csound's audio output ? > If my current approach does not work well, the next thing I'd try is to just send a query (via OSC or otherwise) from the csound clock to a python function, asking for the next timing value. The return value would then be a "timestamp", hopefully returning to csound before it's activation time (or the event would have to be discarded). > If anyone has ideas on how to implement a stable clock for realtime algorithmic composition, or views on my approach as described above, I'm most grateful for input on this. > > Oeyvind > > > > > > >>From: Michael Gogins [gogins@pipeline.com] >> >>Same thread. >> >> >>-----Original Message----- >>From: Oeyvind Brandtsegg |
Date | 2005-10-14 15:57 |
From | Oeyvind Brandtsegg |
Subject | Re: timing, was: varga csound5 python opcodes |
I would be very grateful if you could elaborate a bit on this approach, as I don't quite get it. Please do forgive if my programming knowledge if full of holes... I am able to use python as a host for csound, with csound running in it's own thread, and multiple other threads running simultaneously in python. What worries me is that the python time module, and also the Timer subclass of Thread in python does not provide exact timing (stated in the python documentation). Do you suggest that I could poll csound's clock from python ? What happens if python is "busy doing something else" at the critical moment when the clock exceeds the specified time for an event to happen ? Since there are no thread priority (at least I can't find any) in python, I find it hard to ensure that the timing will be correct. I'm sure there must be a way to do it... Oeyvind > From: Iain Duncan [iainduncan@telus.net] > Sent: 2005-10-14 02:15:16 CEST > To: csound@lists.bath.ac.uk > Subject: Re: [Csnd] varga csound5 python opcodes > > I think that should be really easy if you use a python host with csound > embedded as the audio engine. You could call csound in csoundperforming > loop and just check for the clock value. If you look at the example I > posted of the C api, you can see multi threads with one holding csound. > I think it would be easy to add a check on a clock value there, and > trigger whatever you need in other parts of the program to run accordingly. > > Iain > > Oeyvind Brandtsegg wrote: > > Thanks. > > I'm wondering about the best place to put a clock for generating precise rhythms, when woring with Python and Csound in realtime. > > > > I started implementing the clock in python, as some of my algorithms in python will generate rhythm data. But then I realized that python does not seem to have rock solid timing (understatement), maybe it's better with the pygame timer but I certainly could not use Python's time module. > > Now, I've implemented a clock and rhythmic trigger in csound, calling python for data (data that e.g. determines the delta time until the next rhythm trigger should happen). > > Since csound maybe will wait for python to return the value, I wonder if this is a bad way to design a stable clock for rhythm generation. Also, if the python process is complicated (takes a long time to compute), will this create discontinuities in Csound's audio output ? > > If my current approach does not work well, the next thing I'd try is to just send a query (via OSC or otherwise) from the csound clock to a python function, asking for the next timing value. The return value would then be a "timestamp", hopefully returning to csound before it's activation time (or the event would have to be discarded). > > If anyone has ideas on how to implement a stable clock for realtime algorithmic composition, or views on my approach as described above, I'm most grateful for input on this. > > > > Oeyvind > > > > > > > > > > > > > >>From: Michael Gogins [gogins@pipeline.com] > >> > >>Same thread. > >> > >> > >>-----Original Message----- > >>From: Oeyvind Brandtsegg |
Date | 2005-10-14 18:48 |
From | jlato@mail.utexas.edu |
Subject | Re: timing, was: varga csound5 python opcodes |
Were you using time.clock() for your timing function? The python documentation claims the accuracy is typically within a microsecond (on Windows, or dependent on the C clock() function otherwise). Does your experience indicate this is incorrect? Unfortunately, I'm not extremely knowledgable about scheduling, so I can't clarify Iain's comments. John Lato Quoting Oeyvind Brandtsegg |
Date | 2005-10-14 19:36 |
From | Iain Duncan |
Subject | Re: timing, was: varga csound5 python opcodes |
Oeyvind Brandtsegg wrote: > I would be very grateful if you could elaborate a bit on this approach, as I don't quite get it. Please do forgive if my programming knowledge if full of holes... > I am able to use python as a host for csound, with csound running in it's own thread, and multiple other threads running simultaneously in python. What worries me is that the python time module, and also the Timer subclass of Thread in python does not provide exact timing (stated in the python documentation). Do you suggest that I could poll csound's clock from python ? What happens if python is "busy doing something else" at the critical moment when the clock exceeds the specified time for an event to happen ? Since there are no thread priority (at least I can't find any) in python, I find it hard to ensure that the timing will be correct. I'm sure there must be a way to do it... > Oeyvind I dunno for python, but for C I would do the following: Our timing doesn't have to be more accurate than krate, 'cause, well, it's the krate. Any krate controls are limited to that accuracy. So if in csound we generate a krate control clock, we can indicate a tick easily enough by writing a krate variable or writing to a table for one kpass, or spawning a note that holds a value for one kpass, etc. If in our host we a csound thread and then other threads doing other stuff we can use the loop in C: while ( cs_performing ) { cs_performing = csoundPerformKsmps( csound ); // do other api calls here, many api functions would do the job clock_tick = csoundTableGet( csound, clocktable, clockindx ); if ( clock_tick ) { // signal other threads somehow that we are on a clock tick // or do whatever needs to be done on a clock tick here } // do whatever else needs to be done with csound on a kpass here } If we *needed* higher than krate accuracy, the above could be redone with the arate audio processing api calls, but I haven't tackled those yet so I can't be much use in the way of examples. Hope that helps, Iain |
Date | 2005-10-17 11:15 |
From | Oeyvind Brandtsegg |
Subject | Re: timing, was: varga csound5 python opcodes |
I used time.sleep() at the time I tried it. When running multiple threads, time.sleep() allowed other threads to take over, but I realize this in not the best way to do it as time.sleep() could take longer than the specified time because of other scheduled activity in the system. Oeyvind > From: jlato@mail.utexas.edu > Sent: 2005-10-14 19:48:20 CEST > To: csound@lists.bath.ac.uk > Subject: Re: [Csnd] timing, was: varga csound5 python opcodes > > Were you using time.clock() for your timing function? The python documentation > claims the accuracy is typically within a microsecond (on Windows, or dependent > on the C clock() function otherwise). Does your experience indicate this is > incorrect? > > Unfortunately, I'm not extremely knowledgable about scheduling, so I can't > clarify Iain's comments. > John Lato > > Quoting Oeyvind Brandtsegg |