Does any one know why im getting clicks when modulating the master oscillator?.
Im basically working on resonant waveforms by doing hard sync, the main idea is to have one oscillator that syncs the slave and another oscillator that is at the same frequency of the master that will modulate the amplitude of the slave, so when the discontinuities of the hard sync arrived they will have 0 amplitude, thus it will sound smooth, like this:
Everything seems to be woking fine, but at some moments it kind of lags or something when you modulate the master frequency and it gets out of sync in a really tiny window, so in the scope you can see the discontinuity and also you can hear a click.
I would really appreciate some help, I tried so many things but apparently it has to be with a lag between the sever and the client when modulating the master frequency.
Just try to hear some rounds, it doesn’t click all the time, just at the lowest frequencies.
//Creation of the sine wave from 0 to 1
(
var numFrames = 2048;
var sig = (Signal.sineFill(numFrames, [1], [-pi/2]) +1)*0.5;
b = Buffer.alloc(s,numFrames);
b.loadCollection(sig);
d = Buffer.loadCollection(s, Scale.harmonicMinor);
b.plot
)
//Hard sync resonance
(
{
var baseFreq, playbackRate, follower, followerFreq, leader, leaderFreq, ampMod, sig, trig;
trig = Impulse.ar(5);
baseFreq = s.sampleRate / (b.numFrames);
leaderFreq = SinOsc.ar(0.1).range(1,100);
leader = Impulse.ar(leaderFreq);
followerFreq = leaderFreq + 10;
playbackRate = (followerFreq) / baseFreq;
ampMod = EnvGen.ar(Env.perc(0, 1, curve:0), leader, timeScale:1 / leaderFreq;);
follower = PlayBuf.ar(1, b, playbackRate, trigger: leader , loop: 1) ;
sig =(follower * ampMod)!2 * 0.2;
}.play;
)
Also if I modulate just the slave frequency and let the master frequency constant it works as a resonant waveform.
(
{
var baseFreq, playbackRate, follower, followerFreq, leader, leaderFreq, ampMod, sig, trig;
trig = Impulse.ar(5);
baseFreq = s.sampleRate / (b.numFrames);
leaderFreq = 40;
leader = Impulse.ar(leaderFreq);
followerFreq = leaderFreq + SinOsc.ar(0.1, -pi/2).range(0,1000);
playbackRate = (followerFreq) / baseFreq;
ampMod = EnvGen.ar(Env.perc(0, 1, curve:0), leader, timeScale:1 / leaderFreq;);
follower = PlayBuf.ar(1, b, playbackRate, trigger: leader , loop: 1) ;
sig =(follower * ampMod)!2 * 0.2;
}.play;
)
But as soon as I try to modulate both, it does really weird stuff:
(
{
var baseFreq, playbackRate, follower, followerFreq, leader, leaderFreq, ampMod, sig, trig;
trig = Impulse.ar(5);
baseFreq = s.sampleRate / (b.numFrames);
leaderFreq = SinOsc.ar(0.1, -pi/2).range(1,100);
leader = Impulse.ar(leaderFreq);
followerFreq = leaderFreq + SinOsc.ar(0.1, -pi/2).range(0,1000);
playbackRate = (followerFreq) / baseFreq;
ampMod = EnvGen.ar(Env.perc(0, 1, curve:0), leader, timeScale:1 / leaderFreq;);
follower = PlayBuf.ar(1, b, playbackRate, trigger: leader , loop: 1) ;
sig =(follower * ampMod)!2 * 0.2;
}.play;
)
thanks for the time.