[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Sv: Sv: Sv: [sc-users] What is causing the audible clicks when the envelope is retriggered



Thanks. I didn’t know this was called hard sync, great to know. I am going to work my way through your suggested thread.

I will keep all this in a document for future reference so many thanks!

 

Nils

 

Skickades från E-post för Windows 10

 

Från: borisklompus@xxxxxxxxxxxxxx
Skickat: Sunday, 20 June 2021 00:40
Till: sc-users@xxxxxxxxxxxxxxxx
Ämne: Re: Sv: Sv: [sc-users] What is causing the audible clicks when the envelope is retriggered

 

In all of the examples of hard sync that I've seen in SC, it's a linear ramp oscillator's frequency, modulating the phase of the synced osc, that sets the frequency for the synced osc, which has its freq argument set to 0. I don't know what's happening in the lower level code mechanics that enables this, but it seems like this is what gives frequency
control to the phase argument.

In your example, the Sweep isn't doing anything audible that I can tell.. I dropped in your original line of code and have been toggling back and forth and no difference.
// sig = SinOsc.ar(freqSweep, Sweep.ar(trigger,freqSweep).linlin(freqA,freqC,0,1));
sig = SinOsc.ar(freqSweep, pi/2);

However, I did realize I made a mistake.. Sweep doesn't actually loop around like Phasor does, it just keeps rising until the next trigger, so it needs a modulo to constrain it and force it to wrap around to stick between 0 and 1.

I'm going off this thread for reference: https://scsynth.org/t/fake-resonance-aka-windowed-sync/2720/7. See jamshark's comments about phasor in the code he posted. 

Phasor actually sounds pretty wrong when I switch to it, but this is sounding more like a kick:
sig = SinOsc.ar(0, (Sweep.ar(trigger, freqSweep) % 1) * 2pi);

And also a very simple way to keep the range of the sweep between 0 and 2pi... since it is a value between 0 and 1, just multiply it by 2pi! Haha I also got that from that thread :)

Anyway, still very different than your initial timbre, but it is starting to sound like a kick drum again!

Boris

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Saturday, June 19th, 2021 at 4:12 PM, <nilswallgren@xxxxxxxxxxx> wrote:

