How to use the virtual-audio-graph.createNode function in virtual-audio-graph

To help you get started, we’ve selected a few virtual-audio-graph examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github benji6 / andromeda / src / plugins / instruments / Prometheus / notesToGraph.js View on Github external
import {
  biquadFilter,
  createNode,
  gain as gainNode,
  oscillator,
  stereoPanner,
} from 'virtual-audio-graph'
import frequencyToPitch from '../../../audioHelpers/frequencyToPitch'
import pitchToFrequency from '../../../audioHelpers/pitchToFrequency'

const lfoNode = createNode(({frequency, gain, type}) => ({
  0: gainNode('output', {gain}),
  1: oscillator(0, {frequency, type}),
}))

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,
  }),
}))
github benji6 / andromeda / src / plugins / instruments / Prometheus / notesToGraph.js View on Github external
import {
  biquadFilter,
  createNode,
  gain as gainNode,
  oscillator,
  stereoPanner,
} from 'virtual-audio-graph'
import frequencyToPitch from '../../../audioHelpers/frequencyToPitch'
import pitchToFrequency from '../../../audioHelpers/pitchToFrequency'

const lfoNode = createNode(({frequency, gain, type}) => ({
  0: gainNode('output', {gain}),
  1: oscillator(0, {frequency, type}),
}))

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,
  }),
}))

export default ({filter, lfo, master, oscillatorSingles, oscillatorSupers}, notes) =>
  notes.reduce((acc, {frequency, gain, id, startTime, stopTime}) => {
    const noteGainId = `noteGain-${id}`
    acc[noteGainId] = gainNode('filter', {gain})
github benji6 / andromeda / src / plugins / instruments / Ariadne.js View on Github external
import {createStore, connect} from 'st88'
import ControlModule, {Range, Select} from '../../components/organisms/ControlModule'
import createVirtualAudioGraph, {
  createNode,
  gain as gainNode,
  oscillator,
  stereoPanner,
} from 'virtual-audio-graph'

const audioContexts = new WeakMap()
const notes = new WeakMap()
const outputs = new WeakMap()
const virtualAudioGraphs = new WeakMap()
const stores = new WeakMap()

const oscBank = createNode(({
  carrierDetune,
  carrierOscType,
  gain,
  frequency,
  masterGain,
  masterPan,
  modulatorDetune,
  modulatorOscType,
  modulatorRatio,
  startTime,
  stopTime,
}) => ({
  0: gainNode(['masterPan'], {gain}),
  1: oscillator(0, {
    detune: carrierDetune,
    frequency,