Tonejs / Tone.js

A Web Audio framework for making interactive music in the browser.
https://tonejs.github.io
MIT License
13.37k stars 976 forks source link

Include added inputs to buffer data #1139

Open charlesmooredev opened 1 year ago

charlesmooredev commented 1 year ago

Currently when creating a player with ToneJS to gather data points to create a waveform, if you apply compressors or gains, etc none of that gets applied to the buffer data.

Is there a way that once you connect those effects to the player that the data points would reflect those effects added?

Example: I add a Tone.Compressor() with attack, release, ratio, and knee could the data points that are returned show those changes that are applied rather than the original data from the audio?

marcelblum commented 1 year ago

If you're trying to render a waveform of the entire post-processed buffer, you'd need to pre-render the modified buffer using Tone.Offline() (which can be an expensive operation depending on buffer length). Otherwise if you're just trying to create a realtime waveform as in an oscilloscope, then that's much easier, simply connect the last node in the effects chain to your AnalyserNode or Tone.Waveform.