python question re pysco...
Date | 2015-04-21 00:58 |
From | Forrest Curo |
Subject | python question re pysco... |
Attachments | None None |
In the score section, using: works just as it's supposed to.<CsScore bin="python"> from csd.pysco import PythonScoreBin ....................... --------------------------- pyruni {{ import random random.seed() from csd.pysco import PythonScoreBin }} ................ |
Date | 2015-04-21 02:45 |
From | Jacob Joaquin |
Subject | Re: python question re pysco... |
Attachments | None None |
Importing PythonScoreBin won't work, as that is made specifically for use with the score bin feature. Importing "PythonScore" should work, however, there aren't the methods necessary to get this to work well within pyruni. So it's probably useless at the moment. I think I'm going to have to give this a try myself, see what's involved, create a class specifically for us with pyruni, and write a brief tutorial on the subject. Give me a few days to get this in order. I'll start right now. On Mon, Apr 20, 2015 at 4:58 PM, Forrest Curo <treegestalt@gmail.com> wrote:
|
Date | 2015-04-21 04:41 |
From | Jacob Joaquin |
Subject | Re: python question re pysco... |
Attachments | None None |
I've looked into this and I'm not certain there's much potential with using PySco from within the orchestra. I can get it to load and generate scores, but I'm not sure there's a way to actually to evaluate the generated scores. Unless I'm missing something, the manual states these work with i and k-rate variables. On Mon, Apr 20, 2015 at 6:45 PM, Jacob Joaquin <jacobjoaquin@gmail.com> wrote:
|
Date | 2015-04-21 06:54 |
From | Forrest Curo |
Subject | Re: python question re pysco... |
Attachments | None None |
? -L DEVICE, --score-in=DEVICE Read line-oriented real-time score events from device DEVICE. The name stdin will permit score events to be typed at your terminal, or piped from another process. Each line-event is terminated by a carriage-return. Events are coded just like those in a standard numeric score, except that an event with p2=0 will be performed immediately, and an event with p2=T will be performed T seconds after arrival. Events can arrive at any time, and in any order. The score carry feature is legal here, as are held notes (p3 negative) and string arguments, but ramps and pp or np references are not. NoteThe -L flag is only valid on *NIX systems which have pipes. It doesn't work on Windows. On Mon, Apr 20, 2015 at 8:41 PM, Jacob Joaquin <jacobjoaquin@gmail.com> wrote:
|
Date | 2015-04-21 12:12 |
From | Michael Gogins |
Subject | Re: python question re pysco... |
Attachments | None None |
You can use the Lua opcodes to do score generation in the orchestra. Regards, On Apr 21, 2015 1:56 AM, "Forrest Curo" <treegestalt@gmail.com> wrote:
|
Date | 2015-04-21 15:22 |
From | Forrest Curo |
Subject | Re: python question re pysco... |
Attachments | None None |
Okay... All I need is another confusing language I could theoretically do anything whatsoever with, no one to know what it will be -- but I was writing pd extensions in it, and this ought to be easier. Probably there are advantages I'll discover if I try. (Thanks, actually!) But it's looking like I could do score generation anyplace in any program or language, send the results in text to csound via -L, and have the timing accurate, while playing the real-time midi stuff directly, no 'latency' issues with that either. (?) Whee, I think!On Tue, Apr 21, 2015 at 4:12 AM, Michael Gogins <michael.gogins@gmail.com> wrote:
|
Date | 2015-04-21 16:15 |
From | Michael Gogins |
Subject | Re: python question re pysco... |
Attachments | None None |
What operating system do you use for Csound? Also, what is it you are trying to do? What kind of music, score, algorithm? Live, not live? Interactive, non-interactive? Regards, |
Date | 2015-04-21 16:54 |
From | Forrest Curo |
Subject | Re: python question re pysco... |
Attachments | None None |
Using linux (Ubuntu) and wanting to construct something that will record note-patterns and echo them, modified, in real-time.So basically I still need to work out how to pick up timing, velocity and note number during some period of time -- set via some method like: 'black key, count 1 2 3 4... black key', after which I should be able to play with the result all sorts of ways! On Tue, Apr 21, 2015 at 8:15 AM, Michael Gogins <michael.gogins@gmail.com> wrote:
|
Date | 2015-04-21 17:29 |
From | Michael Gogins |
Subject | Re: python question re pysco... |
Attachments | None None |
Thanks. There are numerous ways to do this. Probably the best is to write your program to interact with the user in some language that you like, it doesn't matter which one that is very much. C++, Python, LuaJIT, Haskell, Java, all would work. Then have this program of yours communicate with Csound via the Csound API. You also could do this with JavaScript on Android or (soon) the desktop. esp. as this will probably have some sort of MIDI interface of its own. But for now, I wouldn't go this way, the technology stack is not yet mature or widely available. If you are a skilled programmer, do it in C++ using the Qt SDK. If you are not a skilled programmer, it sounds like you have been using Python, so stick with that. Find a MIDI interface module for Python and use that to interact with the user, then generate Csound score events from the MIDI events and send them to Csound via the API csoundReadScore. You could do a pretty fancy GUI in Python as well. Ask away. Hope this helps, Mike ----------------------------------------------------- Michael GoginsIrreducible Productions http://michaelgogins.tumblr.com Michael dot Gogins at gmail dot com On Tue, Apr 21, 2015 at 11:54 AM, Forrest Curo <treegestalt@gmail.com> wrote:
|
Date | 2015-04-22 00:51 |
From | Forrest Curo |
Subject | Re: python question re pysco... |
Attachments | None None |
I kind of liked Lua except I could never be quite sure I had it aimed in the right direction. I really hate having a variable turn into a frog when I'm not looking."Getting the moogladder Lua code to run took experimentation to work around idiosyncracies of LuaJIT's virtual machine. In particular, using Lua's normal for loop construct proved impossible – every run simply crashed. Fortunately, using the while construct to create for loops is easy, and works fine. There may be other problems with LuaJIT/FFI that different Lua code would expose..." On Tue, Apr 21, 2015 at 9:29 AM, Michael Gogins <michael.gogins@gmail.com> wrote:
|
Date | 2015-04-22 05:46 |
From | Forrest Curo |
Subject | Re: python question re pysco... |
Attachments | None None |
Jacob Joaquin -- re your comment that PythonScore wouldn't work all that well with pyrun within an orchestra -- Whatever latency might be involved in python receiving events ... wouldn't that be a constant delay that could be compensated for in setting start times for score events I intend to delay somewhat anyway?It should work to generate a csound score (or any number of same) in python running outside csound; mido would do to receive and time incoming midi notes... and new chunks of score could be sent via '-L' as fast as they were generated, well in advance of when I'd need them. |
Date | 2015-04-25 23:54 |
From | Forrest Curo |
Subject | Re: python question re pysco... |
Attachments | None None |
I think I do have what I want now... in the .csd file:fprints "ins1", "(%f, %f, %f, %f)\n",itim,iquot,imod,impy import time fifo=open("ins1", "r") while 1: line=fifo.readline() if line == '': time.sleep(.005) # wait 1/200th of a second else: The .csd receives and plays midi notes from channel 1, sends the time etc, out through the fifo 'ins1' to the python program, which can then send new note strings based on that timing back to csound via the fifo 'testfif'. No need to call any external binary inside the <CsScore> section! On Tue, Apr 21, 2015 at 9:46 PM, Forrest Curo <treegestalt@gmail.com> wrote:
|
Date | 2015-04-26 19:20 |
From | David Worrall |
Subject | Re: python question re pysco... |
Attachments | None None |
Hi Forrest, I have not been following your thread so forgive me if I am off-target. csound's fprints will write to a FIFO ( a named pipe ) if it exists. If it doesn't exist a fprints will create an 'ordinary' file. However (maybe depending on the OS) I think such a write is blocking, so it needs to be read before csound can proceed. You can create the pipe in python using subprocess.call(["mkfifo", "ins1"]) or perhaps you need to use subprocess.Popen() (see https://docs.python.org/2/library/subprocess.html) then subprocess.Popen().communicate() I'd use multiprocessing.Process() to manage the while 1 loop and, given that everything in the FIFO is already late, use readlines() not readline(). cheers, David On 26.04.2015, at 00:54, Forrest Curo <treegestalt@gmail.com> wrote:
______________________________________ 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 www: iis.fraunhofer.de --- Adjunct Senior Research Fellow School of Music, Australian National University |