Skip to main content

Python Wrappings for PortMidi

Project description

pm-python - Python wrappings for PortMidi

Originally created by John Harrison, harrison@media.mit.edu

Modified by Roger B. Dannenberg, Nov 2009, 2021, with contributions by anonymous

I, Aaron Krister Johnson akjmicro@gmail.com, am volunteering to maintain and modernize this code.

My fork of the repo, the basis of this package, lives at https://github.com/akjmicro/pm_python

pm-python

pm-python is a Python wrapper for PortMidi. PortMidi is a cross-platform C library for realtime MIDI control. Using pm-python, you can send and receive MIDI data in realtime from Python.

Besides using pm-python to communicate to synthesizers and the like, it is possible to use pm-python as a way to send MIDI messages between software packages on the same computer. For example, Using pm-python and MIDI-YOKE on a Windows machine, it is possible to send realtime MIDI messages between programs on the same computer using loopback virtual MIDI ports.

pm-python works with Python 3.x and may also work with Python 2.6

Example usage

from pyportmidi import * pm_init() pm_show_all_devices() DEVNUM: 0 | ALSA Midi Through Port-0 - OUTPUT DEVNUM: 1 | ALSA Midi Through Port-0 - INPUT DEVNUM: 2 | ALSA VirMIDI 1-0 - OUTPUT DEVNUM: 3 | ALSA VirMIDI 1-0 - INPUT DEVNUM: 4 | ALSA VirMIDI 1-1 - OUTPUT DEVNUM: 5 | ALSA VirMIDI 1-1 - INPUT DEVNUM: 6 | ALSA VirMIDI 1-2 - OUTPUT DEVNUM: 7 | ALSA VirMIDI 1-2 - INPUT DEVNUM: 8 | ALSA VirMIDI 1-3 - OUTPUT DEVNUM: 9 | ALSA VirMIDI 1-3 - INPUT out = PmOutput(2) out.note_on(60, 100) out.note_off(60) pm_quit()

There remain certain possible bugs relating to closing the actual PmInput/PmOutput objects with .close(). As I know the solution, I'll push a fix.

For questions/concerns, contact me at akjmicro@gmail.com

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pm_python-0.0.9.tar.gz (12.9 kB view details)

Uploaded Source

File details

Details for the file pm_python-0.0.9.tar.gz.

File metadata

  • Download URL: pm_python-0.0.9.tar.gz
  • Upload date:
  • Size: 12.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.3

File hashes

Hashes for pm_python-0.0.9.tar.gz
Algorithm Hash digest
SHA256 16e81d4e43451d4bc8e50ca2fb42de6bb6586685e9e961cc1fa405d0d82f4731
MD5 5635725297de19c935e6db5216e06e1f
BLAKE2b-256 e080de4ef551a520bb6826063542efc3a019425812966d8d1128adf21e5924c8

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page