Discussion:
Python3 version packaged?
Jason Marshall
2014-03-21 01:06:23 UTC
Permalink
Here's an idea: what if we were to remove pyportmidi 0.0.6 from the pygame source and make pygame.midi dependent on stand-alone pyportmidi?

Jason

PS. I think the most recent version of pyportmidi, 0.0.7, is here: https://bitbucket.org/aalex/pyportmidi/

From: Christopher Night <cosmologicon-***@public.gmane.org>
To: pygame-users-***@public.gmane.org
Sent: Tuesday, December 31, 2013 4:58 PM
Subject: Re: [pygame] Python3 version packaged?

That&#39;s all well and good for development, but if I want to distribute my game to other Ubuntu users I&#39;m not going to tell players they have to comment out part of the setup file for one of my dependencies and install it from source.



I&#39;m not complaining or anything. Set whatever priorities you think are appropriate. I&#39;m just adding another data point: this is blocking me from transitioning to Python3.

-Christopher




On Tue, Dec 31, 2013 at 5:47 PM, Lenard Lindstrom <len-l-***@public.gmane.org> wrote:


Hi,



On Gnu/Linux it is simpler to just build Pygame from source. The dependencies are libsdl-mixer, libsdl-image, libsdl-ttf, and libportmidi0. Installing these libraries, and their header file dev packages should force the installation of all Pygame dependencies, such as SDL and freetype2. Also be sure to include the Python3 dev package. Since I do most of my Pygame development on Linux Mint, there should be no compatibility issues on Ubuntu, except with libportmidi0. So I suggest commenting out the Pygame midi module entry in the Setup file.





Lenard Lindstrom



On 13-12-31 09:36 AM, Sam Bull wrote:


Can we get a working Python3 version of Pygame packaged either in the

Ubuntu repositories or in pip3?



This would be really helpful in allowing us to transition to Python3 for

our projects.
diliup gabadamudalige
2014-03-21 05:45:27 UTC
Permalink
wouldn't it be a good idea to compile using py2exe or such so that every
user has all dependancies?
I'm writing a Music software now using pygame midi and the exes so far have
worked on all windows machines.
Here's an idea: what if we were to remove pyportmidi 0.0.6 from the pygame
source and make pygame.midi dependent on stand-alone pyportmidi?
Jason
https://bitbucket.org/aalex/pyportmidi/
From: Christopher Night
Sent: Tuesday, December 31, 2013 4:58 PM
Subject: Re: [pygame] Python3 version packaged?
That's all well and good for development, but if I want to distribute my
game to other Ubuntu users I'm not going to tell players they have to
comment out part of the setup file for one of my dependencies and install
it from source.
I'm not complaining or anything. Set whatever priorities you think are
appropriate. I'm just adding another data point: this is blocking me from
transitioning to Python3.
-Christopher
Hi,
On Gnu/Linux it is simpler to just build Pygame from source. The
dependencies are libsdl-mixer, libsdl-image, libsdl-ttf, and libportmidi0.
Installing these libraries, and their header file dev packages should force
the installation of all Pygame dependencies, such as SDL and freetype2.
Also be sure to include the Python3 dev package. Since I do most of my
Pygame development on Linux Mint, there should be no compatibility issues
on Ubuntu, except with libportmidi0. So I suggest commenting out the Pygame
midi module entry in the Setup file.
Lenard Lindstrom
Can we get a working Python3 version of Pygame packaged either in the
Ubuntu repositories or in pip3?
This would be really helpful in allowing us to transition to Python3 for
our projects.
--
Diliup Gabadamudalige


http://www.diliupg.com
http://soft.diliupg.com/

**********************************************************************************************
This e-mail is confidential. It may also be legally privileged. If you are
not the intended recipient or have received it in error, please delete it
and all copies from your system and notify the sender immediately by return
e-mail. Any unauthorized reading, reproducing, printing or further
dissemination of this e-mail or its contents is strictly prohibited and may
be unlawful. Internet communications cannot be guaranteed to be timely,
secure, error or virus-free. The sender does not accept liability for any
errors or omissions.
**********************************************************************************************
Christopher Arndt
2014-03-21 10:05:03 UTC
Permalink
That's exactly the problem. It's not clear, what the most recent version
or even the definite distribution of pyportmidi is.

There are, to my knowledge at least three versions, maybe more (but I
forget where) all different.

- The version in PyGame
- The version you mentioned
- The version in the portmidi repository

It's alspo not clear, if R. Dannenberg is really maintaining portmidi
anymore. Commits within th elast years have been very few (to say the
least) and the last change to pyportmidi is from late 2010. The repo on
bitbucket by aalex is even older.


Chris
Jake b
2014-03-21 11:45:37 UTC
Permalink
I tried to find what version SDL2 uses, but I didn't see any mention off
portmidi.
Christopher Arndt
2014-03-21 12:18:58 UTC
Permalink
Post by Jake b
I tried to find what version SDL2 uses, but I didn't see any mention off
portmidi.
SDL has, to my knowledge, never included any MIDI interfacing. MIDI
support was a PyGame addition.

