Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Volume warp on sampler scheduled playback #1322

Open
bhdoggett opened this issue Feb 26, 2025 · 0 comments
Open

Volume warp on sampler scheduled playback #1322

bhdoggett opened this issue Feb 26, 2025 · 0 comments

Comments

@bhdoggett
Copy link

Hi, this is more of a "help" request. I'm trying to record the start and duration times for a sampler playback in a drum machine / sampler app I'm trying to build. For some reason when I have more than one playback instance, the volume gets warped to increase volume at the beginning of the transport loop and lower volume at the end. I'm at a loss trying to figure out where this is coming from.

Here's my sandbox:
https://codesandbox.io/p/github/bhdoggett/drum-the-jukebox/draft/heuristic-sea?workspaceId=ws_76iJDTbHwFwg7RaTf2o52x

and here's my code where I schedule the sampler to play:

  useEffect(() => {
    if (isPlaying && sampleData.times.length > 0) {
      sampleData.times.forEach(({ startTime, duration }) => {
        if (duration) {
          Tone.Transport.schedule((time) => {
            sampler.current?.triggerAttackRelease("C4", duration, time, 1);
          }, startTime);
        }
      });
    }
  }, [isPlaying, sampler, sampleData]);

Could anything in the transport loop be adjusting gain over time, or will multiple scheduled triggerAttackRelease events effect the volume of those events gradually?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant