mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-25 04:28:30 +00:00
cleaning up
This commit is contained in:
parent
88e933ee25
commit
64c2e7c1e8
@ -71,7 +71,8 @@ export function waveformN(partials, type) {
|
|||||||
const real = new Float32Array(partials + 1);
|
const real = new Float32Array(partials + 1);
|
||||||
const imag = new Float32Array(partials + 1);
|
const imag = new Float32Array(partials + 1);
|
||||||
const ac = getAudioContext();
|
const ac = getAudioContext();
|
||||||
const osc = new OscillatorNode(ac, { channelCount: 1, channelCountMode: 'explicit' });
|
const osc = ac.createOscillator();
|
||||||
|
|
||||||
const terms = {
|
const terms = {
|
||||||
sawtooth: (n) => [0, -1 / n],
|
sawtooth: (n) => [0, -1 / n],
|
||||||
square: (n) => [0, n % 2 === 0 ? 0 : 1 / n],
|
square: (n) => [0, n % 2 === 0 ? 0 : 1 / n],
|
||||||
@ -124,8 +125,7 @@ export function getOscillator(
|
|||||||
let o;
|
let o;
|
||||||
// If no partials are given, use stock waveforms
|
// If no partials are given, use stock waveforms
|
||||||
if (!partials || s === 'sine') {
|
if (!partials || s === 'sine') {
|
||||||
o = new OscillatorNode(ac, { channelCount: 1, channelCountMode: 'explicit' });
|
o = getAudioContext().createOscillator();
|
||||||
console.log(o);
|
|
||||||
o.type = s || 'triangle';
|
o.type = s || 'triangle';
|
||||||
}
|
}
|
||||||
// generate custom waveform if partials are given
|
// generate custom waveform if partials are given
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user