PyGame should, IMHO, ditch the included pyportmidi module altogether and
instead rely on a third-party package to provide MIDI support.

Pyportmidi is, as I mentioned, poorly maintained, portmidi itself is
very limited in some aspects (e.g. no MIDI input callback-API) and
library packages on major Linux distros have been poorly maintained as
well. Including its own binding for an external library but then having
to rely on the presence of said shared library on the system has no
advantage over depending on a third-party Python package anyway, from a
distribution viewpoint.

One could easily write a module for providing a pygame.midi
backwards-compatible API to a third-party MIDI module. In fact, I'm
doing that for my python-rtmidi [1] module right now.


Chris

[1] http://python.org/pypi/python-rtmidi
diliup gabadamudalige
2014-03-21 13:32:35 UTC
Permalink
10 days ago i wrote to John Harrision the author of pyportMIDI and he said
that he has discontinued the development and to use the MIDI in pygame.
below is his relevant text
"I haven't worked on pyPortMidi in years, unfortunately, so I've lost track
of it. I think the developers of pyGame forked it and ran with it. I'd look
for their version."
Post by Jake b
I tried to find what version SDL2 uses, but I didn't see any mention off
Post by Jake b
portmidi.
SDL has, to my knowledge, never included any MIDI interfacing. MIDI
support was a PyGame addition.
PyGame should, IMHO, ditch the included pyportmidi module altogether and
instead rely on a third-party package to provide MIDI support.
Pyportmidi is, as I mentioned, poorly maintained, portmidi itself is very
limited in some aspects (e.g. no MIDI input callback-API) and library
packages on major Linux distros have been poorly maintained as well.
Including its own binding for an external library but then having to rely
on the presence of said shared library on the system has no advantage over
depending on a third-party Python package anyway, from a distribution
viewpoint.
One could easily write a module for providing a pygame.midi
backwards-compatible API to a third-party MIDI module. In fact, I'm doing
that for my python-rtmidi [1] module right now.
Chris
[1] http://python.org/pypi/python-rtmidi
--
Diliup Gabadamudalige


http://www.diliupg.com
http://soft.diliupg.com/

**********************************************************************************************
This e-mail is confidential. It may also be legally privileged. If you are
not the intended recipient or have received it in error, please delete it
and all copies from your system and notify the sender immediately by return
e-mail. Any unauthorized reading, reproducing, printing or further
dissemination of this e-mail or its contents is strictly prohibited and may
be unlawful. Internet communications cannot be guaranteed to be timely,
secure, error or virus-free. The sender does not accept liability for any
errors or omissions.
**********************************************************************************************
Christopher Arndt
2014-03-21 14:06:24 UTC
Permalink
Post by diliup gabadamudalige
10 days ago i wrote to John Harrision the author of pyportMIDI and he
said that he has discontinued the development and to use the MIDI in pygame.
below is his relevant text
"I haven't worked on pyPortMidi in years, unfortunately, so I've lost
track of it. I think the developers of pyGame forked it and ran with it.
I'd look for their version."
Thanks for this information. It confirms what I already suspected:
pyportmidi is an aboonded, unmaintained project.

I was the one that last worked on the pyportmidi version in PyGame
(pypm.pyx), but I have since written my own Python MIDI module, the
RtMidi binding I mentioned in my last post, so I'm not planning on
maintaining the pypm module in PyGame either, because I think it is
fundamentally flawed.

Chris
Michiel Overtoom
2014-03-21 15:58:57 UTC
Permalink
One could easily write a module for providing a pygame.midi backwards-compatible API to a third-party MIDI module. In fact, I'm doing that for my python-rtmidi [1] module right now.
Thanks for the tip. I was looking around for a cross-platform python midi module which can do output and timestamped input. RtMidi and its python binding looks promising. I'm creating a FretsOnFire/BandHero-like training program, for drums only.

Greetings,
--
Veel spullen zijn tegenwoordig waardeloos, maar toch hecht men er veel waarde aan. Mensen hebben vaak teveel spullen. Hoe komt dat en wat doe je ertegen? - een essay van Paul Graham, op http://www.michielovertoom.com/articles/paul-graham-spullen

"Een prima telefoon met draaischijf weggooien? Die zou ik nog wel eens nodig kunnen hebben!"
Christopher Arndt
2014-03-21 16:43:15 UTC
Permalink
Post by Michiel Overtoom
Thanks for the tip. I was looking around for a cross-platform python midi module which can do output and timestamped input. RtMidi and its python binding looks promising. I'm creating a FretsOnFire/BandHero-like training program, for drums only.
If you try out python-rtmidi, let me know how it goes and whether you
encountered any problems. It is still marked as beta because I haven't
got much feedback from others using it yet, but the API should be
stable, I'm only adding extra functionality in extra Python modules.

There is one oddity about RtMidi and timestamps: incoming events come
with a delta time relative to the time the first event was received
after you opened the input port (the first event has a delta time of
zero). If you use the polling API (MidiIn.get_message()) there's no way
to tell exactly when that first event occured, because it could have
been at any time between when the port was opened and get_message() was
called for the first time. So these delta times are only relative and
you can't really reference them to anything except the other events.

