fix: speed controls local playbackRate only, TTS generation always uses speed 1
Speed buttons now set audio.playbackRate directly (on load and on change) instead of passing the speed to Kokoro. The TTS generation request always sends speed:1 so the cached audio is at normal pitch/tempo and the browser handles tempo adjustment locally.
This commit is contained in:
@@ -2704,6 +2704,7 @@ const chapterTmpl = `
|
||||
b.classList.toggle('text-zinc-300', !active);
|
||||
});
|
||||
try { localStorage.setItem(LS_SPEED, btn.dataset.speed); } catch(_) {}
|
||||
if (audio.src) audio.playbackRate = parseFloat(btn.dataset.speed);
|
||||
}
|
||||
window.selectSpeed = selectSpeed;
|
||||
(function loadSettings() {
|
||||
@@ -2841,7 +2842,7 @@ const chapterTmpl = `
|
||||
fetch('/ui/audio/' + SLUG + '/' + chapterN, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ voice: voiceSel.value, speed: getSpeed() }),
|
||||
body: JSON.stringify({ voice: voiceSel.value, speed: 1 }),
|
||||
signal: ctrl.signal
|
||||
})
|
||||
.then(function (res) {
|
||||
@@ -2928,6 +2929,7 @@ const chapterTmpl = `
|
||||
if (stale()) return;
|
||||
if (autoplay) audio.autoplay = true;
|
||||
audio.src = url; audio.load();
|
||||
audio.playbackRate = getSpeed();
|
||||
registerMediaSession();
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user