mirror of
https://codeberg.org/uzu/strudel
synced 2026-09-04 14:51:26 -04:00
fix: node export
This commit is contained in:
@@ -47,7 +47,8 @@ haps.forEach((hap) => {
|
||||
console.log(`render ${seconds}s long buffer...`);
|
||||
const buffer = new Float32Array(seconds * sampleRate);
|
||||
while (dough.t <= buffer.length) {
|
||||
buffer[dough.t] = dough.update();
|
||||
dough.update();
|
||||
buffer[dough.t] = dough.out[0];
|
||||
}
|
||||
console.log('done!');
|
||||
|
||||
|
||||
@@ -150,7 +150,7 @@ class PulseOsc {
|
||||
return 2 * phase - 1 - p;
|
||||
}
|
||||
update(freq, pw = 0.5) {
|
||||
const dt = freq / sampleRate;
|
||||
const dt = freq / SAMPLE_RATE;
|
||||
let pulse = this.saw(0, dt) - this.saw(pw, dt);
|
||||
this.phase = (this.phase + dt) % 1;
|
||||
return pulse + pw * 2 - 1;
|
||||
|
||||
Reference in New Issue
Block a user