Looking to replace midiInputPorts node in settings.json from command line

I want to swap out my midiInputPorts node in settings.json with a code snippet that has an alternative by running a script from the Windows command line. I have several questions:

  1. Is there a way to do this while Cantabile is running and have it refresh? I suspect I have to restart Cantabile but figured I would ask.
  2. Does Cantabile have an API for stuff like this?

I’m using NotePad++ and node.js

Would developers use regex to perform a node replacement?

Thanks

You can use a startup param to have C3 use different config files. No scripting or Regedit needed.

1 Like

Good idea, I have the link Brad supplied for startup parameters. I’ll do that. Would still like to know if I can do it from inside Cantabile while it’s running.

Cantabile only reads the settings file on startup - so yes, restart would be needed.

Not for that kind of thing. There’s the network API but it’s mostly about building remote controllers.

That said, if you’re using node.js you should be able to adjust the settings.json file rather easily. It’s standard JSON so you should be able to load it with fs.readFileSync(), parse it with JSON.parse, make your changes to the returned object and save it out again with fs.writeFileSync() and JSON.stringify().

[Disclaimer: untested, but should work]

Hi Brad,

I did delve into the C3 shortcut parameters. I created a second one for live and third one for practice/development.

I still want to change just the midiInputPorts. I like using situations like this to learn coding. I’m swapping my identical Axiom 61’s because Windows keeps reversing them. “Axiom Upper” should be “0: USB Axiom 61” and “Axiom Lower” should be “0: USB Axiom 61 #2”. Editing settings.json in Notepad++ worked so next step is node.js, I’ll report back how it works.

BTW, this problem is self inflicted - it only swaps if the machine goes to sleep with C3 running which is something I only do when practicing.

Yeah, this is part of the unfriendly way Windoze handles MIDI ports, especially with the same driver. Another idea is to abstract each kb into a rack. That way you can switch upper/lower as a rack setting. Just make sure the Song level doesn’t know about it. Then you can use Rack States to configure which kb is which.

2 Likes

Another good idea! I’m going to try the Rack States method next. Implementing the shortcut parameters was a good learning session because I recreated my setup twice which is a good exercise. When you have been slowly tweaking your setup over time you don’t really know by heart what you’ve got. I recommend people who are relatively new to Cantabile to build two new configs via the shortcut. I spent some time “re-figuring out” what I had.

A while back I installed Dropbox and put a folder in it called Music and put folders Cantabile and Documents under it. The Cantabile folder just has the C3 config stuff.

The Documents folder also has a Cantabile folder under it with folders Media, Presets and Banks, Rack Files, Recordings, Set List Files and Song Files. I then went into Tools > Options > File Locations and pointed everything to the new locations

image

I also made a non Dropbox folder named C:\Music that has folders Plugins (with sub-folders VST64 and VST32 and underneath those by vendor) and Samples with sub-folders organized by vendor.

I have two laptops, a live machine and a practice one. I try to only make changes on the practice laptop and let Dropbox sync the changes to the live laptop. On a night I’m going to play live I connect the Live laptop via USB and step through all the songs and states.

I use Beyond Compare to Sync the C:\Music\Sample Library folders if I’ve added a sample library but I manually install new or updated VST plugins.

I’m putting all this out there for people who’ve been thinking about re-organizing Cantabile and also for the chance that someone might point out something I’m doing that could be a problem.

1 Like

Any reason you just couldn’t have split the two Axioms by having them transmit on differrent MIDI channels? Have one transmitting on say 1-4 and the other one on 5-8.
Then merge both Axiom MIDI inputs into single (virtual) MIDI input in Cantabile settings and since then you don’t care which midi port they get assigned by windows.

Hi Pavel,

Thanks for the suggestion. Originally I was trying to use the Axioms without programming the controllers themselves. I got pretty far with that by using Cantabile bindings but then I ran into a few situations where I realized I needed to program the keyboard itself so your suggestion fits my current approach. Right now I’m setting the Axioms to Omni so I don’t have to reprogram (on the controller itself) the 8 pads which default to channel 10. I just started using pads for - song, + song, - part, + part, play/pause, stop, live, panic and ones to bring up the VB3 and Amplitube GUIs.

TBH, I’d use a brute force solution: get a cheap 2-port USB MIDI interface and attach the two Axioms via classic DIN cables. Use different color cables and color label the MIDI ports on the MIDI interface and on your keyboards. Now you always have the lower Axiom und MIDI Port 1 and the upper one on Port 2. Problem solved without coding :nerd_face:

Don’t get me wrong: I love to code - but I wouldn’t waste my coding time on something as frustrating as this…

Cheers,

Torsten

1 Like

I have a midisport 2x2, I’ll try that. Learning to swap out json objects would be good to know though…