Endless problem struggling with AI coding. How to create big presets?

As always, big ambitions, not much knowledge.
I bought roland jv2080 about half year ago as a first rompler, and really fast realize it’s not working like i want. I was trying with vst, but with not good results. I need to control it with my novation sl mk III with 1:1 act, and exactly know where i’m and record it on rest of my stuff. That’s the idea, and decided, to make it in electra one mini architecture.

I read about it for last 3 months, making preset for almost month.
I use Midi OX, for fast defining sysex adresses, i don’t know how to calculate adresses, but know basic logic, and offsets, every important things including checksum.
I know Midi logic, working before with CC, and trying alot with sysex for last 6 months.
I don’t really know about advanced lua scripting. I understand basics, like functions, and using it with declarated actions, but i don’t know how to write, and work with it, because i was working only with Ai.
Right now, Ai lost most of assumptions, and can’t generate working codes.
I have 2 versions of code, one is working almost perfectly, but it’s long, have almost 1 tousand lines and editing it is a nightmare. Every move making trouble with other functions, above all, there’s parsing, and refreshing UI problems. But it’s working.

Second one code, is my trials for making the new code simpler and cleaner. It have right now single source of thruth for electra UI, and separated parser for full dump section. It have theoretically virtual twin engine, i just thinking about virtual replicate of all roland jv2080 structure.
I basically have idea for all the functions, know this instrument really well, im fascinated with it.

But using ai, started to be nightmare, it lost formating, or using functions, what was restricted like few messages before on chat. I dont have any advanced GPT, i use only google chat, don’t have any money for claude and other paid versions of AI.

I started to support myself with markdown files, what includes all the logic, all adresses, all controls on layouts, their ID’s and UI functions, but it’s not working well. Ai just know, about mistakes maken, telling me it will work, and it’s not working, usually just trying to repare something and going around in circles.
I’m just desperated and trying to find way, to work with it.
How did You work, on big presets? Maybe You build few functions and controls on one preset, and clone it to another? Where to start exactly, to have ideally 1:1 preset set to roland? I want to make something like ctrlr jv-xp editor, or jvPatchEd, to set everything in “online” mode. Maybe it will be reduced visually, but functions will be the same, or little more. I think, the key is, one big dump to electra one, and 100% online functions, what will monite all changes live. There’s no way, to lost connection then.

There’s .md script, poorly translated to english, to explain every functions right know.
It’s work on old 9 nine blocks code, except little problems with ui refreshing for id 1001, 1002, 1003, and 105,106,107,108. There’s also receive data error on roland, when changing mode and dump with id 20 button, but some data is transmitting, and parameters, also change correctly (except id mentioned above).

But this script is defining more new structure engine, with new ssot, and virtual engine architecture.
It’s not working, but apparently it’s better. That’s what ai told me. I don’t believe in that, but can’t check it anyway.

I don’t know, what to think abot it, and i’m totally helpless right know.

The .md file:

Have you looked at some existing presets? I think there is one for the roland jv 1080. It might give you ideas on how to proceed. Lua is not too hard to learn especially if you use existing presets as a starting point. Good luck.

Yes, that what was the one of the first things, i did. But there’s an issue, It’s build only for patch mode, and You can edit only one selected tone. It’s making problem, because most of the controls of parameters, are set as sysex message type, i need to set it to virtual first, and make map for tones, and parts what include tones. My structure is more advanced in concept, it’s really nice preset, but focused on other things. Also names of the patch, are defined in this structure, that’s nice idea, but i discovered, You can automatically get it, when dump is received. But i can’t get full name, because parsing problems, name was not full and seems like some bites was lost.
That’s why i decided to make it from none, but maybe good idea is, to use that code to rebuild. I don’t really know right now… i will try to look at it up again. Thanks for advice!

Maybe this will help. It’s Work In Progress for an XV5080, but it already controls multiple tones at once.
The XV5080, together with the TG77 are one of the most complex synths to control remotely. If you have synths with a simpler architecture, I suggest you first work on these.

In any case, it’s a while I worked on this preset , but it might be useful for your project.

You will typically see 2 rows for tones on lot’s of pages:

  • the brown row allows you to select multiple tones at the same time. The list control to the right of it allows to the choose between multi or single select

  • the white row switches tones on and off for easy auditing

  • Program change is already built, but effects management or patch parsing is not

