Csound Csound-dev Csound-tekno Search About

[Csnd] write real-time midi from Python

Date2009-12-15 18:29
From"Michael P. Mossey"
Subject[Csnd] write real-time midi from Python
Last year I experimented with writing real-time MIDI from Python code, 
under Windows. I lost that code! At the time, some people here gave me 
tips. I think I ended up using the cTypes module to work through the 
Windows media interface. The other option is Python's version of 
PortMidi, but I ran into some problem using that. Could I get some 
recommendations from someone who has worked with realtime MIDI from Python?

Thanks,
Mike


Send bugs reports to this list.
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"

Date2009-12-15 19:58
FromDavidW
Subject[Csnd] Re: write real-time midi from Python
On 16/12/2009, at 5:29 AM, Michael P. Mossey wrote:

> Last year I experimented with writing real-time MIDI from Python  
> code, under Windows. I lost that code! At the time, some people here  
> gave me tips. I think I ended up using the cTypes module to work  
> through the Windows media interface. The other option is Python's  
> version of PortMidi, but I ran into some problem using that. Could I  
> get some recommendations from someone who has worked with realtime  
> MIDI from Python?
>
> Thanks,
> Mike
Hi Mike,

For what it's worth, here's an overview of my python midi directory  
for SoniPy. Its an accumulation of stuff I've found and is about 6  
months old.
David

----------list ----------------
portmedia
contains code for midi, including midifile reading and writing.

midi-0.1.4
is a package from mxm called Python Midi Package: http://www.mxm.dk/products/public/pythonmidi/download

midi-0.2.1
Python MIDI.
This package is by Giles Hall. A sourceforge download: https://sourceforge.net/projects/pymidi/

PYMIDI
is by Pete Yandell.  Author's website svn
To get the sources use the svn command from the shell prompt, as  
follows:
$ svn checkout http://svn.notahat.com/pymidi/
Thus will create a PYMIDI directory and contents.

portmidizero
is from http://gitorious.org/portmidizero/
It is it a simple ctypes wrapper for PortMidi in pure python.
make portmidi with the xcode file, which creates the .dylib.

portmidi
has become portmedia and is available from sourceforge:
http://portmedia.sourceforge.net/

pyportmidi
is another python wrapper for it by John Harrison is available from
  http://cratel.wichita.edu/cratel/cratel_pyportmidi
installation notes etc available from http://cratel.wichita.edu/cratel/cratel_pyportmidi

pkaudio
contains rtmidi - a slick midi I/O toolbox based on an API and  
underlying OS tools.
Contains no MIDI file tools.





________________________________________________
Dr David Worrall.
- Experimental Polymedia:	  worrall.avatar.com.au
- Sonification: www.sonifiction.com.au
- Education for Financial Independence: www.mindthemarkets.com.au








Send bugs reports to this list.
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"

Date2010-01-23 22:46
FromChuckk Hubbard
Subject[Csnd] Re: write real-time midi from Python
Looking for the same thing. I just found out that the Python Csound
API doesn't send MIDI info. Was it always like that?
I've tried everything I can find, and keep finding either Python 2.5
requirements, code I can't compile, or "just don't work".
I'm hoping for cross-platform, Windows, Mac and Linux. I'd love to
know if you come up with something that works!

-Chuckk

On Tue, Dec 15, 2009 at 8:29 PM, Michael P. Mossey
 wrote:
> Last year I experimented with writing real-time MIDI from Python code, under
> Windows. I lost that code! At the time, some people here gave me tips. I
> think I ended up using the cTypes module to work through the Windows media
> interface. The other option is Python's version of PortMidi, but I ran into
> some problem using that. Could I get some recommendations from someone who
> has worked with realtime MIDI from Python?
>
> Thanks,
> Mike
>
>
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
> csound"
>


Date2010-01-24 16:26
FromRory Walsh
Subject[Csnd] Re: Re: write real-time midi from Python
Can you not just get your instance of Csound to send the midi info
using the -q flag and the midi out opcodes? No need for midi libraries
at all then and it's more platform friendly too.

2010/1/23 Chuckk Hubbard :
> Looking for the same thing. I just found out that the Python Csound
> API doesn't send MIDI info. Was it always like that?
> I've tried everything I can find, and keep finding either Python 2.5
> requirements, code I can't compile, or "just don't work".
> I'm hoping for cross-platform, Windows, Mac and Linux. I'd love to
> know if you come up with something that works!
>
> -Chuckk
>
> On Tue, Dec 15, 2009 at 8:29 PM, Michael P. Mossey
>  wrote:
>> Last year I experimented with writing real-time MIDI from Python code, under
>> Windows. I lost that code! At the time, some people here gave me tips. I
>> think I ended up using the cTypes module to work through the Windows media
>> interface. The other option is Python's version of PortMidi, but I ran into
>> some problem using that. Could I get some recommendations from someone who
>> has worked with realtime MIDI from Python?
>>
>> Thanks,
>> Mike
>>
>>
>> Send bugs reports to this list.
>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
>> csound"
>>
>
>
>
> --
> http://www.badmuthahubbard.com
>
>
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>


Send bugs reports to this list.
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"

