fixed wrong application of phase to skewsine

This commit is contained in:
aprilnightk 2025-09-13 21:35:47 +03:00
parent b3b44810a6
commit e489db4e82
2 changed files with 20 additions and 13 deletions

View file

@ -1,4 +1,4 @@
ln = s.sec(6); ln = s.sec(2)
s.endtick(ln) s.endtick(ln)
@ -10,17 +10,24 @@ right.setpos(0, 0.3, 0, 0)
tr1 = s.node() tr1 = s.node()
tr1.setbasefreq(0, 11) #tr1.setbasefreq(0, 11)
tr1.setgain(0, 0.45) tr1.slidebasefreq(0, ln, s.note("C4"), s.note("A4"))
tr1.setskew(0, 0.3)
tr1.setgain(0, 0.25)
tr1.skewsine(0, ln)
tr1.triangle(0, ln) tr1.triangle(0, ln)
tr2 = s.node() tr2 = s.node()
tr2.slidebasefreq(0, ln, s.note("C4"), s.note("A4"))
tr2.setbasefreq(0, s.note("E4")) tr2.setskew(0, 0.3)
tr2.am(0, ln) tr2.setgain(0, 0.25)
tr2.square(0, ln) tr2.setphase(0, 0.3)
tr2.skewsine(0, ln)
tr2.triangle(0, ln)
s.wire(tr1, tr2) s.wire(tr1, left)
s.wire(tr2, left)
s.wire(tr2, right) s.wire(tr2, right)
s.wire(tr1, right)
s.wire(tr2, left)

View file

@ -236,14 +236,14 @@ pub const Activity = struct {
const amp = r_amp * math.sin(utility.corrected_tau * freq * current_tick - phase * utility.tau); const amp = r_amp * math.sin(utility.corrected_tau * freq * current_tick - phase * utility.tau);
self.soundnode.fab.add_r_amp(amp); self.soundnode.fab.add_r_amp(amp);
} else if (skew > 0) { } else if (skew > 0) {
const m = (utility.corrected_tau * freq * current_tick); const m = (utility.corrected_tau * freq * current_tick) - (phase * utility.tau);
const sincos = skew * math.sin(m) / (1 - skew*math.cos(m)); const sincos = skew * math.sin(m) / (1 - skew*math.cos(m));
const amp = r_amp * ((1/skew) * math.atan(sincos) - (phase * utility.tau)); const amp = r_amp * ((1/skew) * math.atan(sincos));
self.soundnode.fab.add_r_amp(amp); self.soundnode.fab.add_r_amp(amp);
} else if (skew < 0) { } else if (skew < 0) {
const m = (utility.corrected_tau * freq * current_tick); const m = (utility.corrected_tau * freq * current_tick);
const sincos = skew * math.cos(m) / (1 + skew*math.sin(m)); const sincos = skew * math.cos(m) / (1 + skew*math.sin(m));
const amp = r_amp * ((1/skew) * math.atan(sincos) - (phase * utility.tau)); const amp = r_amp * ((1/skew) * math.atan(sincos));
self.soundnode.fab.add_r_amp(amp); self.soundnode.fab.add_r_amp(amp);
} }