Skip to content

Sound effects 🔊 #48

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

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft

Sound effects 🔊 #48

wants to merge 4 commits into from

Conversation

delucis
Copy link

@delucis delucis commented Apr 22, 2025

This PR kicks off a process of adding sound effects to the hypertext.tv UI, starting with the “physical” buttons below the screen.

To do this I:

  • Added howler.js to manage play back of an audio sprite.
  • Created an audio sprite containing 11 similar button click samples.
  • One of the 11 samples is played at random when a button is clicked so that it feels a bit more “real” than just repeating a single identical sample.

Some notes to go with this:

  • I’m not super happy with howler.js as it’s a pretty chunky library that does more than we need (~10 kB gzipped, 37 kB uncompressed). I got sidetracked looking at building a lighter weight alternative, which hopefully I could finish one day, but at this time it does feel like Howler is a reliable if somewhat outdated approach, which could be swapped out later.

  • Because the channel change buttons cause page navigations, they can interrupt sound effect playback (especially when a channel was already visited as the navigation will be faster). Marking this as a draft PR for this reason so we can revisit whether to add Astro’s client router to improve handling here.

  • The audio sprite was created using recordings in the “Buttons and Levers” sound pack by Coral Island Studios on freesound.org, which are shared under the public domain Creative Commons 0 license.

Copy link

netlify bot commented Apr 22, 2025

Deploy Preview for hypertext-tv ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit efbe863
🔍 Latest deploy log https://app.netlify.com/sites/hypertext-tv/deploys/6807bebbaa23ea00084fcf1e
😎 Deploy Preview https://deploy-preview-48--hypertext-tv.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Owner

@evadecker evadecker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, having sounds here really elevates things and makes it feel much more tactile! Thank you for the draft PR.

A few thoughts:

Client-side navigation
We probably do want to move to the client-side navigation to avoid sounds getting cut off during page navigation. However, I'm okay just getting sounds in place first, and following up with client-side routing stuff later, since that will require a larger amount of work.

Sounds
I love having a palette of sounds that play randomly, really adds to the effect!

Right now the sounds are firing on mouseup, which feels... not wrong, but not entirely correct?

CleanShot.2025-04-29.at.12.38.25.mp4

It made me think we could have separate samples for "down" and "up". That might be overkill, but tbh, we could use the same number of samples (11-12) and just split them between up/down (6 each) which I think would feel more realistic without adding unnecessary load time.

I'd also like to find some samples that feel a little less "clacky". These ones sound like the sort of buttons on a tape player:

image

I think the buttons we have on the TV would be a little more subdued.

@evadecker
Copy link
Owner

Oh, one other thing!

I would love to have white noise play when the static is visible on a channel before the webpage in the iframe has loaded. This might be something we can generate, instead of using a sample? The static is generated in an HTML Canvas, so maybe there's something we can do with sound there, too. This blog article is promising.

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.

2 participants