Date2010-01-24 16:43
FromChuckk Hubbard
Subject[Csnd] Re: Re: Re: write real-time midi from Python
>From the Python API on Windows, no. The same csd will send the
messages running Csound from the command line, but not from within
Python. Maybe there's something wrong with my setup, that would be...
great!
Have you done it before?

-Chuckk

On Sun, Jan 24, 2010 at 6:26 PM, Rory Walsh  wrote:
> Can you not just get your instance of Csound to send the midi info
> using the -q flag and the midi out opcodes? No need for midi libraries
> at all then and it's more platform friendly too.
>
> 2010/1/23 Chuckk Hubbard :
>> Looking for the same thing. I just found out that the Python Csound
>> API doesn't send MIDI info. Was it always like that?
>> I've tried everything I can find, and keep finding either Python 2.5
>> requirements, code I can't compile, or "just don't work".
>> I'm hoping for cross-platform, Windows, Mac and Linux. I'd love to
>> know if you come up with something that works!
>>
>> -Chuckk
>>
>> On Tue, Dec 15, 2009 at 8:29 PM, Michael P. Mossey
>>  wrote:
>>> Last year I experimented with writing real-time MIDI from Python code, under
>>> Windows. I lost that code! At the time, some people here gave me tips. I
>>> think I ended up using the cTypes module to work through the Windows media
>>> interface. The other option is Python's version of PortMidi, but I ran into
>>> some problem using that. Could I get some recommendations from someone who
>>> has worked with realtime MIDI from Python?
>>>
>>> Thanks,
>>> Mike
>>>
>>>
>>> Send bugs reports to this list.
>>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
>>> csound"
>>>
>>
>>
>>
>> --
>> http://www.badmuthahubbard.com
>>
>>
>> Send bugs reports to this list.
>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>>
>
>
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>


Date2010-01-24 19:45
FromOeyvind Brandtsegg
Subject[Csnd] Re: Re: Re: Re: write real-time midi from Python
Hm, just tested it here, with noteondur in an instrument it sends midi
both when run as Csound on the commandline and when Csound runs as a
module in Python. Check if you have enabled midi out (-Q) on the
command line in Python too (?)

Oeyvind

2010/1/24 Chuckk Hubbard :
> From the Python API on Windows, no. The same csd will send the
> messages running Csound from the command line, but not from within
> Python. Maybe there's something wrong with my setup, that would be...
> great!
> Have you done it before?
>
> -Chuckk
>
> On Sun, Jan 24, 2010 at 6:26 PM, Rory Walsh  wrote:
>> Can you not just get your instance of Csound to send the midi info
>> using the -q flag and the midi out opcodes? No need for midi libraries
>> at all then and it's more platform friendly too.
>>
>> 2010/1/23 Chuckk Hubbard :
>>> Looking for the same thing. I just found out that the Python Csound
>>> API doesn't send MIDI info. Was it always like that?
>>> I've tried everything I can find, and keep finding either Python 2.5
>>> requirements, code I can't compile, or "just don't work".
>>> I'm hoping for cross-platform, Windows, Mac and Linux. I'd love to
>>> know if you come up with something that works!
>>>
>>> -Chuckk
>>>
>>> On Tue, Dec 15, 2009 at 8:29 PM, Michael P. Mossey
>>>  wrote:
>>>> Last year I experimented with writing real-time MIDI from Python code, under
>>>> Windows. I lost that code! At the time, some people here gave me tips. I
>>>> think I ended up using the cTypes module to work through the Windows media
>>>> interface. The other option is Python's version of PortMidi, but I ran into
>>>> some problem using that. Could I get some recommendations from someone who
>>>> has worked with realtime MIDI from Python?
>>>>
>>>> Thanks,
>>>> Mike
>>>>
>>>>
>>>> Send bugs reports to this list.
>>>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
>>>> csound"
>>>>
>>>
>>>
>>>
>>> --
>>> http://www.badmuthahubbard.com
>>>
>>>
>>> Send bugs reports to this list.
>>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>>>
>>
>>
>> Send bugs reports to this list.
>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>>
>
>
>
> --
> http://www.badmuthahubbard.com
>
>
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>


Send bugs reports to this list.
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"

Date2010-01-24 22:32
FromChuckk Hubbard
Subject[Csnd] Re: Re: Re: Re: Re: write real-time midi from Python
This Python/Csound file does not send any MIDI messages on my WinXP,
Python 2.6, Csound 5.11. The exact same CSD run from the command line
does.
Can I ask what OS you tested on?

Thanks for the check.
-Chuckk

