pygame.midi. Я нашел вариант кода и попробовал его.
Код: Выделить всё
import pygame.midi
from time import sleep
pygame.midi.init() # Initialize the Midi module
player = pygame.midi.Output(0) # Attach to the output device (speakers)
tempo = 600000 # 100 BPM
player.write_short(0xFF, 0x51, 0x03) # Meta message for tempo change
player.write_short(tempo >> 16)
player.write_short(tempo >> 8 & 0xFF)
player.write_short(tempo & 0xFF)
tempo_message = [0xFF, 0x51, 0x03, 0x00, 0x00, 0x00, 0x7A, 0x1F]
player.write(tempo_message)
Исключение: b"PortMidi: `Неверные данные MIDI-сообщения'"< /p>
У кого-нибудь был опыт выполнения этой работы? Спасибо.
Подробнее здесь: https://stackoverflow.com/questions/792 ... di-package