surikov / webaudiofont

Use full GM set of musical instruments to play MIDI and single sounds or effects. Support for reverberation and equaliser. No plugins, no Flash. Pure HTML5 implementation compatible with desktop and mobile browser. See live examples.
https://surikov.github.io/webaudiofont/
GNU General Public License v3.0
891 stars 92 forks source link

Reverberator in TS and React #89

Closed JanVeb closed 2 years ago

JanVeb commented 2 years ago

Hi there, looking how to add reverb TO piano sound but nothing works

    const webFontPlayer: any = new WebAudioFontPlayer();
    webFontPlayer.loader.startLoad(
      this.ac,
      this.nameToUrl(soundId, "JCLive", "sf2"),
      this.soundFontNameBuilder(soundId, "JCLive", "sf2")
    );
    const self: any = this;
    webFontPlayer.loader.waitLoad(function () {
      self.memoryLoadedSoundFonts.set(soundId, webFontPlayer);

// TRYING TO ADD REVERB HERE
      // var reverberator = webFontPlayer.createReverberator(this.ac);
      // var equalizer = webFontPlayer.createChannel(this.ac);
      this.echo = webFontPlayer.createReverberator(this.ac);
      this.echo.wet.gain.setTargetAtTime(1.5, 0, 0.0001);
      // var input = equalizer.input;
      // equalizer.output.connect(reverberator.input);
      // reverberator.output.connect(this.ac.destination);
      // reverberator.wet.gain.setTargetAtTime(1.5, 0, 0.0001);
    });
  }
surikov commented 2 years ago

Create example in https://jsbin.com/ and paste url here.