On Sun, Jan 24, 2010 at 9:45 PM, Oeyvind Brandtsegg  wrote:
> Hm, just tested it here, with noteondur in an instrument it sends midi
> both when run as Csound on the commandline and when Csound runs as a
> module in Python. Check if you have enabled midi out (-Q) on the
> command line in Python too (?)
>
> Oeyvind
>
> 2010/1/24 Chuckk Hubbard :
>> From the Python API on Windows, no. The same csd will send the
>> messages running Csound from the command line, but not from within
>> Python. Maybe there's something wrong with my setup, that would be...
>> great!
>> Have you done it before?
>>
>> -Chuckk
>>
>> On Sun, Jan 24, 2010 at 6:26 PM, Rory Walsh  wrote:
>>> Can you not just get your instance of Csound to send the midi info
>>> using the -q flag and the midi out opcodes? No need for midi libraries
>>> at all then and it's more platform friendly too.
>>>
>>> 2010/1/23 Chuckk Hubbard :
>>>> Looking for the same thing. I just found out that the Python Csound
>>>> API doesn't send MIDI info. Was it always like that?
>>>> I've tried everything I can find, and keep finding either Python 2.5
>>>> requirements, code I can't compile, or "just don't work".
>>>> I'm hoping for cross-platform, Windows, Mac and Linux. I'd love to
>>>> know if you come up with something that works!
>>>>
>>>> -Chuckk
>>>>
>>>> On Tue, Dec 15, 2009 at 8:29 PM, Michael P. Mossey
>>>>  wrote:
>>>>> Last year I experimented with writing real-time MIDI from Python code, under
>>>>> Windows. I lost that code! At the time, some people here gave me tips. I
>>>>> think I ended up using the cTypes module to work through the Windows media
>>>>> interface. The other option is Python's version of PortMidi, but I ran into
>>>>> some problem using that. Could I get some recommendations from someone who
>>>>> has worked with realtime MIDI from Python?
>>>>>
>>>>> Thanks,
>>>>> Mike
>>>>>
>>>>>
>>>>> Send bugs reports to this list.
>>>>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
>>>>> csound"
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> http://www.badmuthahubbard.com
>>>>
>>>>
>>>> Send bugs reports to this list.
>>>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>>>>
>>>
>>>
>>> Send bugs reports to this list.
>>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>>>
>>
>>
>>
>> --
>> http://www.badmuthahubbard.com
>>
>>
>> Send bugs reports to this list.
>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>>
>
>
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>


Date2010-01-24 22:34
FromRory Walsh
Subject[Csnd] Re: Re: Re: Re: Re: write real-time midi from Python
I've not done it before but I had a feeling that someone might have,
Oeyvind in particular!

2010/1/24 Oeyvind Brandtsegg :
> Hm, just tested it here, with noteondur in an instrument it sends midi
> both when run as Csound on the commandline and when Csound runs as a
> module in Python. Check if you have enabled midi out (-Q) on the


Send bugs reports to this list.
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"

Date2010-01-25 09:34
FromOeyvind Brandtsegg
Subject[Csnd] Re: Re: Re: Re: Re: Re: write real-time midi from Python
Aha, but you did not actually allow Csound to run inside Python.
You need to call the performance thread, and also wait (sleep or
something) until it's done.
Adding this to the end of your python script makes it run

performanceThread = csnd.CsoundPerformanceThread(cs)
performanceThread.Play()
import time
time.sleep(4)
performanceThread.Stop()
performanceThread.Join()

best
Oeyvind


2010/1/24 Chuckk Hubbard :
> This Python/Csound file does not send any MIDI messages on my WinXP,
> Python 2.6, Csound 5.11. The exact same CSD run from the command line
> does.
> Can I ask what OS you tested on?
>
> Thanks for the check.
> -Chuckk
>
> On Sun, Jan 24, 2010 at 9:45 PM, Oeyvind Brandtsegg  wrote:
>> Hm, just tested it here, with noteondur in an instrument it sends midi
>> both when run as Csound on the commandline and when Csound runs as a
>> module in Python. Check if you have enabled midi out (-Q) on the
>> command line in Python too (?)
>>
>> Oeyvind
>>
>> 2010/1/24 Chuckk Hubbard :
>>> From the Python API on Windows, no. The same csd will send the
>>> messages running Csound from the command line, but not from within
>>> Python. Maybe there's something wrong with my setup, that would be...
>>> great!
>>> Have you done it before?
>>>
>>> -Chuckk
>>>
>>> On Sun, Jan 24, 2010 at 6:26 PM, Rory Walsh  wrote:
>>>> Can you not just get your instance of Csound to send the midi info
>>>> using the -q flag and the midi out opcodes? No need for midi libraries
>>>> at all then and it's more platform friendly too.
>>>>
>>>> 2010/1/23 Chuckk Hubbard :
>>>>> Looking for the same thing. I just found out that the Python Csound
>>>>> API doesn't send MIDI info. Was it always like that?
>>>>> I've tried everything I can find, and keep finding either Python 2.5
>>>>> requirements, code I can't compile, or "just don't work".
>>>>> I'm hoping for cross-platform, Windows, Mac and Linux. I'd love to
>>>>> know if you come up with something that works!
>>>>>
>>>>> -Chuckk
>>>>>
>>>>> On Tue, Dec 15, 2009 at 8:29 PM, Michael P. Mossey
>>>>>  wrote:
>>>>>> Last year I experimented with writing real-time MIDI from Python code, under
>>>>>> Windows. I lost that code! At the time, some people here gave me tips. I
>>>>>> think I ended up using the cTypes module to work through the Windows media
>>>>>> interface. The other option is Python's version of PortMidi, but I ran into
>>>>>> some problem using that. Could I get some recommendations from someone who
>>>>>> has worked with realtime MIDI from Python?
>>>>>>
>>>>>> Thanks,
>>>>>> Mike
>>>>>>
>>>>>>
>>>>>> Send bugs reports to this list.
>>>>>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
>>>>>> csound"
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> http://www.badmuthahubbard.com
>>>>>
>>>>>
>>>>> Send bugs reports to this list.
>>>>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>>>>>
>>>>
>>>>
>>>> Send bugs reports to this list.
>>>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>>>>
>>>
>>>
>>>
>>> --
>>> http://www.badmuthahubbard.com
>>>
>>>
>>> Send bugs reports to this list.
>>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>>>
>>
>>
>> Send bugs reports to this list.
>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>>
>
>
>
> --
> http://www.badmuthahubbard.com
>
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"


