News for hackers. Stuff that matters.
Re:Show HN: Koi.rest – watch some fish and regain your balance by safaelmali on Sunday September 27, 2026 @07:16AM (#49865646)
How are the ambient sounds made-looped recordings or synthesized in the browser? I’m curious how you handle repetition during longer sessions.
Re:Show HN: Koi.rest – watch some fish and regain your balance by hxii on Sunday September 27, 2026 @08:50AM (#49866239)
The audio was sourced from pixabay, and is not looped.

The start and end points have gain faded in a curve, to avoid any clicking especially since the audio samples are not seamless.

Previously a second buffer was used for crossfading, but it doubles the memory consumption with very little benefit.

I was toying with the idea of synthesizing audio from smaller samples directly, but that's an idea for the future :)

Re:Show HN: Koi.rest – watch some fish and regain your balance by safaelmali on Sunday September 27, 2026 @09:06AM (#49866368)
Thanks for explaining! The memory tradeoff is interesting. Do the fades create a noticeable dip between samples, or do the other ambient sounds mask it?
Re:Show HN: Koi.rest – watch some fish and regain your balance by hxii on Sunday September 27, 2026 @10:25AM (#49866907)
The curve on both ends is very brief (20ms, so 40ms total) and is more to deal with any abrupt clicking.