The solution is to use the callback API, because then you'll get the
first event as soon as it appears and you can save this point in time as
a reference.


Chris
diliup gabadamudalige
2014-03-21 16:44:05 UTC
Permalink
Can any of you gentlemen help me out on a small query?
I am writing a music software and I need to calculate MIDI note on and note
off from key press duration either from the computer keyboard or a MIDI
input? Can I use the pygame.midi.time() counter to do that? (difference
between key on and key off time).
or should I simply use another module? What is your recommendation?

Thank You in advance
Post by Jake b
Post by Christopher Arndt
One could easily write a module for providing a pygame.midi
backwards-compatible API to a third-party MIDI module. In fact, I'm doing
that for my python-rtmidi [1] module right now.
Thanks for the tip. I was looking around for a cross-platform python midi
module which can do output and timestamped input. RtMidi and its python
binding looks promising. I'm creating a FretsOnFire/BandHero-like training
program, for drums only.
Greetings,
--
Veel spullen zijn tegenwoordig waardeloos, maar toch hecht men er veel
waarde aan. Mensen hebben vaak teveel spullen. Hoe komt dat en wat doe je
ertegen? - een essay van Paul Graham, op
http://www.michielovertoom.com/articles/paul-graham-spullen
"Een prima telefoon met draaischijf weggooien? Die zou ik nog wel eens
nodig kunnen hebben!"
--
Diliup Gabadamudalige


http://www.diliupg.com
http://soft.diliupg.com/

**********************************************************************************************
This e-mail is confidential. It may also be legally privileged. If you are
not the intended recipient or have received it in error, please delete it
and all copies from your system and notify the sender immediately by return
e-mail. Any unauthorized reading, reproducing, printing or further
dissemination of this e-mail or its contents is strictly prohibited and may
be unlawful. Internet communications cannot be guaranteed to be timely,
secure, error or virus-free. The sender does not accept liability for any
errors or omissions.
**********************************************************************************************
Christopher Arndt
2014-03-21 17:08:45 UTC
Permalink
Post by diliup gabadamudalige
I am writing a music software and I need to calculate MIDI note on and
note off from [...] MIDI input? Can I use the pygame.midi.time() counter to do that?
You could, but I would just use the pygame.event queue to handle all
events in the same fashion. Just make sure you poll MIDI input often
enough (by calling poll/read on your MIDI Input instance) and pass the
received MIDI events to the pygame.event queue via
pygame.midi.midis2events and pygame.event.post.

Of course, MIDI input handling is much easier with a callback API,
because you don't need to poll regularly. Here's a short example of
handling MIDI input with python-rtmidi's callback mechanism:

http://trac.chrisarndt.de/code/browser/projects/python-rtmidi/trunk/tests/test_midiin_callback.py
Post by diliup gabadamudalige
(difference between key on and key off time).
This has nothing to do with MIDI. Just use the pygame.event mechanism to
record the key events and when they occur (use time.time() or
pygame.time.get_ticks()) and then calculate the difference.


Chris
diliup gabadamudalige
2014-03-21 17:49:04 UTC
Permalink
Thank You very much!
Much appreciated.
May you be well.
Post by diliup gabadamudalige
Post by diliup gabadamudalige
I am writing a music software and I need to calculate MIDI note on and
note off from [...] MIDI input? Can I use the pygame.midi.time() counter
to do that?
You could, but I would just use the pygame.event queue to handle all
events in the same fashion. Just make sure you poll MIDI input often
enough (by calling poll/read on your MIDI Input instance) and pass the
received MIDI events to the pygame.event queue via
pygame.midi.midis2events and pygame.event.post.
Of course, MIDI input handling is much easier with a callback API,
because you don't need to poll regularly. Here's a short example of
http://trac.chrisarndt.de/code/browser/projects/python-rtmidi/trunk/tests/test_midiin_callback.py
Post by diliup gabadamudalige
(difference between key on and key off time).
This has nothing to do with MIDI. Just use the pygame.event mechanism to
record the key events and when they occur (use time.time() or
pygame.time.get_ticks()) and then calculate the difference.
Chris
--
Diliup Gabadamudalige


http://www.diliupg.com
http://soft.diliupg.com/

**********************************************************************************************
This e-mail is confidential. It may also be legally privileged. If you are
not the intended recipient or have received it in error, please delete it
and all copies from your system and notify the sender immediately by return
e-mail. Any unauthorized reading, reproducing, printing or further
dissemination of this e-mail or its contents is strictly prohibited and may
be unlawful. Internet communications cannot be guaranteed to be timely,
secure, error or virus-free. The sender does not accept liability for any
errors or omissions.
**********************************************************************************************
Christopher Arndt
2014-03-21 19:41:41 UTC
Permalink
Post by Christopher Arndt
One could easily write a module for providing a pygame.midi
backwards-compatible API to a third-party MIDI module. In fact, I'm
doing that for my python-rtmidi [1] module right now.
There you go:
https://bitbucket.org/pygame/pygame/pull-request/28/replace-internals-of-pygamemidi-with/diff


Chris

Loading...