Send bugs reports to this list.
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"

Date2010-01-25 14:11
FromChuckk Hubbard
Subject[Csnd] Re: Re: Re: Re: Re: Re: Re: write real-time midi from Python
Great! Thanks again, Oeyvind. I had adapted that from a script I used
to use to list audio devices, and in that case I only needed to
compile. As of now, Python quits instead on running that script, so I
was working on it when I decided to try MIDI.
Some microtonal musicians will be very happy.
-Chuckk

On Mon, Jan 25, 2010 at 11:34 AM, Oeyvind Brandtsegg  wrote:
> Aha, but you did not actually allow Csound to run inside Python.
> You need to call the performance thread, and also wait (sleep or
> something) until it's done.
> Adding this to the end of your python script makes it run
>
> performanceThread = csnd.CsoundPerformanceThread(cs)
> performanceThread.Play()
> import time
> time.sleep(4)
> performanceThread.Stop()
> performanceThread.Join()
>
> best
> Oeyvind
>
>
> 2010/1/24 Chuckk Hubbard :
>> This Python/Csound file does not send any MIDI messages on my WinXP,
>> Python 2.6, Csound 5.11. The exact same CSD run from the command line
>> does.
>> Can I ask what OS you tested on?
>>
>> Thanks for the check.
>> -Chuckk
>>
>> On Sun, Jan 24, 2010 at 9:45 PM, Oeyvind Brandtsegg  wrote:
>>> Hm, just tested it here, with noteondur in an instrument it sends midi
>>> both when run as Csound on the commandline and when Csound runs as a
>>> module in Python. Check if you have enabled midi out (-Q) on the
>>> command line in Python too (?)
>>>
>>> Oeyvind
>>>
>>> 2010/1/24 Chuckk Hubbard :
>>>> From the Python API on Windows, no. The same csd will send the
>>>> messages running Csound from the command line, but not from within
>>>> Python. Maybe there's something wrong with my setup, that would be...
>>>> great!
>>>> Have you done it before?
>>>>
>>>> -Chuckk
>>>>
>>>> On Sun, Jan 24, 2010 at 6:26 PM, Rory Walsh  wrote:
>>>>> Can you not just get your instance of Csound to send the midi info
>>>>> using the -q flag and the midi out opcodes? No need for midi libraries
>>>>> at all then and it's more platform friendly too.
>>>>>
>>>>> 2010/1/23 Chuckk Hubbard :
>>>>>> Looking for the same thing. I just found out that the Python Csound
>>>>>> API doesn't send MIDI info. Was it always like that?
>>>>>> I've tried everything I can find, and keep finding either Python 2.5
>>>>>> requirements, code I can't compile, or "just don't work".
>>>>>> I'm hoping for cross-platform, Windows, Mac and Linux. I'd love to
>>>>>> know if you come up with something that works!
>>>>>>
>>>>>> -Chuckk
>>>>>>
>>>>>> On Tue, Dec 15, 2009 at 8:29 PM, Michael P. Mossey
>>>>>>  wrote:
>>>>>>> Last year I experimented with writing real-time MIDI from Python code, under
>>>>>>> Windows. I lost that code! At the time, some people here gave me tips. I
>>>>>>> think I ended up using the cTypes module to work through the Windows media
>>>>>>> interface. The other option is Python's version of PortMidi, but I ran into
>>>>>>> some problem using that. Could I get some recommendations from someone who
>>>>>>> has worked with realtime MIDI from Python?
>>>>>>>
>>>>>>> Thanks,
>>>>>>> Mike
>>>>>>>
>>>>>>>
>>>>>>> Send bugs reports to this list.
>>>>>>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
>>>>>>> csound"
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> http://www.badmuthahubbard.com
>>>>>>
>>>>>>
>>>>>> Send bugs reports to this list.
>>>>>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>>>>>>
>>>>>
>>>>>
>>>>> Send bugs reports to this list.
>>>>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> http://www.badmuthahubbard.com
>>>>
>>>>
>>>> Send bugs reports to this list.
>>>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>>>>
>>>
>>>
>>> Send bugs reports to this list.
>>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>>>
>>
>>
>>
>> --
>> http://www.badmuthahubbard.com
>>
>> Send bugs reports to this list.
>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>
>
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>


Date2010-01-25 14:25
FromChuckk Hubbard
Subject[Csnd] Re: Re: Re: Re: Re: Re: Re: write real-time midi from Python
Hi again,
One other question. In microtonal music, I'll need a separate channel
for each note, so I'm hoping to use separate instances of Csound to
send messages on different devices, to increase the number of
channels. I just did a quick test, and it works, but the timing seemed
to get a little mixed up. Have you done this, using multiple instances
of Csound from the same Python? For MIDI?

