I'm trying to play a sound with the pygame.midi module. Here is the code I
use :
#!/usr/bin/env python
import pygame.midi
import time
pygame.midi.init()
print pygame.midi.get_default_output_id()
print pygame.midi.get_device_info(0)
player = pygame.midi.Output(0)
player.set_instrument(0)
print 'Playing...'
player.note_on(64)
time.sleep(1)
player.note_off(64)
print 'Played'
pygame.midi.quit()
I've found similar codes while searching for exemples, here is the output :
0
('ALSA', 'Midi Through Port-0', 0, 1, 0)
Playing...
Played
PortMidi call failed...
PortMidi: `Bad pointer'
type ENTER...
No sound is played, and I didn't find any info about the PortMidi error which
occurs surprisingly after pygame.midi quits.
Do you have any idea? I'm running an debian-based linux distribution if that
can help.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…