Puzzling through how to modify and manage Snapshots through the WebUI

Hey everyone. I am trying to get moving forward again on furthering my understanding and efficiency with the Zynthian. In the course of working on a driver to better integrate my MPK249 into a Zynthian workflow, I came across a curious behavior that I didn’t initially understand.

I was finding that the controls on my keyboard were sometimes mapping to the intended chains on Zynthian….and other times not. I saw patterns…and then I would come back another day…and it would be behaving differently.

The missing part of the puzzle here is that I had also recently started playing with the Snapshots section of the Zynthian’s WebUI. Having created a bunch of different snapshots (inexpertly, of course), I was browsing through them…and I noticed that I had some chains that didn’t actually serve a purpose in the snapshots, as I was using them.

I thought that the WebUI seemed like a much quicker and simpler way to edit them. “How handy that the chains have little trash can icons by them! I can just delete all of the unused ones in a matter of seconds. Boom!”

Some of you may have figured out the problem with this approach…particularly with regard to controlling Zynthian from an external control mechanism. The problem is that Zynthian will happily delete a chain for you, but it does not renumber them. When you go to use these on your Zynthian, they appear as most would probably desire, with all remaining chains in the mixer….and no visible indication that anything is “missing”.

Return to me getting erratic results from my MPK249 driver/controls. It turns out that the controls were operating on exactly the right chain (from the point of view of how they were internally numbered in the snapshot on the Zynthian). So, when I was on an unmodified snapshot, everything worked exactly as intended, but when I was using a snapshot where one of the chains was removed from the sequence….the confusion would begin.

I’m left with several related questions:

  • Is there is an easy solution to this problem on existing snapshots?
  • Does this also happen if I delete a chain from the Zynthian’s own interface, or does it operate differently?
  • What best practices can I follow to avoid this problem in the future (preferably not just “never delete a chain after you have constructed a snapshot” )?

Fast-forward to me realizing that I can download these snapshot files, which are apparently JSON files…and upload them back. I thought I was having a lightbulb moment… I would download the offending files, do some editing of the chain numbers….save, upload…boom!

I ran into several obstacles here, and I presently remain stuck. First, despite having a very basic understanding of what JSON files are, I had never spent a lot of time trying to learn how to work with them. I was not having luck figuring out how to get VScode to handle the files as JSON files. So, I went in search of a different tool.

I installed something called json-tool, which helped me with being able to format the long string of text into something more readable…and edit it. I created a new file…attempted to upload it….and…I cannot tell that anything has happened at all. I don’t see any change in the selected snapshot. I don’t see a new snapshot that this upload was assigned to. After I click that upload button, I just go back to the same screen that I came from before I opened the upload dialog, without any indicator of a change. Finally, I thought….maybe the upload worked, but I need to refresh the page. None of this worked.

I am grateful for any help in this matter….whether it is helping me understand a mistake that I made…pointing me to solutions that work better than this…or maybe this is a bug/unintended behavior that can be fixed easily?

Thank you.

First, vscode supports JSON files. You just need to associate the file extent. I’m not home now so can’t say how to do it but just google it.

Next, it sounds like you are using the chain_id in your driver and assuming it will be contiguous and ordered. This is not true. The chain_id is an arbitrary uid which does not change if the chain is moved or other chains are added or removed. Use the helper functions to get the ordered list. In Oram, we hide non-MIDI chains from hardware launcher buttons but that is confusing and we are changing that in the next development cycle.

1 Like

They can be rather picky about files and separators, and disappointingly don’t support any element of comment.

You don’t mention which particular branch of zynthian you are on, and as this is an area of development that has been moving apace, with good things to see (literally!) we could well have some overall concencus in this area. This of course means that some of the cutting edge implementations are changeable and if you are performing regular updates you could be undergoing the shifting sands of development.

Consistency of action is an essential part of a musical instrument so a well stated description is of great value, and we do try to offer tools to support this.
The workflow option in the GUI ( https://wiki.zynthian.org/index.php/Zynthian_UI_User’s_Guide\_-\_Oram#Learning_Pills ) is an excellent tool for recording GUI actions for demonstrating issues, and it has the advantage that it allows demonstration of issues within the workflow.
It’s rather easier in comparison to detailed typing of descriptions.