1 Like

I saw xv5080 project, but dont dig into it, i dont have any other synt’s to check how it work exactly i can only monite outputs and interprate, but dont have time for it. Maybe in future, when i really stuck. I use also zoom ms 70 cdr +, but there’s only preset for older one with totally another structure, so that’s other think to do in future. had 2 days of really annoying moves, and needed to reform thinking about that. I change concept, and i broke it to 3 separate presets, one for rythm, one for patch, one for performance, and it started to work, i set universal lua routing for each one, and trying to dont make any conflicts between them. It work fine right now, like code structure is shortened and more reliable for each mode, and Ai makes less problems with updating it. Will see, when i add more functions to it, but right now i’ve done almost half of rythm section in one day. I set also external controller to each preset with other CC Midi channel routing, and everything looks really good right know. I started to think, maybe i will end this before my time will gone :smiley:

I know there will be some really hard things to breake, but right know i change concept, and it work nice. When i end patch mode, i want to use it for performance per part, to not duplicate all of parameters, but performance will be in other one preset. I dont know it will work, that’s next move on horizont what makes me curious and i have trouble thinkin. Will see, when i stuck again. Hope, never, but that’s impossible :stuck_out_tongue: I want to make it soon as it’s possible, eat instant food and just spend hours and days on it. I want to use it, not only build, i have music conceptions for that.

Have good day!

1 Like

I started to dig in other presets, and really? Tg33 for example has no line of lua code. Most of presets, are created without using too much lua. I was wondering, what i do not right, but just looking too high.

So, there’ is CC translator for roland jv2080.

It works terrible, like idk why, but electra have problems, when refreshing ui, and taking parameters from tables of ssot. Requests make a big log, and i know why, but i can’t solve that. I was making long post, but everything fuckup, when Spermium webside crash out, so i want to be quickly.

I made 2 videos, one for performance and rythm mode, second one for patch mode. When selecting focused tone, everything freeze for second, that’s disturbing. I understand, everything need to reload, but it should to make it under surface. I dont know, how to set it.

Everything like sending sysex and receive dumps and single dt works quite nice. But im not really satisficed with that.

I recorded another video, how it work.

You can hear the latency of notes when i turn knobs too fast, that’s offcourse too much sysex sended to roland, but midi notes had latency too. They need to have priority above sysex stream.

The most disturbing latency is when i try to find key note to edit, that’s the left knob on novation keyboard when it’s in “yellow” mode. Then electra refreshing all of parameters on ui, and make big latency, especially when i change notes with fast move…

Everything in preset is sended to enqueue output i think, maybe that’s bad? Maybe notes should isn’t?

I dont know… :x