-Chuckk

On Mon, Jan 25, 2010 at 11:34 AM, Oeyvind Brandtsegg  wrote:
> Aha, but you did not actually allow Csound to run inside Python.
> You need to call the performance thread, and also wait (sleep or
> something) until it's done.
> Adding this to the end of your python script makes it run
>
> performanceThread = csnd.CsoundPerformanceThread(cs)
> performanceThread.Play()
> import time
> time.sleep(4)
> performanceThread.Stop()
> performanceThread.Join()
>
> best
> Oeyvind
>
>
> 2010/1/24 Chuckk Hubbard :
>> This Python/Csound file does not send any MIDI messages on my WinXP,
>> Python 2.6, Csound 5.11. The exact same CSD run from the command line
>> does.
>> Can I ask what OS you tested on?
>>
>> Thanks for the check.
>> -Chuckk
>>
>> On Sun, Jan 24, 2010 at 9:45 PM, Oeyvind Brandtsegg  wrote:
>>> Hm, just tested it here, with noteondur in an instrument it sends midi
>>> both when run as Csound on the commandline and when Csound runs as a
>>> module in Python. Check if you have enabled midi out (-Q) on the
>>> command line in Python too (?)
>>>
>>> Oeyvind
>>>
>>> 2010/1/24 Chuckk Hubbard :
>>>> From the Python API on Windows, no. The same csd will send the
>>>> messages running Csound from the command line, but not from within
>>>> Python. Maybe there's something wrong with my setup, that would be...
>>>> great!
>>>> Have you done it before?
>>>>
>>>> -Chuckk
>>>>
>>>> On Sun, Jan 24, 2010 at 6:26 PM, Rory Walsh  wrote:
>>>>> Can you not just get your instance of Csound to send the midi info
>>>>> using the -q flag and the midi out opcodes? No need for midi libraries
>>>>> at all then and it's more platform friendly too.
>>>>>
>>>>> 2010/1/23 Chuckk Hubbard :
>>>>>> Looking for the same thing. I just found out that the Python Csound
>>>>>> API doesn't send MIDI info. Was it always like that?
>>>>>> I've tried everything I can find, and keep finding either Python 2.5
>>>>>> requirements, code I can't compile, or "just don't work".
>>>>>> I'm hoping for cross-platform, Windows, Mac and Linux. I'd love to
>>>>>> know if you come up with something that works!
>>>>>>
>>>>>> -Chuckk
>>>>>>
>>>>>> On Tue, Dec 15, 2009 at 8:29 PM, Michael P. Mossey
>>>>>>  wrote:
>>>>>>> Last year I experimented with writing real-time MIDI from Python code, under
>>>>>>> Windows. I lost that code! At the time, some people here gave me tips. I
>>>>>>> think I ended up using the cTypes module to work through the Windows media
>>>>>>> interface. The other option is Python's version of PortMidi, but I ran into
>>>>>>> some problem using that. Could I get some recommendations from someone who
>>>>>>> has worked with realtime MIDI from Python?
>>>>>>>
>>>>>>> Thanks,
>>>>>>> Mike
>>>>>>>
>>>>>>>
>>>>>>> Send bugs reports to this list.
>>>>>>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
>>>>>>> csound"
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> http://www.badmuthahubbard.com
>>>>>>
>>>>>>
>>>>>> Send bugs reports to this list.
>>>>>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>>>>>>
>>>>>
>>>>>
>>>>> Send bugs reports to this list.
>>>>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> http://www.badmuthahubbard.com
>>>>
>>>>
>>>> Send bugs reports to this list.
>>>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>>>>
>>>
>>>
>>> Send bugs reports to this list.
>>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>>>
>>
>>
>>
>> --
>> http://www.badmuthahubbard.com
>>
>> Send bugs reports to this list.
>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>
>
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
>


Date2010-01-25 14:28
FromRory Walsh
Subject[Csnd] Re: Re: Re: Re: Re: Re: Re: Re: write real-time midi from Python
I don't know if this is what might be causing your problem but I just
came across it yesterday:

"Unfortunately the real-time timing implemented in Csound is
completely managed by DAC buffer sample flow. So MIDI OUT operations
can present some time irregularities. These irregularities can be
reduced by using a lower value for the -b flag."

Rory.



2010/1/25 Chuckk Hubbard :
> Hi again,
> One other question. In microtonal music, I'll need a separate channel
> for each note, so I'm hoping to use separate instances of Csound to
> send messages on different devices, to increase the number of
> channels. I just did a quick test, and it works, but the timing seemed
> to get a little mixed up. Have you done this, using multiple instances
> of Csound from the same Python? For MIDI?
>
> -Ch


Send bugs reports to this list.
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"

Date2010-05-11 18:03
Fromapalomba
Subject[Csnd] Re: Re: Re: Re: Re: Re: Re: Re: write real-time midi from Python
I am wanting to use the csound python API to send real-time MIDI.
I found this thread and wanted to get an update on the current 
status of things...

So from I can tell it looks like this is possible. I took a look at the
python
script that Chuck posted. Is there an updated version of this script?

It looks like he is creating an instrument and then using that instrument 
to send MIDI events. Is there a way I can do that with calls to the 
csound python API with out having to go through a csd instrument?



Anthony





