updateImageColors();
}
+function clamp(x, min, max) {
+ if (x > max) return max;
+ if (x < min) return min;
+ return x;
+}
+
+// Set the playback volume from a slider position
+function setVolume(audio, slider) {
+ // Apply audio taper. Lower a = more extreme curve.
+ const a = 0.2;
+ const volExp = a * (Math.pow((1 / a + 1), slider.value) - 1);
+ const vol = clamp(volExp, 0, 1);
+ console.log(vol);
+ audio.volume = vol;
+}
+
// Add event listeners
var m_firstLoadPlayer = true;
document.addEventListener("DOMContentLoaded", (event) => {
// Sync volume with current slider position (may be reset after refresh)
var audio = document.getElementById("player-audio");
const slider = document.getElementById("volume-slider");
- audio.volume = slider.value;
+ setVolume(audio, slider);
// The player never gets rebuilt, so we only need to set it up the first time
if (!m_firstLoadPlayer) {
// Volume
document.getElementById("volume-slider").oninput = function(event) {
- audio.volume = event.target.value;
+ setVolume(audio, event.target);
}
// Show mini player on scroll
<h1>site news</h1>
-<h2>2026-08-22 - Private Songs</h2>
+<h2>2026-08-22 - Better Volume & Private Songs</h2>
<p>
-You can now mark songs as private, so they will only be visible to you. This
-works basically the same way as it does for playlists.
+This update has two parts:
</p>
+<ul>
+ <li>The volume slider (on desktop) now has a proper audio taper, making it
+ a little easier to find the volume you want.
+ </li>
+ <li>You can now mark songs as private, so they will only be visible to
+ you. This works basically the same way as it does for playlists.
+ </li>
+</ul>
<h2>2026-03-10 - New Email</h2>
<p>