Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const updateAudioGraph = virtualAudioGraph => ({
delayTime,
dryLevel,
feedback,
highCut,
lowCut,
pingPong,
wetLevel,
}) => virtualAudioGraph.update({
0: gain('output', {gain: wetLevel}),
1: stereoPanner(0, {pan: -1}),
2: stereoPanner(0, {pan: 1}),
3: delay([2, 8], {delayTime, maxDelayTime}),
4: gain(3, {gain: feedback}),
5: delay(pingPong ? [1, 3] : [0, 8], {delayTime, maxDelayTime}),
6: biquadFilter(5, {frequency: highCut}),
7: biquadFilter(6, {frequency: lowCut, type: 'highpass'}),
8: gain(7, {gain: feedback}),
9: gain('output', {gain: dryLevel}),
input: gain([8, 9], {gain: 1}, 'input'),
})
detune: carrierDetune,
frequency,
startTime,
stopTime,
type: carrierOscType,
}),
2: gainNode({destination: 'frequency', key: 1}, {gain: 1024}),
3: oscillator(2, {
detune: modulatorDetune,
frequency: frequency * modulatorRatio,
startTime,
stopTime,
type: modulatorOscType,
}),
masterGain: gainNode(['output'], {gain: masterGain}),
masterPan: stereoPanner(['masterGain'], {pan: masterPan}),
}))
const updateAudioGraph = virtualAudioGraph => ({
delayTime,
dryLevel,
feedback,
highCut,
lowCut,
pingPong,
wetLevel,
}) => virtualAudioGraph.update({
0: gain('output', {gain: wetLevel}),
1: stereoPanner(0, {pan: -1}),
2: stereoPanner(0, {pan: 1}),
3: delay([2, 8], {delayTime, maxDelayTime}),
4: gain(3, {gain: feedback}),
5: delay(pingPong ? [1, 3] : [0, 8], {delayTime, maxDelayTime}),
6: biquadFilter(5, {frequency: highCut}),
7: biquadFilter(6, {frequency: lowCut, type: 'highpass'}),
8: gain(7, {gain: feedback}),
9: gain('output', {gain: dryLevel}),
input: gain([8, 9], {gain: 1}, 'input'),
})
pitch: oscillatorSuper.pitch,
startTime,
stopTime,
type: type === 'random'
? ['sawtooth', 'sine', 'square', 'triangle'][Math.floor(Math.random() * 4)]
: type,
})
}
}
return acc
}, {
filter: biquadFilter('masterPan', filter),
lfo: lfoNode({destination: 'frequency', key: 'filter'}, lfo),
masterGain: gainNode('output', {gain: master.gain}),
masterPan: stereoPanner('masterGain', {pan: master.pan}),
})
const osc = createNode(({detune, frequency, gain, pan, pitch, startTime, stopTime, type}) => ({
0: gainNode('output', {gain}),
1: stereoPanner(0, {pan}),
2: oscillator(1, {
detune,
frequency: pitchToFrequency(frequencyToPitch(frequency) + pitch),
startTime,
stopTime,
type,
}),
}))