Skip to content

Add option to suppress verbose midi conversion output - #9

Open
ohag487 wants to merge 1 commit into
ohollo:masterfrom
ohag487:suppress-midi-conversion-output
Open

ohag487 wants to merge 1 commit into
ohollo:masterfrom
ohag487:suppress-midi-conversion-output

Conversation

@ohag487

@ohag487 ohag487 commented Aug 29, 2026

Copy link
Copy Markdown

Summary

  • Converting a midi file to wav via Timidity (midi_to_wav in chord_extractor/converters.py) previously always let Timidity's console output through unfiltered. Timidity writes fairly verbose diagnostic info about the midi file's internals (e.g. track/lyric/text events) to stderr, which was not being captured or suppressible, so it prints straight to the console during conversion.
  • Adds an opt-in suppress_output parameter to midi_to_wav, which redirects Timidity's stderr to DEVNULL when set.
  • Threads this through as suppress_midi_output on ChordExtractor.__init__ (used in preprocess) and Chordino.__init__, so callers can do Chordino(suppress_midi_output=True) to silence the conversion noise.
  • Default behaviour is unchanged (suppress_midi_output=False) to avoid any breaking change for existing consumers.
  • Updated docstrings and README with a short usage note.

Test plan

  • Added tests/test_converters.py covering that suppress_output=True passes stderr=DEVNULL to the Timidity subprocess call, and that the default leaves stderr untouched (mocks subprocess.run, so no Timidity binary needed).
  • python -m pytest tests/test_converters.py -v
  • flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics (no new issues; also fixed a pre-existing long-line warning on the touched line)
  • Existing tests/test_chordino.py::test_extract_many (requires Timidity binary + Chordino native lib, not available in this sandbox — behavior unaffected since new option defaults to off)

🤖 Generated with Claude Code

Timidity prints verbose console output (internal midi details such as
lyrics/text events) to stderr while converting midi to wav, which was
previously not capturable. Adds a suppress_midi_output option on
ChordExtractor/Chordino (and suppress_output on midi_to_wav) to silence
this via stderr redirection.
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.

1 participant