### Set up development environment Source: https://github.com/acscpt/montyroll/blob/develop/docs/install.md Creates a virtual environment and installs the `dev` extra for testing and linting. Runs the full test suite with coverage and the linter; pytest writes to tests/TEST_REPORT.md and ruff prints 'All checks passed!' on a clean tree. ```bash python3 -m venv .venv .venv/bin/pip install -e ".[dev]" .venv/bin/pytest # the whole suite, with coverage .venv/bin/ruff check montyroll tests # the linter ``` -------------------------------- ### Copy Melodius and start the X16 emulator Source: https://github.com/acscpt/montyroll/blob/develop/docs/examples/x16-zsm.md Copies the Melodius player into the demo directory and launches the emulator with that directory as the file-system root, running the player program. ```bash cp /path/to/MELODIUS.PRG ~/x16-demo/ x16emu -fsroot ~/x16-demo -prg ~/x16-demo/MELODIUS.PRG -run ``` -------------------------------- ### Install MontyRoll from PyPI Source: https://github.com/acscpt/montyroll/blob/develop/docs/install.md Installs the release, providing a `montyroll` command usable from any directory. The demo file is not included; download it or use any MIDI file. On externally-managed environments, use pipx instead. ```bash pip install montyroll montyroll path/to/file.mid ``` -------------------------------- ### Run MontyRoll from a clone Source: https://github.com/acscpt/montyroll/blob/develop/docs/install.md Clones the repository and runs MontyRoll on the demo file. The window opens with four channel rows, piano roll, and inspector; any MIDI file can be used, and no path starts an empty song. ```bash git clone https://github.com/acscpt/montyroll.git cd montyroll python3 -m montyroll resources/chopsticks.mid ``` -------------------------------- ### Install TiMidity++ on Debian/Ubuntu Source: https://github.com/acscpt/montyroll/blob/develop/README.md Install the recommended MIDI synthesizer for MontyRoll playback. Requires sudo privileges. ```bash sudo apt install timidity ``` -------------------------------- ### Set up working directory and open demo MIDI Source: https://github.com/acscpt/montyroll/blob/develop/docs/examples/x16-zsm.md Creates a working directory, copies the demo MIDI file, and launches MontyRoll on it. The emulator later reads the same directory as its disk. ```bash mkdir ~/x16-demo cp resources/chopsticks.mid ~/x16-demo/ python3 -m montyroll ~/x16-demo/chopsticks.mid ``` -------------------------------- ### Install montyroll from PyPI Source: https://github.com/acscpt/montyroll/blob/develop/README.md Install the application from PyPI using pip or pipx. pipx is recommended for systems where pip cannot install into the system Python. The package has no dependencies, but tkinter and a synth for sound are not provided by pip. ```bash pip install montyroll # or: pipx install montyroll ``` -------------------------------- ### Run tests with virtual display Source: https://github.com/acscpt/montyroll/blob/develop/docs/install.md Runs the test suite under xvfb-run for headless machines, as CI does. The tests open real Tk windows, so a display is required. ```bash xvfb-run -a .venv/bin/pytest ``` -------------------------------- ### Run montyroll with a MIDI file Source: https://github.com/acscpt/montyroll/blob/develop/README.md Run montyroll with a MIDI file. Use the installed command from PyPI or the module form from a clone. The demo file is resources/chopsticks.mid in the clone. Running with no file starts empty. ```bash montyroll path/to/file.mid # installed from PyPI python3 -m montyroll path/to/file.mid # from a clone python3 -m montyroll resources/chopsticks.mid # the demo, in the clone ``` -------------------------------- ### Install FluidSynth General MIDI Soundfont Source: https://github.com/acscpt/montyroll/blob/develop/docs/troubleshooting.md If FluidSynth is installed but the dialog still appears, install the General MIDI soundfont. MontyRoll looks for soundfonts in /usr/share/sounds/sf2, /usr/share/soundfonts, and /usr/local/share/soundfonts. ```bash sudo apt install fluid-soundfont-gm ``` -------------------------------- ### Toolbar summary for chopsticks.mid Source: https://github.com/acscpt/montyroll/blob/develop/docs/examples/x16-zsm.md Shows the file summary displayed in the toolbar after opening the demo: format, track count, tempo, time signature, note count, duration, and key. ```text chopsticks.mid fmt 1 | 5 trk | 480 tpq | 3/4 | 150 bpm | 371 notes | 38.6s | C major ``` -------------------------------- ### Install FluidSynth and General MIDI Soundfont on Debian/Ubuntu Source: https://github.com/acscpt/montyroll/blob/develop/README.md Install FluidSynth and the General MIDI soundfont required for playback. The soundfont must be in /usr/share/sounds/sf2, /usr/share/soundfonts, or /usr/local/share/soundfonts. ```bash sudo apt install fluidsynth fluid-soundfont-gm ``` -------------------------------- ### Check Python and tkinter versions Source: https://github.com/acscpt/montyroll/blob/develop/docs/install.md Verifies Python 3.10+ and tkinter availability. The second command reports the Tk version; if it fails with 'No module named tkinter', install python3-tk. ```bash python3 --version # 3.10 or later python3 -c "import tkinter; print(tkinter.TkVersion)" # the Tk version, such as 8.6 ``` -------------------------------- ### Example .monty plan file with YM2151 and PSG tiers Source: https://github.com/acscpt/montyroll/blob/develop/docs/reference.md A complete plan file in JSON with the .monty suffix. It defines two tiers (opm and psg), two pools (melody and rest), channel priorities and releases, a MIDI file reference, an export target mapping, and an export range from bar 9 to 40 with a loop back to bar 9. Channel numbers run from 1 to 16. ```json { "version": 1, "tiers": [ { "name": "opm", "capacity": 8, "reserved": 0, "release": 150.0, "chip": "opm" }, { "name": "psg", "capacity": 16, "reserved": 4, "release": 0.0, "chip": "psg" } ], "pools": [ { "name": "melody", "tier": "opm", "voices": 6, "channels": [ 1, 2 ], "dedupUnison": true, "dedupOctave": false, "tremoloGap": 0, "legatoGap": 0, "monoTop": false, "maxChord": 0 }, { "name": "rest", "tier": "psg", "voices": 10, "channels": [ 3, 4 ], "dedupUnison": true, "dedupOctave": false, "tremoloGap": 4, "legatoGap": 8, "monoTop": false, "maxChord": 0 } ], "priority": { "1": 2.0 }, "release": { "2": 40.0 }, "midiFile": "song.mid", "targets": { "zsm": { "sounds": { "melody": "strings" } } }, "range": { "start": 9, "end": 40, "loop": 9 } } ``` -------------------------------- ### Open the demo file with montyroll Source: https://github.com/acscpt/montyroll/blob/develop/docs/quickstart.md Run this command from the cloned repository to open the demo file `resources/chopsticks.mid` in MontyRoll. The window opens with channels on the left, piano roll in the middle, and inspector on the right. ```bash cd montyroll python3 -m montyroll resources/chopsticks.mid ``` -------------------------------- ### Install MontyRoll with pipx Source: https://github.com/acscpt/montyroll/blob/develop/docs/troubleshooting.md Use when pip refuses to install due to externally-managed-environment. pipx gives MontyRoll its own environment. ```bash pipx install montyroll ``` -------------------------------- ### Install tkinter on Debian/Ubuntu Source: https://github.com/acscpt/montyroll/blob/develop/docs/troubleshooting.md Use when Python is installed but tkinter is missing, causing ModuleNotFoundError. On Debian or Ubuntu, install the python3-tk package. ```bash sudo apt install python3-tk ``` -------------------------------- ### Export summary output Source: https://github.com/acscpt/montyroll/blob/develop/docs/examples/x16-zsm.md Shown in the status bar after exporting the ZSM file. Reports file size, bank count, duration, peak voice usage, note count, and the result of the post-write checks. ```text 3 KB, 1 banks, 39 s, peak 5 OPM and 1 PSG voices, 279 notes, no problems ``` -------------------------------- ### Check first four bytes of a MIDI file Source: https://github.com/acscpt/montyroll/blob/develop/docs/troubleshooting.md Use to verify if a file is a Standard MIDI File by checking the first four bytes. A Standard MIDI File starts with 'MThd'. ```bash head -c 4 file.mid ``` -------------------------------- ### Reduction result label output Source: https://github.com/acscpt/montyroll/blob/develop/docs/quickstart.md Shown after reducing to four voices. The first line counts kept notes, cuts, tails clipped, and loss; the second line gives reasons for dropped notes: `no voice` and `unison`. ```text kept 292 of 371 notes, 0 cut, 0 tails clipped, loss 9,328 48 no voice, 31 unison ``` -------------------------------- ### Clone montyroll repository Source: https://github.com/acscpt/montyroll/blob/develop/README.md Clone the repository from GitHub to obtain the demo file and documentation. ```bash git clone https://github.com/acscpt/montyroll.git cd montyroll ``` -------------------------------- ### Grep commands to list code sources Source: https://github.com/acscpt/montyroll/blob/develop/docs/reference.md These bash commands print the lists that the tables are drawn from. Each grep searches for specific patterns in the source files. ```bash grep -nE 'add_command(label=' montyroll/app.py ``` ```bash grep -nE 'self.bind("<' montyroll/app.py ``` ```bash grep -nE 'from_=|^MAX_EVENT_ROWS|^SNAP_CHOICES' montyroll/app.py ``` ```bash grep -n 'def findPlayer' -A 30 montyroll/player.py ``` -------------------------------- ### Open a MIDI file from the shell Source: https://github.com/acscpt/montyroll/blob/develop/docs/usage.md Run MontyRoll from the command line with the path to a MIDI file. The file is loaded and displayed in the main window. ```bash python3 -m montyroll path/to/file.mid ``` -------------------------------- ### Python commands to print export and reduce data Source: https://github.com/acscpt/montyroll/blob/develop/docs/reference.md These Python one-liners print data from the montyroll package: export target details, patch and sound mappings, and a plan dictionary. ```python python3 -c "from montyroll import export; t = export.TARGETS['zsm']; print(t.NAME, t.SUFFIX, t.FRAME_RATE, t.CHIPS, t.SOUNDS)" ``` ```python python3 -c "from montyroll.export import zsm; print([(p, zsm.patchFor(p), zsm.psgSoundFor(p)) for p in range(128)])" ``` ```python python3 -c "from montyroll import reduce; print(reduce.planToDict(reduce.Plan()))" ```