On Mon, 25 Apr 2011 14:17:50 +0100, Passiday <passi...@gmail.com> wrote:

Hello,

I'd like to experiment with Python, connecting my Linux PC with MIDI
device (standard synthesiser keyboard).

I am pretty new to the Python world, so the questions that crop up, I
assume, could be pretty basic to someone who had spent some time with
it.

So, here comes:
1) Is everything what could be done with Python in some IDE (Eclipse
for me), can be accomplished in the interactive console? I mean,
perhaps Python could be used just as programming language and compiled
in binary code, thus allowing access to some binary libraries what
might not be accessible from within the interpreter.

This is two, or possibly three, distinct unrelated questions as best
I can tell.

1a) Yes, anything you can do in an IDE you can do at the Python
interactive command line prompt.  Or by running your script directly
in a terminal window.  Personally I find it less hassle to do it that
way, since IDEs usually don't work the way I want them to.

1b) Python can be compiled down to binary if you try hard, with
utilities like Py2exe.  You don't usually want to do that, though.

1c) ...because there are plenty of ways of wrapping up libraries
so that Python scripts can use them.  ctypes (in the standard
library) is a good place to start.

2) Is there a way how to run Python script in event-driven mode, ie,
run the script, it registers some function as keyboard event handler,
and then calls that function whenever I press any key. Is such
behaviour possible in the interactive mode? Since I want to test the
MIDI message exchange, having a function sitting on the timer event is
what I'll need for playback, and an event that is triggered by
incoming MIDI message for recording.

Probably.  It sounds like what you really want is a framework of
some sort that knows about things like "the timer event", and using
it from the interactive prompt won't be for the faint of heart!
Someone must have walked this path before, though.

3) Of course, I need some Python module to actually get this MIDI
communication happen. Sending and receiving MIDI messages to and from
my MIDI device.
4) As for manipulating the MIDI files in Python, I have searched up
this: http://www.mxm.dk/products/public/pythonmidi  However, this lib
doesn't try to provide actual communication with MIDI device.

The Python In Music wiki page (http://wiki.python.org/moin/PythonInMusic)
has an entire section on MIDI packages.  I've never used any of them,
so I can't comment.

--
Rhodri James *-* Wildebeest Herder to the Masses
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to