Generate synthesizer output in non-realtime?


I hope that this is the correct category for this question, I am relatively new to JUCE programming. A quick summary - I am working on a project focused on synthesizer parameter estimation. So, given a target sound, the parameters to recreate the sound with a selected synth will be returned. To get started with this, I need to generate a number of synth patches for each permutation of the adjustable parameters as training data.

I would like to generate these samples in non-realtime and I would like to output the data to a memory buffer (with an option to save to a file for debugging purposes). Currently, I am working off of the plug-in host example and I have the ability to trigger the midi note using MidiKeyboardState in the GraphEditorPanel file.

What I am having an issue with currently is knowing where to make this ‘interception’ in the plug-in host so that I write the data straight to a memory buffer and avoid calling the soundcard all together. I’ve traced through the code and documentation quite a bit but, I think I am not understanding this completely. In the AudioProcessor class, there is the setNonRealtime boolean, would I set this to true to enable non-realtime? If so, what are the additional steps following this to write the data to memory?

How can I accomplish generating synth samples in non-realtime and write to a memory buffer?

I don’t see a straightforward way to do it with the AudioPluginHost code, since the AudioProcessorGraph in that is wired into the real time audio device callbacks.

AudioProcessor::setNonRealtime is not going help in this case. Whether the plugins process in real time or offline depends on what the host is doing. setNonRealtime(true) is just a hint for the plugin that the host will be offline rendering.

One possibility might be to do your own AudioIODevice subclass that doesn’t actually use physical audio hardware but rather makes the audio callbacks as fast as possible and stores the processed audio into a buffer.

But probably the easiest is to just do your own specialized offline processing based host.

1 Like