Hi there,
I have several synthdefs that all use a audio (.wav) buffers. What I now want to do is to replace an existing synth with new synth but using the same buffer.
Each synthdef has the same signature (i.e. control argument ordering), with one argument being the buffer num which the synth should use. So on the client side, I load the audio into a buffer, when completed, I create a synth using the buffer number.
This works wonderfully if I add synths and remove synths. Each time the buffer is unloaded and a new buffer is loaded, new sound is played, all good.
To replace synths, I stumbled across Synth.replace
. It works well enough, replacing synth but using the first buffer that is loaded. So each replacement eventually sounds like the first buffer loaded. And weirdly, this will also happen if I remove the first synth, i.e. that originally used that buffer.
I can’t for the life of me think what the problem could be especially since I do the following:
synth = Synth.replace(synth, newSynthDef, nil, sameID: true);
i.e. I pass no arguments to the new synth, I assume it uses the existing values of the old synth. My previous attempt was:
synth.getn(0, 8, { |args|
synth = Synth.replace(
synth,
newSynthDef,
args,
sameID: true);
});
i.e. explicitly obtaining the args. But this had the same affect as no arguments.
And that’s what I don’t understand, if I pass no arguments, I have the same results as when I pass those arguments.
Any ideas greatly appreciated
Cheers!