Skip to content

Commit

Permalink
Simplify pulse oscillator implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
AldaronLau committed May 18, 2024
1 parent 552bbc9 commit 07bedca
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/tree/osc/pulse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ where
let cycle = self.1.synthesize(elapsed, interval, vars);
let alias = self.2.synthesize(elapsed, interval, vars);
let clip = alias.recip();
let offset = cycle;
let pulse = chunk
.abs()
.gain(2.0)
.offset(-1.0)
.mix(offset)
.mix(cycle)
.clip()
.amplify(clip)
.clip();
let scale = offset.gain(0.5).neg_abs().offset(1.0).recip();
let offset = cycle.gain(-0.5);
let scale = offset.abs().offset(1.0).recip();

offset.gain(-0.5).mix(pulse).amplify(scale)
offset.mix(pulse).amplify(scale)
}
}

0 comments on commit 07bedca

Please sign in to comment.