Get current synth parameter snapshot?

The technique I’m using to save/serialise synth presetswhile composing and sound-designing seems sort of awkward and laborious, and I’m wondering if anyone’s got a better solution.

So I’ve mapped all synth parameters to a hardware MIDI controller, which lets me design presets as I would normally on a hardware synth or in a DAW. MIDI CC input is scanned and synth parameters are set dynamically. The problem is, the Modular Synth component only has setters, not getters, for individual params - so I have to create a new temporary preset, set its parameters with CC input, then assign that preset to the Modular Synth on every knob/button adjustment. That means I can hear the changes and also save out that temporary preset.

It’s a hell of a spaghetti tangle in Blueprint, however, and it would be great if I could snapshot the current synth params (or even ‘Get’ each current param from the synth) to add to my save struct.

Any ideas? Thanks!

About to go to bed, not sure i understand question, but is it this thing you want?

Thanks kjekkbart, but no - those are what I’m currently using to keep track of saved presets and to keep my CC knob state in sync with the Modular Synth instance itself, but it doesn’t seem possible to get the Modular Synth’s parameters at any given point in time. If I could do this as easily as I can set them (ie Get Osc 1 Gain on my synth component’s instance), or even dump the current state of the instance’s parameters (e.g. MyModSynth -> Get Synth Preset). then life would be a lot easier.

So right now I have a ModularPresetBank asset containing one preset. On game start, I load that preset into the synth instance and set a var from each of its members and keep a temporary working copy of the preset. Those synth member vars are stored in my CC array (0-127) according to my arbitrary MIDI hardware mapping.

When I turn a MIDI knob, I update the CC array with the new value, then use that var to update the working copy of the preset, then assign the working copy to the synth instance. When I want to save the current state as a preset, rather than getting the params from the synth instance, I save the working copy.

Sounds quite straightforward when I lay it out here, but it’s mega complex in Blueprint and I’d prefer to be setting individual synth params on CC input and then only dumping the params as a preset when I’m ready, whereas at the moment I’m basically assigning a new preset to the synth instance on every tick (or however fast the MIDI input updates as I turn a knob).

Perhaps there’s a missing link here that I’m too dumb to spot, or perhaps somebody’s got an altogether more sensible workflow for synth preset design that they wouldn’t mind sharing! Failing that, maybe I could humbly suggest to Aaron and Dan that a nice feature for the Modular Synth to have would be per-parameter getters and a full dump of all current instance parameters as a SynthPreset-type struct?

Thoughts welcome!

If you have a performance-problem then hmmm… Someone else hopefully has insight. I thought it sounded pretty sweet as you laid it out. If the main problem is that it’s a big complicated BP that’s hard to work with, I suggest refactoring some of it into functions, collapsing sub-structures into small, well-commented nodes, doing it all neat and pretty with the best names. I find it’s a zen joy to organize and re-factor a big BP. As long as I just made it, or I roughly understand it, and so long as I don’t break something along the way or get distracted with MORE FEATURES.

Yes, cathartic refactoring is in progress:) Well it seems like we might modify the synth a little to add getter functions, since we’re doing a custom version of PresetBank anyway to hold parameters for extra oscillators and for arrays of granular synth params. We’ll have quite a bit of spare CPU available for this monster hybrid synth so it might not be ideal for everyone, but I’ll report back if we come up with something interesting!

Whaaat, what are you building? Sounds right up my alley!

Just a big synth for procedural/dynamic score :slight_smile: I’m mainly a composer, so most of the effort right now is setting up a good workflow that lets me compose and tweak in a more DAW-like fashion. I’ll start documenting it when it gets a bit further along!

Ooohh I’ll be watching! Check out the unreal slackers discord if you haven’t. I hang out in the audio channel part of most days.

About refactoring… This is my collision-driven keyboard-BP on the surface. Looks safe enough:

Then as soon as you click on something, you descend one level further into hell:

We could click on to deeper levels. It get’s better but then worse again!

Most of this could be very elegant and efficient with arrays and stuff, but this way it’s easy for me to mentally model, and it’s easy to implement small one-off stuff in weird places, since everything is exposed.

Edit: ps sorry about spilling all over your thread

Haha no problem, it’s satisfying to see order from chaos :slight_smile: Although even your ‘hell’ BP is far neater than most of mine…

Hey this all sounds awesome. One thing to be careful of when you do “getters” back to BP is to not read directly from the synthesizer. You should be wary of thread safety issues. You should either cache the last set parameter on the game thread so when you “get” it, it’ll already be there. If you’re trying to get current values of LFOs, etc, you’ll want to use some mechanism to safely send that data to the game thread. Try to avoid critical sections.

But sounds really exciting… would love to hear/see your results!

Thanks Aaron - very useful info. Glad I didn’t press our C++ wizard to hack me up a bunch of getters, in light of this! So yeah, basically caching every set before setting it was my workaround, and it’s more than responsive enough even with loads of CCs doing their thing simultaneously. And that won’t be happening in gameplay anyway, it’s just for sound design during dev.

So what we’ve done is cloned and modified the plugin to allow [n] oscillators, and now I’ve got a custom SynthPresetBank where a preset contains params for the mod synth, including 4 oscillators (my arbitrary limit - 2osc subtractive plus sub osc and noise :slight_smile: ), and also an array of granular/sample synth parameter structs. I’m writing CC updates back to those presets by ref, so the Bank asset updates on the fly, then I save the bank in the editor when I’m done.

Our 2D game has a fair bit of spare CPU overhead, so I’ve been given permission to go nuts with this ‘frankensynth’ :wink: Should find out over the next day or two what kind of osc/polyphony/effects balance works best in terms of resources…

That sounds rad!

This is super awesome :smiley: Hope you get good results. Realtime synthesis is definitely the future of audio in games, imo. :slight_smile: