bryanbraun / music-box-fun

A web app for making music box songs.
https://musicbox.fun
Other
51 stars 4 forks source link

Ability to scroll back and forth while playing a song #23

Open kaelyavel opened 3 years ago

bryanbraun commented 3 years ago

Yeah, so an early version of the site actually supported this feature, but I ended up moving away from it. At the time, I was using IntersectionObserver instead of WebAudio to play notes, but it ended up making the tempo less consistent, especially in Safari browsers. I have some notes in the code about it here.

But I think there's a couple options, while still keeping the consistency of Web Audio:

  1. Lock scrolling during play (what we currently do)
  2. If a song is playing and the user scrolls, immediately pause the song (kind of like we do when somebody changes the tempo mid-song).
  3. If a song is playing and the user scrolls, immediately pause the song, until the scrolling has stopped, after which we automatically start playing again from the new position.

I think we'd have to experiment with option 2 or 3 to see if it feels like a more natural experience than the current approach.