I am using Tone JS to make sounds and I would like to add a filter to my Sampler instrument, my understanding from the documentation is that I can do so by using the connect
method on the sampler and passing in the filter as the argument:
const filter = new Filter(20000, "highpass").toDestination();
this.sampler = new Sampler({
urls: { C1: 'C1.wav' },
baseUrl: "/static/samples/piano/",
})
.connect(filter)
.toDestination();
The above does not apply the filter effect when the sound plays and I am not sure why?
Use the chain command to connect the sampler to the filter and then to destination. Then use the onload callback to start the sound.
Try this: