running functions

Gorlon the Impossible meatpodeye at yahoo.com
Wed Nov 16 22:46:49 EST 2005


On Thu, 17 Nov 2005 00:08:02 GMT, claird at lairds.us (Cameron Laird)
wrote:

>In article <11nna381aoiuc57 at corp.supernews.com>,
>Grant Edwards  <grante at visi.com> wrote:
>>On 2005-11-16, Gorlon the Impossible <meatpodeye at yahoo.com> wrote:
>>
>>> I'm not sure how to phrase this question. I have a Python function
>>> that sends MIDI messages to a synth. When I run it, I of course have
>>> to wait until it is finished before I can do anything else with
>>> Python. Is it possible to run this function and still be able to do
>>> other things with Python while it is running?
>>
>>Yes.
>>
>>> Is that what threading is about?
>>
>>Exactly.  Take a look at the "treading" module:
>>
>>http://www.python.org/doc/current/lib/module-threading.html
>			.
>			.
>			.
>I don't agree, Grant (although I salute the brevity
>of your follow-up), and a couple of other correspon-
>dents have already posted follow-ups that begin to
>explore the alternatives.
>
>If I were pursuing this, the first question I'd have
>for Gorlon is whether he's OK with a "fire and for-
>get" model.  By that, I mean to ask if it's OK to
>send the MIDI message, and then return immediately
>to other Python work, OR whether Gorlon also needs
>to stay in contact with the MIDI handler, and
>perhaps react especially when the MIDI handler
>finishes with the specific message.  That choice is
>crucial in a good concurrency design.

'good concurrency design'  LOL... I'm not that proficient at
programming in general or Python... 
You bring up some interesting points, though. I am just learning and
experimenting with programming MIDI events at this level. My function
sends a series of MIDI note-on and note-off messages and that's it so
far. But, I am trying to learn more and working towards a sort of
'live-coding' set-up for musical performance. So, eventually I will
want  to be able to control other synth parameters with MIDI messages
and be able to start and stop different kinds of control functions 'on
the fly' so to speak. I checked out the threading module and its
working for what I am trying to do at the moment, but I am open to
suggestions and eager to learn all I can about other options. Thanks
for taking the time to respond.
I would be interested in hearing more about the subprocess approach...

>
>So, Gorlon, yes, threading is a prominent member of
>the family of facilities that address situations like
>yours.  It's not the only one, though.



More information about the Python-list mailing list