RoryWalsh wrote:
> 
> I don't know if this is what might be causing your problem but I just
> came across it yesterday:
> 
> "Unfortunately the real-time timing implemented in Csound is
> completely managed by DAC buffer sample flow. So MIDI OUT operations
> can present some time irregularities. These irregularities can be
> reduced by using a lower value for the -b flag."
> 
> Rory.
> 
> 
> 

Date2010-05-11 18:15
FromVictor Lazzarini
Subject[Csnd] Re: Re: Re: Re: Re: Re: Re: Re: Re: write real-time midi from Python
If you just need MIDI, why don't you try using the PortMidi bindings?
http://alumni.media.mit.edu/~harrison/code.html

Victor

On 11 May 2010, at 18:03, apalomba wrote:

>
> I am wanting to use the csound python API to send real-time MIDI.
> I found this thread and wanted to get an update on the current
> status of things...
>
> So from I can tell it looks like this is possible. I took a look at  
> the
> python
> script that Chuck posted. Is there an updated version of this script?
>
> It looks like he is creating an instrument and then using that  
> instrument
> to send MIDI events. Is there a way I can do that with calls to the
> csound python API with out having to go through a csd instrument?
>
>
>
> Anthony
>
>
>
>
>
> RoryWalsh wrote:
>>
>> I don't know if this is what might be causing your problem but I just
>> came across it yesterday:
>>
>> "Unfortunately the real-time timing implemented in Csound is
>> completely managed by DAC buffer sample flow. So MIDI OUT operations
>> can present some time irregularities. These irregularities can be
>> reduced by using a lower value for the -b flag."
>>
>> Rory.
>>
>>
>>
>
> -- 
> View this message in context: http://old.nabble.com/write-real-time-midi-from-Python-tp26799445p28526793.html
> Sent from the Csound - General mailing list archive at Nabble.com.
>
>
>
> Send bugs reports to the Sourceforge bug tracker
>            https://sourceforge.net/tracker/?group_id=81968&atid=564599
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body  
> "unsubscribe csound"
>



Send bugs reports to the Sourceforge bug tracker
            https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"

Date2010-05-11 20:28
FromAnthony Palomba
Subject[Csnd] Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: write real-time midi from Python
Well I don't necessarily need to have it in a csound environment, but I
also need some timing ability. Basically I want to create a procedurally modeled
process that creates MIDI notes that play in real time at a specified tempo.

Would PortMid allow me to do this?



-ap




On Tue, May 11, 2010 at 12:15 PM, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote:
If you just need MIDI, why don't you try using the PortMidi bindings?
http://alumni.media.mit.edu/~harrison/code.html

Victor


On 11 May 2010, at 18:03, apalomba wrote:


I am wanting to use the csound python API to send real-time MIDI.
I found this thread and wanted to get an update on the current
status of things...

So from I can tell it looks like this is possible. I took a look at the
python
script that Chuck posted. Is there an updated version of this script?

It looks like he is creating an instrument and then using that instrument
to send MIDI events. Is there a way I can do that with calls to the
csound python API with out having to go through a csd instrument?



Anthony





RoryWalsh wrote:

I don't know if this is what might be causing your problem but I just
came across it yesterday:

"Unfortunately the real-time timing implemented in Csound is
completely managed by DAC buffer sample flow. So MIDI OUT operations
can present some time irregularities. These irregularities can be
reduced by using a lower value for the -b flag."

Rory.




--
View this message in context: http://old.nabble.com/write-real-time-midi-from-Python-tp26799445p28526793.html
Sent from the Csound - General mailing list archive at Nabble.com.



Send bugs reports to the Sourceforge bug tracker
          https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"




Send bugs reports to the Sourceforge bug tracker
          https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"



Date2010-05-11 20:33
FromVictor Lazzarini
Subject[Csnd] Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: write real-time midi from Python
PortMIdi has timing facilities (porttime)

Victor
On 11 May 2010, at 20:28, Anthony Palomba wrote:

Well I don't necessarily need to have it in a csound environment, but I
also need some timing ability. Basically I want to create a procedurally modeled
process that creates MIDI notes that play in real time at a specified tempo.

Would PortMid allow me to do this?



-ap




On Tue, May 11, 2010 at 12:15 PM, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote:
If you just need MIDI, why don't you try using the PortMidi bindings?
http://alumni.media.mit.edu/~harrison/code.html

Victor


On 11 May 2010, at 18:03, apalomba wrote:


I am wanting to use the csound python API to send real-time MIDI.
I found this thread and wanted to get an update on the current
status of things...

So from I can tell it looks like this is possible. I took a look at the
python
script that Chuck posted. Is there an updated version of this script?

It looks like he is creating an instrument and then using that instrument
to send MIDI events. Is there a way I can do that with calls to the
csound python API with out having to go through a csd instrument?



Anthony





RoryWalsh wrote:

I don't know if this is what might be causing your problem but I just
came across it yesterday:

"Unfortunately the real-time timing implemented in Csound is
completely managed by DAC buffer sample flow. So MIDI OUT operations
can present some time irregularities. These irregularities can be
reduced by using a lower value for the -b flag."

Rory.




--
View this message in context: http://old.nabble.com/write-real-time-midi-from-Python-tp26799445p28526793.html
Sent from the Csound - General mailing list archive at Nabble.com.



