From e489db4e826d46be86db269d98e4aef44e903f84 Mon Sep 17 00:00:00 2001 From: aprilnightk Date: Sat, 13 Sep 2025 21:35:47 +0300 Subject: [PATCH] fixed wrong application of phase to skewsine --- sineex.py | 27 +++++++++++++++++---------- zigsonnum/activity.zig | 6 +++--- 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/sineex.py b/sineex.py index c2c2e38..b3312cb 100644 --- a/sineex.py +++ b/sineex.py @@ -1,4 +1,4 @@ -ln = s.sec(6); +ln = s.sec(2) s.endtick(ln) @@ -10,17 +10,24 @@ right.setpos(0, 0.3, 0, 0) tr1 = s.node() -tr1.setbasefreq(0, 11) -tr1.setgain(0, 0.45) +#tr1.setbasefreq(0, 11) +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) tr2 = s.node() - -tr2.setbasefreq(0, s.note("E4")) -tr2.am(0, ln) -tr2.square(0, ln) +tr2.slidebasefreq(0, ln, s.note("C4"), s.note("A4")) +tr2.setskew(0, 0.3) +tr2.setgain(0, 0.25) +tr2.setphase(0, 0.3) +tr2.skewsine(0, ln) +tr2.triangle(0, ln) -s.wire(tr1, tr2) -s.wire(tr2, left) -s.wire(tr2, right) \ No newline at end of file +s.wire(tr1, left) +s.wire(tr2, right) + +s.wire(tr1, right) +s.wire(tr2, left) \ No newline at end of file diff --git a/zigsonnum/activity.zig b/zigsonnum/activity.zig index 278b947..0b679a7 100644 --- a/zigsonnum/activity.zig +++ b/zigsonnum/activity.zig @@ -236,14 +236,14 @@ pub const Activity = struct { const amp = r_amp * math.sin(utility.corrected_tau * freq * current_tick - phase * utility.tau); self.soundnode.fab.add_r_amp(amp); } 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 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); } else if (skew < 0) { const m = (utility.corrected_tau * freq * current_tick); 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); }