Skip to main content

A package that wraps Pygame midi for simplified use

Project description

Midi Wrapper

This package contains classes that wrap the Pygame Midi class to allow selection of a midi input device, and simple polling of said device with predefined classes to help interpret the signals.

This implementation is limited in that it is only polling for one event per poll instead of multiple events, as such it will pull one at a time.

Polling for multiple events in one frame may be supported in future.

Usage

from pygame import midi
from midi_wrapper import MidiMenu, MidiDevice

# Boiler plate midi initialization for pygame midi
midi.init()

if (midi == None):
	print("Error initializing midi.")
	exit(-1)

# Initialize the menu to start device selection, then pass to device to get reference
midi_menu = MidiMenu(midi)
midi_device = MidiDevice(midi, midi_menu)

# Bog standard polling loop
while True:
	# Returns None if no events received or a MidiData type if an event is found
	midi_data = midi_device.poll_device()

	if midi_data != None:
		midi_event = midi_data.event
		print(f"Clock: {midi_data.clock} :: Name: {midi_event.name} :: Channel: {midi_event.channel} :: Data: {midi_event.data}")

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

midi-wrapper-SnooperXP-0.0.5.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

midi_wrapper_SnooperXP-0.0.5-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file midi-wrapper-SnooperXP-0.0.5.tar.gz.

File metadata

  • Download URL: midi-wrapper-SnooperXP-0.0.5.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.0 setuptools/51.1.0 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.8.5

File hashes

Hashes for midi-wrapper-SnooperXP-0.0.5.tar.gz
Algorithm Hash digest
SHA256 aa116daf44ae6496e606dc41081aab5503ae137dd666e96e1d0681c82a26cc4b
MD5 cddd9d8868c15db5f463575c77b9efea
BLAKE2b-256 7306f69d3c9a8399ba6abaa40aa190f7119145224c133b8e058a8da559223bfe

See more details on using hashes here.

File details

Details for the file midi_wrapper_SnooperXP-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: midi_wrapper_SnooperXP-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 5.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.0 setuptools/51.1.0 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.8.5

File hashes

Hashes for midi_wrapper_SnooperXP-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 de0c863a0a1d583daaf14ffebffd387183eded7295c809a5dddbc2b0b1f602b3
MD5 5b478d6127ab6a074ba9c5ae03d3d32f
BLAKE2b-256 f4f8bb61a31c5f87b46d163c7063ef3ace082a2fb04624476896bab673aa4cb6

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