cleaning up

This commit is contained in:
Jade Rowland 2023-11-23 13:45:58 -05:00
parent 88e933ee25
commit 64c2e7c1e8

View File

@ -71,7 +71,8 @@ export function waveformN(partials, type) {
const real = new Float32Array(partials + 1);
const imag = new Float32Array(partials + 1);
const ac = getAudioContext();
const osc = new OscillatorNode(ac, { channelCount: 1, channelCountMode: 'explicit' });
const osc = ac.createOscillator();
const terms = {
sawtooth: (n) => [0, -1 / n],
square: (n) => [0, n % 2 === 0 ? 0 : 1 / n],
@ -124,8 +125,7 @@ export function getOscillator(
let o;
// If no partials are given, use stock waveforms
if (!partials || s === 'sine') {
o = new OscillatorNode(ac, { channelCount: 1, channelCountMode: 'explicit' });
console.log(o);
o = getAudioContext().createOscillator();
o.type = s || 'triangle';
}
// generate custom waveform if partials are given