[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] pygame.midi using portmidi?



The --list option goes to print_device_info(), which seems to be
missing the initialization stuff:
    pygame.init()
    pygame.midi.init()

I'm new to MIDI in general, but I am planning on using this in a
project I'm working on.  Is there a reason we are using channel 1 on
MIDI Writes rather than having the channel be an argument of the
function with a default of 1?

Nirav

On Tue, Jan 13, 2009 at 2:59 PM, Lenard Lindstrom <len-l@xxxxxxxxx> wrote:
> Hi René,
>
> Good stuff. I added a main() function to midi.py, for consistency, as well
> as a --list option. As for porttime it is no big problem to repair the
> Windows build. Just curious though, why did add a new PORTTIME macro to
> Setup.in instead of:
>
> PORTMIDI = -lportmidi -lporttime
>
>
> Lenard
>
> P.S.  Brian, just add the line
>
> PORTTIME =
>
> to prebuilt\Setup_Win.in and the automated Windows builds will continue to
> work.
>
>
> René Dudfield wrote:
>>
>> Hi,
>>
>> I added a get_device_info(device_id) function... to allow seeing which
>> devices are available.  The midi.py example prints out the available
>> devices.
>>
>> it is also compiling on ubuntu... (ya! I finally got my ubuntu
>> partition working again).
>>
>> Had to link in libporttime... and therefore add it as a dependency,
>> which may have broken msys build.
>>
>> Added allowing to specify an optional device_id  on the cmd line  eg,
>> --input 3
>>
>>
>> cu,
>>
>>
>>
>> On Wed, Dec 24, 2008 at 6:10 PM, René Dudfield <renesd@xxxxxxxxx> wrote:
>>
>>>
>>> Hi,
>>>
>>> yes, something like that would be good.  There could be a separate
>>> function running in a background thread to handle all of the input
>>> midi.  Which I think would just run code similar to what is in the
>>> example.  Probably something very useful to add.
>>>
>>> A piano keyboard example would be a very nice one I think :)
>>>
>>> cu,
>>>
>>>
>>>
>>> On Wed, Dec 24, 2008 at 5:19 PM, Lenard Lindstrom <len-l@xxxxxxxxx>
>>> wrote:
>>>
>>>>
>>>> Hi René,
>>>>
>>>> I will look at the new midi.py and flesh out the keyboard example: port
>>>> selection, a piano keyboard in the window, more notes, etc. It's good
>>>> news
>>>> about the pypm wrapper. One thing I was wondering, is it possible to
>>>> hide
>>>> the portmidi event to Pygame event translation, so only Pygame events
>>>> are
>>>> visible in the main loop?
>>>>
>>>> Lenard
>>>>
>>>> René Dudfield wrote:
>>>>
>>>>>
>>>>> hey,
>>>>>
>>>>> that's cool.  I checked in a new pygame.midi which uses a modified
>>>>> version of your output class.
>>>>>
>>>>> I also put an examples/midi.py in there.  It contains an input
>>>>> example, and your output example converted to use the pygame.midi
>>>>> module.
>>>>>
>>>>> python midi.py --output
>>>>> python midi.py --input
>>>>>
>>>>>
>>>>> Also John Harrison said we could use his pyrex pypm portmidi wrapper
>>>>> in pygame :)
>>>>>
>>>>> cu,
>>>>>
>>>>> On Wed, Dec 24, 2008 at 6:57 AM, Lenard Lindstrom <len-l@xxxxxxxxx>
>>>>> wrote:
>>>>>
>>>>>
>>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> I'm reposting my keyboard pyportmidi example. It has been changed to
>>>>>> use
>>>>>> pygame.pypm. The midiport module may be of interest as it contains an
>>>>>> output
>>>>>> class. The keyboard program could go into the examples, with some
>>>>>> improvements. Once midi has been fixed if you want to add keyboard.py
>>>>>> to
>>>>>> the
>>>>>> examples, with the needed changes for pygame.midi, I can spruce it up
>>>>>> to
>>>>>> make it more intuitive.
>>>>>>
>>>>>> Usage: The q,w,e and r keys play four notes on the Church Organ
>>>>>> instrument.
>>>>>> Also the four notes can be played by clicking horizontally across the
>>>>>> blue
>>>>>> window. It is very simple for now but could be developed into a proper
>>>>>> keyboard.
>>>>>>
>>>>>> Lenard
>>>>>>
>>>>>> René Dudfield wrote:
>>>>>>
>>>>>>
>>>>>>>
>>>>>>> hi again,
>>>>>>>
>>>>>>> Another note:
>>>>>>>
>>>>>>> Tim Thompson said we could include his patches to pyportmidi, and
>>>>>>> also
>>>>>>> include some of his other midi code...
>>>>>>>
>>>>>>> """You'll also find there a python module (nosuch.midiutil) that
>>>>>>> contains higher-level routines for MIDI things, including a MIDI file
>>>>>>> reader, simple scheduler, etc."""
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>> --
>>>>>> Lenard Lindstrom
>>>>>> <len-l@xxxxxxxxx>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>
>>>> --
>>>> Lenard Lindstrom
>>>> <len-l@xxxxxxxxx>
>>>>
>>>>
>>>>
>
>
> --
> Lenard Lindstrom
> <len-l@xxxxxxxxx>
>
>