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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate click track as buffer #45

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

ericyd
Copy link
Owner

@ericyd ericyd commented Jan 21, 2023

Rather than creating an audio buffer for each click, generate a full click track as an audio buffer for each loop, and just play that loop.

There is apparently a long-standing bug regarding pausing that I didn't realize, and it comes to light in an ugly way with this change: suspending and resuming the audioContext does not align with the clock 馃槺. That is, when the clock is stopped and started again, it will just resume clicking immediately when the button is clicked. However, the audio buffer will be stopped from mid-beat, which is hard to get right inside the clock.

Need to think more on this. It kind of indicates yet again that a setInterval is not the right way to schedule things -- probably should be using AudioContext. Need to think more on this before merging

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

Successfully merging this pull request may close these issues.

None yet

1 participant