Send bugs reports to the Sourceforge bug tracker
          https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"




Send bugs reports to the Sourceforge bug tracker
          https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"




Date2010-05-11 20:53
FromDavidW
Subject[Csnd] Re: Re: Re: Re: Re: Re: Re: Re: Re: write real-time midi from Python
what platform?
On 12/05/2010, at 3:03 AM, apalomba wrote:

>
> I am wanting to use the csound python API to send real-time MIDI.
> I found this thread and wanted to get an update on the current
> status of things...


...
________________________________________________
Dr David Worrall.
- Experimental Polymedia:	  worrall.avatar.com.au
- Sonification: www.sonifiction.com.au
- Education for Financial Independence: www.mindthemarkets.com.au








Send bugs reports to the Sourceforge bug tracker
            https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"

Date2010-05-11 21:16
FromAnthony Palomba
Subject[Csnd] Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: write real-time midi from Python
Just to explain things a bit better, I am trying to find the best python platform
to build a music language prototyping environment. These procedurally modeled
musical gestures/grammars will need to be controlled my some timing mechanism.

Csound/python could be an option, but I am not sure how it keeps track of time.
PortMidi might work too, again not sure what support it has for timing.

I could also write something from scratch that would use a python thread timer
but this would most likely not be as accurate as an audio based timer. Not to
mention would most likely be a lot of work!

A csound environment is ultimately more preferable, as in the future, csound and
python will be more and more integrated.


What you you guys think? Any advice would be appreciated.




-ap




On Tue, May 11, 2010 at 2:28 PM, Anthony Palomba <apalomba@austin.rr.com> wrote:
Well I don't necessarily need to have it in a csound environment, but I
also need some timing ability. Basically I want to create a procedurally modeled
process that creates MIDI notes that play in real time at a specified tempo.

Would PortMid allow me to do this?



-ap





On Tue, May 11, 2010 at 12:15 PM, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote:
If you just need MIDI, why don't you try using the PortMidi bindings?
http://alumni.media.mit.edu/~harrison/code.html

Victor


On 11 May 2010, at 18:03, apalomba wrote:


I am wanting to use the csound python API to send real-time MIDI.
I found this thread and wanted to get an update on the current
status of things...

So from I can tell it looks like this is possible. I took a look at the
python
script that Chuck posted. Is there an updated version of this script?

It looks like he is creating an instrument and then using that instrument
to send MIDI events. Is there a way I can do that with calls to the
csound python API with out having to go through a csd instrument?



Anthony





RoryWalsh wrote:

I don't know if this is what might be causing your problem but I just
came across it yesterday:

"Unfortunately the real-time timing implemented in Csound is
completely managed by DAC buffer sample flow. So MIDI OUT operations
can present some time irregularities. These irregularities can be
reduced by using a lower value for the -b flag."

Rory.




--
View this message in context: http://old.nabble.com/write-real-time-midi-from-Python-tp26799445p28526793.html
Sent from the Csound - General mailing list archive at Nabble.com.



Send bugs reports to the Sourceforge bug tracker
          https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"




Send bugs reports to the Sourceforge bug tracker
          https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"




Date2010-05-11 21:19
FromStéphane Rollandin
Subject[Csnd] Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: write real-time midi from Python
> Well I don't necessarily need to have it in a csound environment, but I
> also need some timing ability. Basically I want to create a procedurally
> modeled
> process that creates MIDI notes that play in real time at a specified tempo.
>

I would recommend Keykit:
http://nosuch.com/keykit/

Stef




Send bugs reports to the Sourceforge bug tracker
            https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"

Date2010-05-11 21:23
FromAnthony Palomba
Subject[Csnd] Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: write real-time midi from Python
Platform is Windows.


-ap

On Tue, May 11, 2010 at 2:53 PM, DavidW <vip@avatar.com.au> wrote:
what platform?

On 12/05/2010, at 3:03 AM, apalomba wrote:


I am wanting to use the csound python API to send real-time MIDI.
I found this thread and wanted to get an update on the current
status of things...


...
________________________________________________
Dr David Worrall.
- Experimental Polymedia:         worrall.avatar.com.au
- Sonification: www.sonifiction.com.au
- Education for Financial Independence: www.mindthemarkets.com.au









Send bugs reports to the Sourceforge bug tracker
          https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"



Date2010-05-11 21:27
FromAnthony Palomba
Subject[Csnd] Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: write real-time midi from Python
Is this a python environment?

Ideally I want this in a python environment so that I can
run it with Csound, Max, Ableton Live, Blender, Processing, etc.




-ap



2010/5/11 Stéphane Rollandin <lecteur@zogotounga.net>
Well I don't necessarily need to have it in a csound environment, but I
also need some timing ability. Basically I want to create a procedurally
modeled
process that creates MIDI notes that play in real time at a specified tempo.


I would recommend Keykit:
http://nosuch.com/keykit/

Stef





Send bugs reports to the Sourceforge bug tracker
          https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"



Date2010-05-11 21:37
FromDavidW
Subject[Csnd] Re: write real-time midi from Python
Have you looked at Victor's PySndObj?

On 12/05/2010, at 6:23 AM, Anthony Palomba wrote:

