{"id":15148621,"url":"https://github.com/morgant/midisndiokontrol","last_synced_at":"2025-07-18T05:08:38.998Z","repository":{"id":228266585,"uuid":"773523296","full_name":"morgant/midisndiokontrol","owner":"morgant","description":"WIP utility to control `sndio` audio levels \u0026 multimedia applications under OpenBSD (currently specific to the Korg nanoKONTROL2)","archived":false,"fork":false,"pushed_at":"2024-04-16T17:10:28.000Z","size":7,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-07-11T23:48:56.424Z","etag":null,"topics":["midi","midi-controller","openbsd","openbsd-scripts","sndio","sndiod","x11","x11-automation","xdotool"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/morgant.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-03-17T22:05:09.000Z","updated_at":"2024-10-29T18:42:52.000Z","dependencies_parsed_at":"2024-10-10T02:50:31.581Z","dependency_job_id":null,"html_url":"https://github.com/morgant/midisndiokontrol","commit_stats":{"total_commits":10,"total_committers":1,"mean_commits":10.0,"dds":0.0,"last_synced_commit":"7d3c1f857adeaad791492c5fd65c5b13bfafba42"},"previous_names":["morgant/midisndiokontrol"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/morgant/midisndiokontrol","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morgant%2Fmidisndiokontrol","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morgant%2Fmidisndiokontrol/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morgant%2Fmidisndiokontrol/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morgant%2Fmidisndiokontrol/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/morgant","download_url":"https://codeload.github.com/morgant/midisndiokontrol/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morgant%2Fmidisndiokontrol/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265703621,"owners_count":23814042,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["midi","midi-controller","openbsd","openbsd-scripts","sndio","sndiod","x11","x11-automation","xdotool"],"created_at":"2024-09-26T13:21:11.414Z","updated_at":"2025-07-18T05:08:38.971Z","avatar_url":"https://github.com/morgant.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# midisndiokontrol\nby Morgan Aldridge \u003cmorgant@makkintosshu.com\u003e\n\n## OVERVIEW\n\nA WIP (work in progress) utility that lets you control [sndio](https://sndio.org/) devices \u0026 state, plus X11 media applications, under [OpenBSD](https://www.openbsd.org/) using a MIDI control surface. It's currently being developed \u0026 tested with a [Korg nanoKONTROL2](https://www.korg.com/us/products/computergear/nanokontrol2/) (hence 'kontrol' in the name), but I plan to make it much more generic and configurable. It is currently just a wrapper around OpenBSD's [midicat(1)](http://man.openbsd.org/midicat), [sndioctl(1)](http://man.openbsd.org/sndioctl), [xdotool(1)](https://github.com/jordansissel/xdotool), but I expect to rewrite it in C once I have stabilized the concept more, for performance reasons.\n\n*IMPORTANT:* _I am not a regular user of MIDI devices, nor have I delved into the spec yet, so I'm likely using incorrect terminology at this point. Please feel free to suggest corrections/improvements.\"_\n\n## FEATURES\n\n### CURRENT\n\n`midisndiokontrol` can currently handle MIDI CONTROL CHANGE \"Expression\" (CC11) messages from the Korg nanoKONTROL2 and trigger:\n\n* X11 key, keyup, or keydown events for various standard `XF86Audio*` media keys (via `xdotool`)\n* Set, unset, or toggle mute for `sndio` devices (via `sndioctl`)\n* Set a knob/slider value as the level for a `sndio` input, output, or application device (via `sndioctl`)\n\nThe script is currently relatively straightforward to modify for your specific MIDI input device, `sndio` devices, and X11 applications. I suggest:\n\n1. Run `midicat -d -q midi/\u003cdevice_num\u003e`\n2. Press a key on your MIDI input device\n3. Look at the 2nd column of hex output in the output of Step 1 to determine the key hex code\n4. Edit the appropriate `key_*` variable content and set it to the hex code you identified\n5. Update the `\"$key_*\")` handler in the `case` statement for the appropriate key to perform the action you'd like\n6. Go to Step 2 and repeat until you've updated as you see fit\n\n### PLANNED\n\n* Rewrite in Perl\n* Make more configurable, especially the following for any MIDI key input:\n    * MIDI key hex ID\n    * Event type (i.e. \"key\", \"down\", \"up\", \"value\")\n    * Action type (i.e. `xdotool`, `sndioctl`, etc.)\n    * Action parameters (e.g. `key \u003cname\u003e`, `keydown \u003cname\u003e`, `keyup \u003cname\u003e` for `xdotool` or `\u003cdevice\u003e.level=\u003cvalue\u003e` or `\u003cdevice\u003e.mute=\u003cvalue\u003e` for `sndioctl`)\n* Add support for panning audio in sndioctl(1) by calculating/adjusting the individual levels for stereo devices (e.g. `sndioctl -i \u003cdevice\u003e.level[0]=\u003cvalue_left\u003e \u003cdevice\u003e.level[1]=\u003cvalue_right\u003e`; with the device 'level' assumed to equal 'level[0] + level[1]' if 'level[0]' != 'level[1]')\n* Monitor `sndioctl -m` output for device value state changes and send MIDI commands to control surface to illuminate buttons, as appropriate (e.g. on Korg nanoKONTROL2, when LEDs set to 'external': illuminate 'play' button when playing and maybe pulse/flash when paused, illuminate fast-forward/rewind buttons while depressed, illuminate 'mute' buttons for individual input/output devices when they are muted, etc.)\n* Create defaults for various devices\n* Rewrite in C for increased performance\n* Port to other platforms which support sndio\n\n## PREREQUISITES\n\n* [OpenBSD](https://www.openbsd.org/)\n* A MIDI device\n* [xdotool](https://github.com/jordansissel/xdotool)\n\n## USAGE\n\n1. Install `xdotool`:\n    `doas pkg_add xdotool`\n2. Connect your MIDI device\n3. Either use midicat(1) to send your MIDI device's input to `midithru/0` as follows, or update the `midisndiokontrol` script to specify the specific MIDI device to use:\n    `midicat -q midi/0 -q midithru/0 \u0026`\n4. Execute `midisndiokontrol` to start it processing MIDI events and triggering `sndioctl` changes or `xdotool` keyboard input events\n\n## SIMILAR UTILITIES\n\nYou might want to check out these similar projects for controlling OpenBSD's sndiod(8) from X11:\n\n* [sndiokeys](https://github.com/ratchov/sndiokeys)\n* [xsndiomenu](https://github.com/morgant/xsndiomenu)\n\n## RESOURCES\n\n* [MIDI](https://en.wikipedia.org/w/index.php?title=MIDI)\n* [MIDI CC Lists \u0026 Explanations](https://nickfever.com/music/midi-cc-list)\n\n## LICENSE\n\nReleased under the [MIT license](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmorgant%2Fmidisndiokontrol","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmorgant%2Fmidisndiokontrol","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmorgant%2Fmidisndiokontrol/lists"}