Skip to main content

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

Metadata

Release files for pm-python 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pm-python 0.1.0
File Size Uploaded Provenance Actions
pm_python-0.1.0.tar.gz 12.9 kB Without provenance Details for pm_python-0.1.0.tar.gz

Release files / pm_python-0.1.0.tar.gz

Download URL pm_python-0.1.0.tar.gz
Size 12.9 kB
Tags Source
SHA-256 checksum
How to use checksums
94700bef1d585d55a5f367c706bd40bb24d0dd8b47a0531e76454d6950937aba
BLAKE2b-256 checksum
How to use checksums
546610c36c04ee6c54b0ed4d5e6b69ff46f589f9d055737198dbcafe0bc3d99d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.12.3

Security for pm-python 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page