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

Re: [pygame] pygame.midi not working on Ubuntu Jaunty?



That is unusual. I am using Debian lenny. Pygame 1.9.1 uses portmidi. The Pygame midi.py output example works for me whether Timidity is started at boot time or from the console - "timidity -iA &". The vir_midi module is not needed.

Lenard

Gary Bishop wrote:
Ok, I got it going. For me the modprobe is not required.

Simply typing

sudo /etc/init.d/timidity restart

fixes things up. That command stops and restarts the timidity server. Why doing that fixes its relationship to pygame I don't know but it does.

Note that vkeybd (an app from the Ubuntu repository) works fine without this hack. So there is something different about the way pygame is using midi.

Thanks for the help
gb


Lenard Lindstrom wrote:
Hi,

The instructions I found for Timidity, http://koti.mbnet.fi/bstrom/filedata/en/my-timidity-howto.html, claim that the Alsa virtual midi port module must also be installed:

modprobe vir_midi

With it in place and the Timidity virtual server started I get this listing from pygame.examples.midi:

~$ python -m pygame.examples.midi --list
0: interface :ALSA:, name :Midi Through Port-0:, opened :0:  (output)
1: interface :ALSA:, name :Midi Through Port-0:, opened :0:  (input)
2: interface :ALSA:, name :VirMIDI 1-0:, opened :0:  (output)
3: interface :ALSA:, name :VirMIDI 1-0:, opened :0:  (input)
4: interface :ALSA:, name :VirMIDI 1-1:, opened :0:  (output)
5: interface :ALSA:, name :VirMIDI 1-1:, opened :0:  (input)
6: interface :ALSA:, name :VirMIDI 1-2:, opened :0:  (output)
7: interface :ALSA:, name :VirMIDI 1-2:, opened :0:  (input)
8: interface :ALSA:, name :VirMIDI 1-3:, opened :0:  (output)
9: interface :ALSA:, name :VirMIDI 1-3:, opened :0:  (input)
10: interface :ALSA:, name :TiMidity port 0:, opened :0:  (output)
11: interface :ALSA:, name :TiMidity port 1:, opened :0:  (output)
12: interface :ALSA:, name :TiMidity port 2:, opened :0:  (output)
13: interface :ALSA:, name :TiMidity port 3:, opened :0:  (output)

I tried it with port 10 and it works, though sounds lousy on my slow machine. With some Timidity tweaks for interactive playback the sound becomes better.

Lenard Lindstrom


Gary Bishop wrote:
More details on what I am seeing:

$ pmidi -l
 Port     Client name                       Port name
 14:0     Midi Through                      Midi Through Port-0
128:0     TiMidity                          TiMidity port 0
128:1     TiMidity                          TiMidity port 1
128:2     TiMidity                          TiMidity port 2
128:3     TiMidity                          TiMidity port 3

pmidi shows I have midi ports.

$ vkeybd --addr 128:0

Works and sounds fine.

$ python midi.py --list
 0: interface :ALSA:, name :Midi Through Port-0:, opened :0:  (output)
 1: interface :ALSA:, name :Midi Through Port-0:, opened :0:  (input)
 2: interface :ALSA:, name :TiMidity port 0:, opened :0:  (output)
 3: interface :ALSA:, name :TiMidity port 1:, opened :0:  (output)
 4: interface :ALSA:, name :TiMidity port 2:, opened :0:  (output)
 5: interface :ALSA:, name :TiMidity port 3:, opened :0:  (output)

The pygame midi test can see all the midi ports.

$ python midi.py --output 2
 0: interface :ALSA:, name :Midi Through Port-0:, opened :0:  (output)
 1: interface :ALSA:, name :Midi Through Port-0:, opened :0:  (input)
 2: interface :ALSA:, name :TiMidity port 0:, opened :0:  (output)
 3: interface :ALSA:, name :TiMidity port 1:, opened :0:  (output)
 4: interface :ALSA:, name :TiMidity port 2:, opened :0:  (output)
 5: interface :ALSA:, name :TiMidity port 3:, opened :0:  (output)
using output_id :2:

Running midi.py with --output 2 looks great but no sound.

Still looking for ideas.
Thanks
gb



Gary Bishop wrote:
Yes, timidity is in the list and as I said, works fine from the vkeybd app connects to it and works fine.
gb

Lenard Lindstrom wrote:
Gary Bishop wrote:
I'm trying out the new pygame.midi on Ubuntu Jaunty. I'm running
examples/midi.py in output mode on Python 2.6.2 with pygame 1.9.1 built from source without errors. portmidi and porttime were found during the
build.

The vkeybd app works so I know midi output (timidity) works fine.

examples/midi.py displays properly and does not produce any error
messages but it produces no sound.

Any ideas?

Thanks
gb

Hi Gary,

Try the --list option on examples/midi.py to see if a virtual timidity output port is present. Getting some form of midi working with alsa is a hassel.

Lenard Lindstrom