{"id":15643663,"url":"https://github.com/patchworkboy/vcvrack_cablecontrol","last_synced_at":"2025-04-30T10:12:25.003Z","repository":{"id":147127701,"uuid":"571020315","full_name":"PatchworkBoy/VCVRack_CableControl","owner":"PatchworkBoy","description":"A virtual cable controller for VCVRack which requires nothing more than a Raspberry Pi Pico","archived":false,"fork":false,"pushed_at":"2022-11-29T00:08:42.000Z","size":1801,"stargazers_count":10,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-30T10:11:59.361Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PatchworkBoy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2022-11-26T22:22:51.000Z","updated_at":"2025-04-16T21:34:57.000Z","dependencies_parsed_at":"2023-05-14T03:45:26.256Z","dependency_job_id":null,"html_url":"https://github.com/PatchworkBoy/VCVRack_CableControl","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PatchworkBoy%2FVCVRack_CableControl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PatchworkBoy%2FVCVRack_CableControl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PatchworkBoy%2FVCVRack_CableControl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PatchworkBoy%2FVCVRack_CableControl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PatchworkBoy","download_url":"https://codeload.github.com/PatchworkBoy/VCVRack_CableControl/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251683355,"owners_count":21626953,"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":[],"created_at":"2024-10-03T12:00:46.542Z","updated_at":"2025-04-30T10:12:24.978Z","avatar_url":"https://github.com/PatchworkBoy.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# VCVRack CableControl\nA virtual cable controller for VCVRack which requires nothing more than a Raspberry Pi Pico (or other CircuitPython compatible Microcontroller). Written in CircuitPython. Provides 26x physical sockets which can be distributed as inputs or outputs via entries at lines 23 \u0026 27 of code.py, which are then remapped to MIDI CC gates (1-indexed sequentially, outputs then inputs). MIDI Output channel is set at end of line 17 (0-indexed in code, becomes 1-indexed in reality) \n\nUse with Stoermelder's (experimental) **VCVRack-PackTau** T7 modules which maps MIDI CC Gates to module i/o ports in VCVRack: https://github.com/stoermelder/vcvrack-packtau\n\n* GPIO2-14 are (potentially stackable) outputs mapped to MIDI CC1-13 Ch1\n* GPIO15-27 are (non-stackable) inputs mapped to MIDI CC14-26 Ch1\n* When outputs are shorted to inputs, the matching pair of MIDI CC transmit\nlevel 127.\n* When disconnected, the matching pair transmit level 0\n* Pack-Tau T7-CTRL/T7-MIDI translate the pairs of MIDI CC Gates into a cable link between ports mapped to those CCs via a JSON file loaded into T7-CTRL module (see examples/ folder)\n\nTo make a physical patch bay: Attach tip connector of 3.5mm socket to each GPIO pin. Short with mono 3.5mm patch leads. Done!\n\nGPIO0 \u0026 1 are skipped as I intend to use these for i2c expansion (see further down this file)\n\n**What's happening on the Pico:** ALL GPIO PINS are set as input with pull-up, defaulting high in the code. GPIO Pins 2 thru 14 are switched to outputs one at a time and pulled low and then GPIO Pins 15 thru 27 are sequentially scanned for any now pulled low (linked). Their state is compared against a statematrix dictionary object - if the state differs, the relevant MIDI CC codes are sent to reflect the change - then the statematrix updated to store the latest current (inverted) state. The current GPIO Output is then switched back to a pulled-up input before moving on to the next output pin. \n\nThis prevents any pair of pins being set as an Output simultaneously, as a short between two pins set as Outputs would damage the Pico without additional hardware protection. This scanning process runs in a continuous loop. A full sweep of the matrix takes around 80ms iirc so that's your rough max latency.\n\n![PiPico GPIO Pins](https://cdn-learn.adafruit.com/assets/assets/000/099/339/large1024/raspberry_pi_Pico-R3-Pinout-narrow.png)\n\nIf running multiple Picos as the code stands, change MIDI channel in code at line 17 so each Pico outputs on it's own channel (or rewrite the code to remap the ccs from a higher start point to not conflict with an existing Pico on same MIDI Channel), but **don't link across Picos because that isn't handled** and will make a mess (input-bearing Pico will think an input is linked to EVERY output on itself), especially as you now have a situation where an output per Pico may be active *simultaneously*, which could cause Physical Damage if linked **(so definitely don't link outputs of one Pico to outputs of another Pico or you'll risk popping them both)**\n\n## Usage Example\n\n![Image of PiPico with screenshot of VCV Rack Example](https://github.com/PatchworkBoy/VCVRack_CableControl/raw/main/media/demo.jpg)\n\n* Grab Pack-Tau (https://github.com/stoermelder/vcvrack-packtau/releases) and manually install.\n* Copy code.py \u0026 lib/ folder to Pi Pico running CircuitPython\n* Open examples/t7-ctrl_example.vcv in VCVRack (requires Pack-Tau, BogAudio, Instruo \u0026 VCV Fundamentals) - this file maps 24 of the available sockets to MIDI CCs...\n* Short any of GPIO2-13 to GPIO15-26. **Be careful NOT to inadvertently short to RUN or GND, which will crash the Pico (no damage) - unplug / replug to restart it, but statematrix will now have reset to 0 everywhere, so your links will be out of sync - unplug/replug one end of each link to get state back in sync**. MIDI CC13 \u0026 26 (GPIO14 \u0026 27) aren't mapped in the example json file. 12x output, 12x input. Add them for 13x of each (26 sockets).\n\nTo load a custom map, click ports on your modules and watch the T7-Assistant module. Note the moduleId and portId (you can highlight and copy them from the T7-Assistant display) \n\n![T7-ASSISTANT](https://github.com/PatchworkBoy/VCVRack_CableControl/raw/main/media/t7-assistant.jpg)\n\nOpen examples/t7-ctrl_blank.json in a text editor. Add/paste the relevant moduleId and PortId (pay attention to the portType in the JSON file - output portIds for output port types, input portIds for input port types) to the CC to be mapped to that port. This maps to the equivalent GPIO pin [CC + 1].\n\n![codeblock](https://github.com/PatchworkBoy/VCVRack_CableControl/raw/main/media/codeblock.jpg)\n\n![completed codeblock](https://github.com/PatchworkBoy/VCVRack_CableControl/raw/main/media/completedblock.jpg)\n\nOnce you've got that done for all the ports in the file (or removed unmapped entries), select all \u003e copy. Right click T7-Ctrl module \u003e Paste JSON Mapping. (This gets stored in the VCVRack file on save)\n\n![Context Menu of T7-CTRL](https://github.com/PatchworkBoy/VCVRack_CableControl/raw/main/media/copy_paste_json.jpg)\n\n**NOTE: T7-MIDI module MUST be adjacent to the right of the T7-CTRL module for MIDI commands to be transmitted from T7-MIDI to T7-CTRL. Select the PiPico midi device in T7-MIDI. For multiple Picos, just add more T7-MIDI modules to the right. All the mapping goes into the single T7-CTRL instance**\n\nNow start shorting your Pins (or if you've added sockets etc, patching your cables) and watch cables appear onscreen between the mapped ports, and disappear when you unshort.\n\n## Expansion\nMCP23017 modules over i2c provide additional banks of 16 digital GPIO at a time, so can be used [raw](https://www.adafruit.com/product/732) or [in HAT format](https://thepihut.com/products/modmypi-mcp23017-phat-16-channel-io-expansion-zero) (and just link the i2c / power / gnd pins up). Up to 8 can be added to get a total 156 physical sockets (or combination of sockets, buttons \u0026 switches) on one Pico. [Adafruit provide a library for CircuitPython](https://learn.adafruit.com/using-mcp23008-mcp23017-with-circuitpython), which would make this the easiest way to expand the code also. Same applies for banks of [ADS1115/1015 modules](https://learn.adafruit.com/adafruit-4-channel-adc-breakouts) to add 4x channels of ADC for sliders \u0026 potentiometers per module. BUT, time to loop over the matrix increases so latency *may* creep up.\n\nI'll look into these at somepoint when I'm not so broke... one step at a time. But that should be enough to shove folk in the right direction to investigate for yourselves (plus I have no shortage of knobs \u0026 sliders in my setup already - BCR2000 \u0026 BCF2000 fulfil that remit for now).\n\n### References: \n* Initial software concept at https://community.vcvrack.com/t/module-to-connect-disconnect-rack-cables-over-midi/9101 - thanks to the fabulous [Stoermelder](https://github.com/stoermelder), [Ligant](https://community.vcvrack.com/u/ligant/summary), and [MudJakub (MidiLar)](https://community.vcvrack.com/u/mudjakub/summary) o'er at VCV communities forum.\n* [MudJakub (MidiLar)](https://community.vcvrack.com/u/mudjakub/summary) - Excellent hardware implementation whose video got me investigating in the first place - https://midilar-controller.webnode.sk/midilar-knots/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpatchworkboy%2Fvcvrack_cablecontrol","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpatchworkboy%2Fvcvrack_cablecontrol","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpatchworkboy%2Fvcvrack_cablecontrol/lists"}