mirror of
https://github.com/eliasstepanik/strudel.git
synced 2026-01-14 15:18:30 +00:00
fix: history
This commit is contained in:
parent
6bcf8b91cc
commit
88b5b9b21c
@ -2,13 +2,6 @@ import { midiToFreq, noteToMidi } from './util.mjs';
|
||||
import { registerSound, getAudioContext } from './superdough.mjs';
|
||||
import { getOscillator, gainNode, getEnvelope, getExpEnvelope } from './helpers.mjs';
|
||||
|
||||
const fm = (osc, harmonicityRatio, modulationIndex, wave) => {
|
||||
const carrfreq = osc.frequency.value;
|
||||
const modfreq = carrfreq * harmonicityRatio;
|
||||
const modgain = modfreq * modulationIndex;
|
||||
return mod(modfreq, modgain, wave);
|
||||
};
|
||||
|
||||
const mod = (freq, range = 1, type) => {
|
||||
const ctx = getAudioContext();
|
||||
const osc = ctx.createOscillator();
|
||||
@ -20,6 +13,13 @@ const mod = (freq, range = 1, type) => {
|
||||
return { node: g, stop: (t) => osc.stop(t) };
|
||||
};
|
||||
|
||||
const fm = (osc, harmonicityRatio, modulationIndex, wave) => {
|
||||
const carrfreq = osc.frequency.value;
|
||||
const modfreq = carrfreq * harmonicityRatio;
|
||||
const modgain = modfreq * modulationIndex;
|
||||
return mod(modfreq, modgain, wave);
|
||||
};
|
||||
|
||||
export function registerSynthSounds() {
|
||||
['sine', 'square', 'triangle', 'sawtooth'].forEach((wave) => {
|
||||
registerSound(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user