A few ideas here:

  • Create a message queue and send all midi to the queue instead of sending directly. Then create a timer handler to process the message queue. Add some sort of priority if you want some messages to go first … and some way to clear out all or parts of the queue (e.g., unsent CC"s for the same target)
  • Consider only sending midi when you’re done touching the knob, especially if the changes take time to run on the destination device.

How did you create those “labels” above the mixers?

I have had a lot of success building presets the past couple of days using Fable and GPT 5.6. I will publish them when they are all done; I have had the agents build me some useful shared libraries as part of this. Unfortunately my Electra seems to have just had a heart attack while sitting idle, which is going to slow things down.

The models are good though. I worked with them to create design docs for what I wanted, gave them the Electra docs, and they built the presets. Fable figured out how to send the presets over sysex and capture MIDI and other data back for testing and identifying latency issues. I had both models looks at performance and use caching, memoization and object pooling to improve things. I also switched to generational garbage collection; before that there were issues about once every ten seconds when the garbage collector kicked in.

2 Likes

That’s just Highlighted group label with – 1 ----- 2 ----- 3 ----- 4 – Group Name. I was trying to make it in 4 columns above the v-fader group, but there is text limit, so needed to make 4 separate labels and looks nice i think.

Anyway, i made list of functions what i use in rythm preset i will add it in few minutes.. Yesterday finally found issue with that notes latency, that was evidently ui refreshing loop, what makes everything freez, i needed to restructure all code, and set it to data driven structure, it’s no longer Ssot architecture.
It work alot faster, few little problems like refreshing 1:1 of all controls for RQ or DT is solved.

But, i was trying the same with patch mode, and it’s not working properly, changing focus view for each tone make electra freeze for moment. I think, that’s this same thing as in performance and rythm presets, but more complex, i don’t know why, but this code always make big troubles when i try to edit it.

This is one of the first thing i did, i have enqueue output and try to make buffor depend on timer, but i needed to use flag’s, i don’t remember right now why, but never succesed to make that function working correctly. I wanted to make it like You said, if you stop to use knob, that’s the last value, and function collect any other garbages or “small steps” between. But really? Right now in rythm or performance mode, you need to be really chaotic, to burden the roland.

I know, there’s much more reliable AI than that stupid google, but i can’t afford that, i eat sh*t right now, make debt, and everything coming down, but i don’t care, just life. I just want to make it, i don’t have too much more sense in my life right now ahahah, really Xd

So i don’t need to combine with ai testing sysex structure, i have totally no problem with adding new parameters, i just set electra mini ports to MIDI ox, run roland parameters what i need to know, and everything is showed exactly on monitor. I take it to chat, i’m telling what exactly it will do in what mode, make new virtual parameter id on layout. I just telling ai, what control i’m adding, with param id it is, what midi ox logs that have, what resolution it is, and ai generate for me lua needed to paste into code. So i don’t need to test it, it’s just plug&play.
Sometimes i need to totally clean everything and update firmware, but i think that’s normal in such big presets.

Right now, because i have no longer ssot, and operate on data driven, i will try to make external controler will use that function to update values on it’s own parameters. Now it’s only relative controler, but want to use it in absolute mode, as electra one mini right now.

Here is a concise breakdown of the architecture and functions implemented in this preset. It relies entirely on O(1) Associative Look-up Tables (Data-Driven approach), allowing for true bidirectional, real-time hardware operations without the heavy overhead of standard search loops:

1. Memory & Data Structures (O(1) Complexity)
  • PARAM_DICTIONARY – A static lookup table for all encoders. It provides immediate access to control bounds, SysEx offsets, and labels without running nested loops.
  • RHYTHM_SYSEX_LOOKUP – An inverse address-to-ID lookup map. It instantly translates incoming Roland SysEx memory offsets into Electra parameter numbers, completely eliminating data-loss during bulk dumps.
  • lastEncoders – A flat scratchpad memory cache that tracks the absolute state of every control to optimize delta calculations.
2. Hardware Communication & SysEx Engines
  • sendDT1(address, value) – A unified Roland DT1 packet constructor. It automatically splits 32-bit memory addresses into 4 MIDI bytes, calculates the precise checksum, and fires the string out.
  • forceRhythmModeOnRoland() – An initialization sequence that forces the connected synthesizer into Rhythm Setup Mode on the dedicated part.
  • triggerRhythmDumpCascade() – Sends a multi-packet Request Data (RQ1) message to the Roland unit to fetch the entire drum section state.
3. Event Handlers & Core Logic
  • midi.onSysex(midiInput, sysexBlock) – A high-speed incoming SysEx parser. It safely validates the Roland header, processes raw block dumps, and dynamically refreshes the UI when data matches the focused note.
  • enqueueOutput(controlId, rawValue) – Handles outgoing encoder movements, processes relative deltas, and packs Hi-Lo Nibbles for the sample Wave Number. (Note: Contrary to some suggestions on the forum, this function does not use any timers or delayed queues; it processes and sends hardware messages instantly and synchronously).
  • parameterMap.onChange(...) – The main feedback loop breaker. It utilizes state flags to block outbound MIDI messages while the Electra interface is redrawing or digesting an incoming dump.
4. UI Rendering & System Management
  • buildControlLookupTable() – Caches active control references into a dedicated map upon startup. This bypasses the heavy system overhead of calling controls.get() during active performance.
  • updateControlVisualsFast(paramNumber, newName) – A lightweight, direct wrapper for immediate encoder renaming.
  • updateRhythmLabels() – A dynamic note-to-text translator. It re-calculates the active MIDI note into a standard musical string (e.g., [C3] Focus, [C3] Cutoff) and updates the labels instantly.
  • refreshAllParametersToUI() – A bulk UI synchronizer that pulls cached drum data for the focused note and populates the physical pots.
  • init() – The master constructor. Wipes the cache, sets safe boot variables, and triggers the initial UI draw.

That’s the functions that i use, sorry for poor translate :stuck_out_tongue_winking_eye:

Have good day!

1 Like

Architectural Comparison: Live Rhythm Core V4 vs. Live Patch Engine V6

This document analyzes the structural evolution between the Rhythm V4 engine and the advanced, multi-layered Patch V6 engine. It highlights how the core data-driven architecture was scaled to handle concurrent multi-tone editing.


1. Memory Topography & Data Structures

Rhythm Core V4: Flat 1D Cache
  • Structure: Linear database (JV.rhythm.notes[35..98]) tracking 64 individual drum notes.
  • Focus: Single-point execution. The processor only tracks and renders one active note (JV.system.currentNote) at any given millisecond.
  • Lookup: Direct O(1) correlation between the hardware note number and the memory slot.
Patch Engine V6: Deep Multi-Layered Cache
  • Structure: Hierarchical database managing a split memory map: global parameters (JV.patch.*) and a 4-layer nested array for independent sound generators (JV.patch.tones[1..4]).
  • Focus: Multi-point concurrent tracking via JV.system.editMatrix = {true, false, false, false}.
  • Lookup Tree: Split into two distinct hardware intercept maps: GLOBAL_SYSEX_LOOKUP and TONE_SYSEX_LOOKUP. Parameters are classified by execution limits using explicit architectural fields: scope = "tone", scope = "global", or scope = "hybrid".

2. Hardware Transmission & Packet Shifting

Rhythm Core V4: Linear Addressing
  • Mechanism: Direct 1-to-1 conversion using sendDT1(address, value).
  • Addressing Scheme: Calculations strictly transform the active note number directly into the Roland memory address byte (0x02, 0x09, actNote, offset).
  • Data Payload: Always handles basic 8-bit single-byte values (except for the sample Wave Number which uses raw mathematical splitting).
Patch Engine V6: Compound Address & Shifting
  • Mechanism: Dual transmission array using standard sendDT1 and a compound 14-bit compiler: sendDT1TwoBytes(address, value).
  • Addressing Scheme: Dynamic base-offset pointer calculation. Addresses are resolved using a base array TONE_BASES matched against the editMatrix, creating shifting target destinations dynamically.
  • Data Payload: Processes multi-byte variables (such as Patch Tempo) by calculating high and low nibbles (valMSB, valLSB) alongside real-time parameter masking (def.isFxml scaling offsets by +1 / -1).

3. Event Processing & Multi-Casting

Rhythm Core V4: Synchronous Event Pipeline
  • Execution: Moves downstream. One encoder movement triggers one immediate SysEx message to the synth.
  • Sysex Processing: Simple linear iteration over the size of the block. Updates are instantly routed to the UI if the current note matches.
Patch Engine V6: Multi-Cast Event Pipeline
  • Execution: Branching execution loop inside enqueueOutput. A single encoder rotation evaluates the editMatrix state and multi-casts up to 4 separate SysEx packets simultaneously to all active Roland tones.
  • Sysex Processing: High-speed bulk parsing. It distinguishes between partial updates and full patch dumps (isBulkDump). It processes nested iterations for global block-offsets, isolates multi-byte numbers in the stream, and runs selective refreshes based on active tone visibility (toneIdx == actTone).

4. UI Engine & Real-Time String Rendering

Rhythm Core V4: Static Label Transformation
  • UI Workload: Basic execution. Modifies labels by appending a simple note name prefix (e.g., [C3] Focus) to the fixed parameter name using flat array fetching.
Patch Engine V6: Dynamic Contextual Formatting
  • UI Workload: Advanced contextual rendering engine. The script processes real-time parameter cross-referencing. For instance, updateDelayTimeVisual checks the tone’s active DELAY_MODE first, then dynamically routes the raw integer to either a custom millisecond array (DELAY_MS_VALUES) or a rhythm value map (DELAY_NOTE_VALUES).
  • Optimization: Employs explicit silent updates (parameterMap.set(..., true)) and conditional label evaluation (DYNAMIC_LABEL_LOOKUP) to prevent UI lockups during multi-channel hardware synchronization.

I also made this comparision of structure between rythm and patch modes.