> Shouldn’t sweep trigger the phase? The freq of SineOsc should still be freqSweep and not 0 (?)
>
> (
>
> SynthDef.new(\k1mono, {
>
> | freqA=800, freqB=50, freqC=40, freqDur1=0.02, freqDur2=0.5, freqC1=(-1), freqC2=(-1),
>
> atk=0.001, rel=1, c1=1, c2=(-12), amp=1, pan=0, out=0, ts=1 |
>
> var sig, freqSweep, env, trigger= \trig.tr(1);
>
> env = EnvGen.ar(Env([0, 0, 1, 0], [0, atk, rel], [c1, c1, c2], 2), trigger, timeScale:ts);
>
> freqSweep = EnvGen.ar(Env([freqA, freqA, freqB, freqC],[0,freqDur1,freqDur2],[freqC1,freqC1,freqC2], 1),trigger,timeScale: ts);
>
>            sig = SinOsc.ar(freqSweep, Sweep.ar(trigger,freqSweep).linlin(freqA,freqC,0,1));
>
> sig = sig * env;
>
> sig = Pan2.ar(sig, pan, amp);
>
> Out.ar(out, sig);
>
> }).add;
>
> )
>
> Skickades från E-post för Windows 10
>
> Från: nilswallgren@xxxxxxxxxxx
>
> Skickat: Saturday, 19 June 2021 21:42
>
> Till: sc-users@xxxxxxxxxxxxxxxx
>
> Ämne: Sv: Sv: [sc-users] What is causing the audible clicks when the envelope is retriggered
>
> Thanks very much! I like the sound of the sweep even if there is less attack. I guess I have to experiment some more in order to
>
> Have more control over how sweep behaves in order to get that attack.
>
> Thanks a lot!
>
> Skickades från E-post för Windows 10
>
> Från: borisklompus@xxxxxxxxxxxxxx
>
> Skickat: Saturday, 19 June 2021 18:48
>
> Till: sc-users@xxxxxxxxxxxxxxxx
>
> Ämne: Re: Sv: [sc-users] What is causing the audible clicks when the envelope is retriggered
>
> Yeah that's true, and your original code was technically correct, but because you aren't resetting the sine wave at the same time as your envelope, you're getting clicks when it's not at a zero crossing.
>
> But for your timbre, what I'm hearing is that you're using the freqA to 'announce' the attack stage of the kick, more than the actual ramp to 1. And your amplitude envelope is doing transient shaping, but otherwise is effectively at 1.
>
> // triggers 2/sec
>
> (
>
> // if Trig's dur is set to 0.5 it misses retrigger... 
>
> { var atk=0.001, rel=1, c1=1, c2=(-12);
>
> EnvGen.kr(Env([0, 1, 0], [atk, rel], [c1, c2], 1), Trig.kr(Impulse.kr(2), 0.49));
>
> }.plot(2);
>
> )
>
> (
>
> { var atk=0.001, rel=1, c1=1, c2=(-12);
>
> EnvGen.kr(Env([0, 1, 0], [atk, rel], [c1, c2], 1), Trig.kr(Impulse.kr(2), 0.499));
>
> }.plot(2);
>
> )
>
> (
>
> { var atk=0.001, rel=1, c1=1, c2=(-12);
>
> EnvGen.kr(Env([0, 1, 0], [atk, rel], [c1, c2], 1), Trig.kr(Impulse.kr(2), 0.5));
>
> }.plot(2);
>
> )
>
> (
>
> { var atk=0.001, rel=1, c1=1, c2=(-12);
>
> EnvGen.kr(Env([0, 0, 1, 0], [0, atk, rel], [c1, c1, c2], 2), Trig.kr(Impulse.kr(2), 0.49));
>
> }.plot(2);
>
> )
>
> Hmm, and this changes the timbre completely, but syncing the sine osc with the trigger does get rid of  the click...
>
> I'm using Sweep to control the phase of the sine wave, which gets reset with each trigger. I think technically it should have the linlin(0, 1,  0, 2pi) message appended to it, since Sweep is 0 to 1 and phase is 0 to 2pi, but I tried that and it lost all sense of kick drum to me.
>
> Using range(0, 2pi) is wrong I think, but sounds a bit better to my ears, but I prefer it completely without any scaling.
>
> Again, it's all quite different sounding than yours - sorry - just might be interesting as a different point of approach?
>
> (
>
> SynthDef.new(\k1mono, {
>
> | freqA=800, freqB=50, freqC=40, freqDur1=0.02, freqDur2=0.5, freqC1=(-1), freqC2=(-1),
>
> atk=0.001, rel=1, c1=1, c2=(-12), amp=1, pan=0, out=0, ts=1 |
>
> var sig, freqSweep, env, trigger= \trig.tr(1);
>
> env = EnvGen.ar(Env([0, 0, 1, 0], [0, atk, rel], [c1, c1, c2], 2), trigger, timeScale:ts);
>
> freqSweep = EnvGen.ar(Env([freqA, freqA, freqB, freqC],[0,freqDur1,freqDur2],[freqC1,freqC1,freqC2], 2),trigger,timeScale: ts);
>
> sig = SinOsc.ar(0, Sweep.ar(trigger, freqSweep));
>
> sig = sig * env;
>
> sig = Pan2.ar(sig, pan, amp);
>
> Out.ar(out, sig);
>
> }).add;
>
> )
>
> ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
>
> On Saturday, June 19th, 2021 at 11:10 AM, <nilswallgren@xxxxxxxxxxx> wrote:
>
> > Thanks! Yeah changing release node from 2 to 1 makes it better. I’ve never really understood what exactly is going on with the release nodes. I thought I hade to add the extra 0 in Env([0,0,1,0] because it skips the first when retriggered?
> >
> > I made another sequence so it is easier to here which one is better. I thing your first suggestion.
> >
> > (
> >
> > SynthDef.new(\k1mono, {
> >
> >                       | freqA=800, freqB=50, freqC=40, freqDur1=0.02, freqDur2=0.5, freqC1=(-1), freqC2=(-1),
> >
> >                       atk=0.001, rel=1, c1=1, c2=(-12), amp=1, pan=0, out=0, ts=1 |
> >
> >                       var sig, freqSweep, env, trigger= \trig.tr(1);
> >
> > env = EnvGen.ar(Env([0, 1, 0], [atk, rel], [c1, c2], 1), trigger, timeScale:ts);
> >
> >            freqSweep = EnvGen.ar(Env([freqA, freqA, freqB, freqC],[0,freqDur1,freqDur2],[freqC1,freqC1,freqC2]),trigger,timeScale: ts);
> >
> >                       sig = SinOsc.ar(freqSweep, pi/2);
> >
> >                       sig = sig * env;
> >
> >                       sig = Pan2.ar(sig, pan, amp);
> >
> >                       Out.ar(out, sig);
> >
> >            }).add;
> >
> > )
> >
> > env = EnvGen.ar(Env([0, 1, 0], [atk, rel], [c1, c2], 1), trigger, timeScale:ts);  // sounds best
> >
> > env = EnvGen.ar(Env([0, 0, 1, 0], [atk * 0.1, atk, rel], [c1, c1, c2], 2), trigger, timeScale:ts); 2nd
> >
> > env = EnvGen.ar(Env([0, 0, 1, 0], [atk, atk, rel], [c1, c1, c2], 2), trigger, timeScale:ts); 3rd
> >
> > (
> >
> > Pmono(\k1mono,
> >
> >            \freqC,60,
> >
> >            \freqB,70,
> >
> >            #[dur,rel,freqA], Ptuple([
> >
> >                    Pseq([0.5,0.25,1,0.25,1,2,0.25,0.25],1),
> >
> >                             Pseq([4,0.75,10,2,5,2,2,1],1),
> >
> >                             Pseq([800,800,700,500,400,500,300,300],1)
> >
> >            ]*0.5,inf),
> >
> >            \trig,1,
> >
> >                     \ts, Pseq([0.9,1],inf),
> >
> >            \amp,0.2
> >
> > ).play
> >
> > )
> >
> > Skickades från E-post för Windows 10
> >
> > Från: borisklompus@xxxxxxxxxxxxxx
> >
> > Skickat: Saturday, 19 June 2021 15:40
> >
> > Till: sc-users@xxxxxxxxxxxxxxxx
> >
> > Ämne: Re: [sc-users] What is causing the audible clicks when the envelope is retriggered
> >
> > Hello,
> >
> > I believe that the clicks are caused from the combination of the free running oscillator not being reset with your amplitude envelope, and the 0 second first stage attack. You're not starting at a zero crossing of the wave.
> >
> > I removed the first stage of you amplitude envelope and the clicks went away:
> >
> > env = EnvGen.ar(Env([0, 1, 0], [atk, rel], [c1, c2], 1), trigger, timeScale:ts);
> >
> > I figure you have that extra stage in there for the retriggering to also have an attack stage (though I don't think it's necessary?), so not removing it, but setting it to be the same as atk also solves this:
> >
> > env = EnvGen.ar(Env([0, 0, 1, 0], [atk, atk, rel], [c1, c1, c2], 2), trigger, timeScale:ts);
> >
> > I also scaled it further down, there's a click but it's a bit more harmonically consistent...
> >
> > env = EnvGen.ar(Env([0, 0, 1, 0], [atk * 0.1, atk, rel], [c1, c1, c2], 2), trigger, timeScale:ts);
> >
> > Boris
> >
> > ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
> >
> > On Saturday, June 19th, 2021 at 8:56 AM, <nilswallgren@xxxxxxxxxxx> wrote:
> >
> > > I am trying to create a kick that cuts off when retriggered. The problem is that there sometimes are audible clicks when doing this.
> > >
> > > Is there away around this?
> > >
> > > //Instrument
> > >
> > > SynthDef.new(\k1mono, {
> > >
> > >                       | freqA=800, freqB=50, freqC=40, freqDur1=0.02, freqDur2=0.5, freqC1=(-3), freqC2=(-1),
> > >
> > >                       atk=0.001, rel=1, c1=1, c2=(-12), amp=1, pan=0, out=0, ts=1 |
> > >
> > >                       var sig, freqSweep, env, trigger= \trig.tr(1);
> > >
> > >            freqSweep = EnvGen.ar(Env([freqA,freqA, freqB, freqC],[0,freqDur1,freqDur2],[0,freqC1,freqC2],2),trigger);
> > >
> > >            env = EnvGen.ar(Env([0,0,1,0],[0,atk,rel],[c1,c1,c2],2),trigger,timeScale:ts);
> > >
> > >                       sig = SinOsc.ar(freqSweep, pi/2);
> > >
> > >                       sig = sig * env;
> > >
> > >                       sig = Pan2.ar(sig, pan, amp);
> > >
> > >                       Out.ar(out, sig);
> > >
> > >            }).add;
> > >
> > > //Sequence
> > >
> > > (
> > >
> > > Pmono(\k1mono,
> > >
> > >            \freqA, 600,
> > >
> > >            \freqC,60,
> > >
> > >            \freqB,100,
> > >
> > >            \rel, Pseq([1,0.5,3,10],inf),
> > >
> > >            \dur, Pseq([0.5,0.25]*0.5,inf),
> > >
> > >            \trig,1,
> > >
> > >            \amp,0.03
> > >
> > > ).play
> > >
> > > )
> > >
> > > Best,
> > >
> > > Skickades från E-post för Windows 10

_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.birmingham.ac.uk/facilities/ea-studios/research/supercollider/mailinglist.aspx
archive: https://listarc.bham.ac.uk/marchives/sc-users/
search: https://listarc.bham.ac.uk/lists/sc-users/search/