Python suitable for Midi ?

P

Protocol

Hello all

Is Python suitable for building a multi-track midi sequencer (with a
gui), that would run on windows / mac ? I fail to find sufficient
information on this, being a newbie and all. Furthermore, i found
references on Python not being really able of multi-threading, that
further adds to the confusion.

Please assist.

Panos
 
C

Chuckk Hubbard

I'm writing a sequencer in Python, although it's microtonal and not
MIDI. I'm using the Python bindings for the Csound API, all the
timing, MIDI, OSC, etc. stuff, essentially all but the GUI
capabilities, having been done by the Csound developers already.
Documentation is here and there, and Csound is another language to
learn, but it's one way to go about it.
I'm about to try to recode my app to calculate tempo and note timing
internally and send real-time notes to Csound, instead of having
Csound do it all.
The problem I've run into is that I can't set the audio to a higher
priority than the GUI (Tkinter). If I move the mouse over the app, no
matter what, I get audio dropouts. AFAICT this is the same for all
Python, regardless of what modules one uses: you can't assign system
priorities to different threads. If you're planning to pipe MIDI to
another app for playback, maybe it won't be an issue for you.
Good luck!

-Chuckk
 
D

Derek Martin

The problem I've run into is that I can't set the audio to a higher
priority than the GUI (Tkinter). If I move the mouse over the app, no
matter what, I get audio dropouts. AFAICT this is the same for all
Python, regardless of what modules one uses: you can't assign system
priorities to different threads. If you're planning to pipe MIDI to
another app for playback, maybe it won't be an issue for you.

FWIW... You could take your own advice, and devide your application
in two: one process manages the GUI, and the second is a back-end
process that plays the MIDI. Your GUI can even launch the back end,
which will inherit the priority of the GUI, after which the GUI can
reduce its own priority (the priority of the back end will not be
affected by the change)...


--
Derek D. Martin
http://www.pizzashack.org/
GPG Key ID: 0x81CFE75D


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQFJB0gudjdlQoHP510RAvKGAJ4lWErDALJSACes5O4OqASoSlYuFgCgvTNx
Li051e8NyguC8YpbDHvqhBA=
=nKYZ
-----END PGP SIGNATURE-----
 
J

J Kenneth King

Derek Martin said:
FWIW... You could take your own advice, and devide your application
in two: one process manages the GUI, and the second is a back-end
process that plays the MIDI. Your GUI can even launch the back end,
which will inherit the priority of the GUI, after which the GUI can
reduce its own priority (the priority of the back end will not be
affected by the change)...

One also has access to nice-levels on unix systems.
 
C

Chuckk Hubbard

One also has access to nice-levels on unix systems.

True enough, but it's not so much a problem for me, as I'm pretty okay
at tuning my own system, but I believe most of the people who'd be
interested in my app (if any) are not *nix users. At any rate, it's
one option for those who are, and thanks for reminding me.

-Chuckk
 
G

Gabriel Genellina

En Thu, 30 Oct 2008 16:50:22 -0200, Chuckk Hubbard
True enough, but it's not so much a problem for me, as I'm pretty okay
at tuning my own system, but I believe most of the people who'd be
interested in my app (if any) are not *nix users. At any rate, it's
one option for those who are, and thanks for reminding me.

On Windows you can set the application global priority (SetPriorityClass)
and each thread's priority related to other threads (SetThreadPriority) -
either using pywin32 or the ctypes module.
 
C

Chuckk Hubbard

FWIW... You could take your own advice, and devide your application
in two: one process manages the GUI, and the second is a back-end
process that plays the MIDI. Your GUI can even launch the back end,
which will inherit the priority of the GUI, after which the GUI can
reduce its own priority (the priority of the back end will not be
affected by the change)...

Thanks, Derek! It took me some looking and experimenting, but this is
a great idea. I see now that os.nice() works for Mac too, and Gabriel
has some suggestions for Windows. So simple- I was thinking I needed
superuser access to set priority to real-time, but I don't need it to
raise the priority of a running process. I never would have thought
of that on my own.

-Chuckk
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top