Skip to content

MIDI play: device discovery + README setup guide - #11

Draft
endolith wants to merge 1 commit into
masterfrom
cursor/midi-play-docs-2589
Draft

endolith wants to merge 1 commit into
masterfrom
cursor/midi-play-docs-2589

Conversation

@endolith

Copy link
Copy Markdown
Owner

Summary

midi_play.py was hard‑wired to MIDI device id 3 and a name substring LoopBe, which breaks whenever driver order changes or you are not on Windows with LoopBe1. This branch documents the intended virtual‑cable → softsynth pipeline and selects the output device via a name scan or explicit environment variables.

Code (midi_play.py)

  • After midi.init(), resolve the PortMidi output device by:
    • JUST_INTONATION_MIDI_DEVICE_ID (integer), if set; or
    • first output whose name contains JUST_INTONATION_MIDI_OUT_NAME (default loopbe, case‑insensitive).
  • On failure, raise RuntimeError with every available MIDI output and ids so you can pin …_DEVICE_ID without guessing.
  • Decode bytes device names where pygame returns them.
  • pitch_bend(0, channel=0) when resetting bend (explicit value; matches Output.pitch_bend(self, value=0, channel=0)).
  • Trim unused imports; expand the module docstring to point at the README.

Documentation (README.md)

New “MIDI playback” section: signal path, why silence happens, pygame/numpy install, Windows (LoopBe1 / loopMIDI + DAW input), macOS (IAC + JUST_INTONATION_MIDI_OUT_NAME=IAC), Linux (ALSA / aconnect sketch), env vars, PM_RECOMMENDED_OUTPUT_DEVICE pointer, and default ±2 semitone pitch‑bend expectation.

Verification

  • pytest — 21 passed (unchanged test surface; midi_play is not imported by tests).
Open in Web Open in Cursor 

- midi_play: scan PortMidi outputs for JUST_INTONATION_MIDI_OUT_NAME
  (default loopbe) or honor JUST_INTONATION_MIDI_DEVICE_ID; raise a
  RuntimeError that lists available outputs on failure; decode bytes device
  names; fix pitch_bend reset to pass explicit value 0
- README: MIDI signal path, Windows LoopBe/loopMIDI, macOS IAC, Linux ALSA
  hints, env vars, pitch-bend synth expectations

Co-authored-by: endolith <endolith@gmail.com>
@cursor
cursor Bot force-pushed the cursor/midi-play-docs-2589 branch from 8e48fe7 to 4571bac Compare June 12, 2026 04:44

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants