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

Re: [pygame] pygame.midi using portmidi?



I changed the default channel from 1 to 0 and added the channel arg to
set_instrument.
Committed revision 2158.

Nirav

On Sat, May 16, 2009 at 9:56 PM, René Dudfield <renesd@xxxxxxxxx> wrote:
> hi,
>
> I added a channel argument to note_on note_off to svn.
> Committed revision 2154.
>
> cheers,
>
>
>
> On Mon, Apr 27, 2009 at 10:58 AM, René Dudfield <renesd@xxxxxxxxx> wrote:
>>
>> hi,
>>
>> the Channel stuff isn't wrapped yet in midi.py...  See pypm.pyx Channel to
>> see how Channels work.  The portmidi.h file also has some good docs to see
>> how it works at the C level.  However that's just used for input.
>>
>> I think you can change the channel like this:
>>
>> channel = 1
>> note = 65
>> velocity = 100
>> output.write_short(0x90+channel, note, velocity)
>>
>> ... I think... will need to check the exact codes.
>>
>> So, yeah I agree... we should have a channel default with the
>> note_on/note_off methods.
>>
>>
>>
>> cu,
>>
>>
>>
>> On Mon, Apr 27, 2009 at 7:03 AM, Nirav Patel <olpc@xxxxxxxxxxxxxx> wrote:
>>>
>>> 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>
>>> >
>>> >
>>
>
>