MNodes needs patch management!

Hi Danny,

I didn’t go into any technical aspects in my post because I wasn’t sure if that would be of interest to the developer or other readers.

However, since you have clearly given this topic a lot of thought, I’d like to take the opportunity to outline some of my own considerations here.

You have a very robust and pragmatic approach regarding file-based storage for MNode patches.

That said, I would like to raise a few points for consideration in this context:

  • I assume MNodes utilizes a modern container-based multitasking/multithreading architecture.
  • I also assume the software was developed within a framework (I suspect it’s JUCE).
  • This means the actual application runs within the framework and its corresponding containers, creating a layer of encapsulation from the operating environment.
  • If MNodes is used as a plugin, the entire application container runs inside yet another container provided by the DAW for plugins. This results in further isolation from the environment.
  • Finally, at the end of the chain, there is the operating system, which performs the actual read/write operations at the file level. For this to work, the application requires specific permissions within the OS (which is by no means a given, as this creates a significant vulnerability for malware and exploits).
  • Consequently, a read or write access request for a file on disk would have to be initiated by the application → pass through the framework containers → traverse the DAW’s plugin container → have the DAW forward the request to the host operating system → and the OS would then have to be willing to execute it in the first place.
  • Furthermore, it is worth noting that file system access always represents a bottleneck in an application. Such access is thousands of times slower than accessing a cache or heap within RAM.
  • In a modern application, performance relies heavily on intelligent multithreading—that is, the parallel execution of various program tasks. This only works if the threads communicate seamlessly with one another. Otherwise, all active threads would be forced to wait for a single slow thread whenever it performs a disk access operation. This would almost certainly drag down the performance of the entire application.
  • I am not familiar with the specific framework used for MNodes, but the process described above is more or less standard across modern software architectures.
  • If I understand you correctly, your approach involves creating an XML file on disk for each patch and mapping the patch categorization to a folder structure.
  • This is where the aforementioned problems would become significant issues; simply building the GUI component to list the patches would require a disk access operation for every single patch. Then there is the issue of access rights if the application needs to navigate through folder structures (try doing that on Linux, or on a properly configured Windows or macOS system… :open_mouth:).

Of course, this is all very technical stuff and doesn’t change your fundamental concept, which I think is excellent.

However, I would suggest an implementation along these lines:

  • When the patch management function is invoked, a recursive for-each-loop traverses the application’s entire DOM (the hierarchical structure organizing the application’s individual objects - usually a tree or graph structure).
  • Whenever the algorithm encounters a persistence component (i.e., a control element holding a value), it appends that specific persistent value - and nothing else - to a dynamic data structure (such as a JSON object) in the form of a tuple (a value pair consisting of the object ID and the persistence value).
  • Storing the object ID ensures that, when such a patch is loaded, the values ​​always end up in the correct control. This is crucial when an application is being further developed and controls are added or deleted. If a simple list of values ​​were used instead, incorrect assignments would occur whenever the object structure changed.
  • In principle, the same recursive algorithm could be used to load a patch, except that the corresponding persistence values ​​are transferred into the objects rather than being read out.
  • This would therefore be the equivalent of your XML files.
  • If one were to add an attribute to this data structure - which contains all of a patch’s values - that specifies the patch category (Pad, Lead, Bass, etc.), then this would correspond to the folder-based organization you envisioned. Furthermore, additional features (such as patch ratings) would simply be another attribute within that data structure :hugs: .
  • And all of this remains entirely under the application’s control, avoiding costly disk access operations.
  • The individual patch data structures could be stored in a file-based database. Such functionality is often built into frameworks anyway. If not, there are excellent alternatives like SQLite or MongoDB that don’t require a dedicated database server.
  • This would reduce the entire process to a single disk access. By employing a smart caching algorithm, the number of actual physical access operations could be reduced even further.

I suspect the States-module operates based on this very principle.
Achieving this kind of functionality might actually require only a relatively minor modification.
Of course, you’d need a suitably enhanced GUI element. But looking at the GUI components of other modules, I imagine that would be a trivial task for the developer :slight_smile:

Oh man, that was a lot of text; if Mario Neito reads this, he might just laugh because it’s so trivial.
But hey, we’re just enthusiastic users :grinning_face_with_smiling_eyes:
And the only reason I’m taking the trouble to write all this down is that you’re clearly someone who likes to think things through to the end. I like that!

With that in mind, I hope our ideas find their way into MNodes soon; in my opinion, that would represent a significant step forward for the system.

Btw. Before I forget: regarding my other post about the issue with the States module interacting with the IF modules I ran into a problem where I couldn’t upload the crash report files for Mario Nieto.

You tried to help me out with that very quickly. Unfortunately, it still isn’t working; I think the forum software has a grudge against me (I guess I need to write shorter posts :face_with_hand_over_mouth:).
But since I haven’t heard anything further from Mario, I assume he’s managing fine without the reports.
In any case, thank you for your prompt assistance.

All the best and see you soon… dr.rom