I'm playing around with LFOs on __().sampler nodes within a __.loop. Since buffer nodes are recreated on each play modulators get disconnected after the first play, so you need something like this for it to work:
__().sampler({path:"/Sounds/various/gun-cock.wav",speed:1,start:0}).dac();
__().lfo({type:"sine",modulates:"speed",frequency:4, gain:.5})
__.loop(600,function(){
__("sampler").stop()
__('lfo').connect("sampler")
__('lfo').start()
__("sampler").start();
});
__.loop("start");
I'm wondering what it would take to get a script to work such that the LFO continues to modulate the sampler speed on each loop. eg.
__().sampler({path:"/Sounds/various/gun-cock.wav",speed:1,start:0}).dac();
__().lfo({type:"sine",modulates: "speed", frequency:40, gain:1}).connect('sampler').start()
__.loop(600,function(){
__("sampler").stop().start()
});
__.loop("start");
In /src/create.js I see the this.resetNode method is designed to reconnect the sampler after each play. I'm wondering if it's possible to reconnect modulators here as well.
I don't know of a way to query the audio context for modulator connections on the node being reset, so perhaps it would require adding a reference to the modulator node's uuid on the sampler node when __().lfo({}).connect('sampler') is called.
maybe something like this could be added to resetNode method:
for (var i = 0; i < this.connectedModulators.length; i++) {
this.connect(connectedModulators[i]);
}
I'm happy to try it out and make a PR, but I thought I'd run it by you to see if you have recommend other approaches or considerations.
I'm playing around with LFOs on
__().samplernodes within a__.loop. Since buffer nodes are recreated on each play modulators get disconnected after the first play, so you need something like this for it to work:I'm wondering what it would take to get a script to work such that the LFO continues to modulate the sampler speed on each loop. eg.
In
/src/create.jsI see thethis.resetNodemethod is designed to reconnect the sampler after each play. I'm wondering if it's possible to reconnect modulators here as well.I don't know of a way to query the audio context for modulator connections on the node being reset, so perhaps it would require adding a reference to the modulator node's uuid on the sampler node when
__().lfo({}).connect('sampler')is called.maybe something like this could be added to
resetNodemethod:I'm happy to try it out and make a PR, but I thought I'd run it by you to see if you have recommend other approaches or considerations.