Platform is Windows.


-ap

On Tue, May 11, 2010 at 2:53 PM, DavidW <vip@avatar.com.au> wrote:
what platform?

On 12/05/2010, at 3:03 AM, apalomba wrote:


I am wanting to use the csound python API to send real-time MIDI.
I found this thread and wanted to get an update on the current
status of things...


...
________________________________________________
Dr David Worrall.
- Experimental Polymedia:   worrall.avatar.com.au
- Sonification: www.sonifiction.com.au
- Education for Financial Independence: www.mindthemarkets.com.au







Date2010-05-11 21:38
FromVictor Lazzarini
Subject[Csnd] Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: write real-time midi from Python
Attachmentstonnetz.py  
I think PortMidi will do what you want. It has some timing functions which will give you a millisecond resolution.
I have used it on Windows and it works OK.
I am attaching a simple example that uses it.

Victor


Date2010-05-11 21:51
FromVictor Lazzarini
Subject[Csnd] Re: Re: write real-time midi from Python
yes, he asked me, but it's not really MIDI-centric and I guess for what he wants to use now, just a MIDI library should do. Bur eventually, I guess Csound might also be a choice.

Victor
On 11 May 2010, at 21:37, DavidW wrote:

Have you looked at Victor's PySndObj?

On 12/05/2010, at 6:23 AM, Anthony Palomba wrote:

Platform is Windows.


-ap

On Tue, May 11, 2010 at 2:53 PM, DavidW <vip@avatar.com.au> wrote:
what platform?

On 12/05/2010, at 3:03 AM, apalomba wrote:


I am wanting to use the csound python API to send real-time MIDI.
I found this thread and wanted to get an update on the current
status of things...


...
________________________________________________
Dr David Worrall.
- Experimental Polymedia:   worrall.avatar.com.au
- Sonification: www.sonifiction.com.au
- Education for Financial Independence: www.mindthemarkets.com.au








Date2010-05-11 22:03
FromAnthony Palomba
Subject[Csnd] Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: write real-time midi from Python
Thanks Victor, I will look into it.


-ap


On Tue, May 11, 2010 at 2:33 PM, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote:
PortMIdi has timing facilities (porttime)

Victor

On 11 May 2010, at 20:28, Anthony Palomba wrote:

Well I don't necessarily need to have it in a csound environment, but I
also need some timing ability. Basically I want to create a procedurally modeled
process that creates MIDI notes that play in real time at a specified tempo.

Would PortMid allow me to do this?



-ap




On Tue, May 11, 2010 at 12:15 PM, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote:
If you just need MIDI, why don't you try using the PortMidi bindings?
http://alumni.media.mit.edu/~harrison/code.html

Victor


On 11 May 2010, at 18:03, apalomba wrote:


I am wanting to use the csound python API to send real-time MIDI.
I found this thread and wanted to get an update on the current
status of things...

So from I can tell it looks like this is possible. I took a look at the
python
script that Chuck posted. Is there an updated version of this script?

It looks like he is creating an instrument and then using that instrument
to send MIDI events. Is there a way I can do that with calls to the
csound python API with out having to go through a csd instrument?



Anthony





RoryWalsh wrote:

I don't know if this is what might be causing your problem but I just
came across it yesterday:

"Unfortunately the real-time timing implemented in Csound is
completely managed by DAC buffer sample flow. So MIDI OUT operations
can present some time irregularities. These irregularities can be
reduced by using a lower value for the -b flag."

Rory.




--
View this message in context: http://old.nabble.com/write-real-time-midi-from-Python-tp26799445p28526793.html
Sent from the Csound - General mailing list archive at Nabble.com.



Send bugs reports to the Sourceforge bug tracker
          https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"




Send bugs reports to the Sourceforge bug tracker
          https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"





Date2010-05-11 23:36
FromDavidW
Subject[Csnd] Re: Re: Re: write real-time midi from Python

On 12/05/2010, at 6:51 AM, Victor Lazzarini wrote:

yes, he asked me, but it's not really MIDI-centric and I guess for what he wants to use now, just a MIDI library should do. Bur eventually, I guess Csound might also be a choice.

Victor
FWIW, I've used the PortMidi - with PortAudio (basically same dev. team) on OSX and it worked well. Didn't thrash it though.
David

On 11 May 2010, at 21:37, DavidW wrote:

Have you looked at Victor's PySndObj?

On 12/05/2010, at 6:23 AM, Anthony Palomba wrote:

Platform is Windows.


-ap

On Tue, May 11, 2010 at 2:53 PM, DavidW <vip@avatar.com.au> wrote:
what platform?

On 12/05/2010, at 3:03 AM, apalomba wrote:


I am wanting to use the csound python API to send real-time MIDI.
I found this thread and wanted to get an update on the current
status of things...

...
________________________________________________
Dr David Worrall.
- Experimental Polymedia:   worrall.avatar.com.au
- Sonification: www.sonifiction.com.au
- Education for Financial Independence: www.mindthemarkets.com.au







Date2010-05-12 08:58
FromStéphane Rollandin
Subject[Csnd] Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: write real-time midi from Python
> Is this a python environment?

No, it is not. Sorry I missed this point.

Stef




Send bugs reports to the Sourceforge bug tracker
            https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"