soundbank-delay

Basic delay processor AudioNode with feedback, filter and wet/dry AudioParams.

soundbank-delay

Basic delay processor AudioNode with feedback, filter and wet/dry AudioParams.

Intended for use as a processor in soundbank, but it is compatible with any Web Audio API AudioNode set up.

$ npm install soundbank-delay
var Delay = require('soundbank-delay')

Create and return an AudioNode instance.

When true, the delay rate is multiplied by 60 / node.tempo to allow beat sync.

node.time (AudioParam)

Time the feedback should be delayed by. Maximum value is 4 seconds.

If node.sync is true, this is the number or fraction of beats the feedback should be delayed by.

Defaults to "lowpass".

Can be any of the filters types specified by BiquadFilterNode

var Delay = require('soundbank-delay')
 
var audioContext = new AudioContext()
 
var delay = Delay(audioContext)
delay.connect(audioContext.destination)
 
delay.time.value = 0.2 //seconds 
delay.wet.value = 0.8
delay.dry.value = 1
delay.cutoff.value = 400 //Hz 
delay.feedback.value = 0.6
 
setInterval(function(){
  var source = audioContext.createOscillator()
  source.connect(delay)
  source.start()
  source.stop(audioContext.currentTime + 0.5)
}, 2000)