LostRuins / koboldcpp

A simple one-file way to run various GGML and GGUF models with KoboldAI's UI
https://github.com/lostruins/koboldcpp
GNU Affero General Public License v3.0
4.34k stars 310 forks source link

"Detect Voice" mode doesn't work in Firefox #902

Closed NGgmnBQGwR closed 1 week ago

NGgmnBQGwR commented 3 weeks ago

Using "Firefox 126.0.1 (64-bit)" and "koboldcpp-1.67" on Windows10.

When closing the settings dialog with selected option "Speech Control: Detect Voice", Firefox throws this error:

AudioContext.createMediaStreamSource: Connecting AudioNodes from AudioContexts with different sample-rate is currently not supported.

on this line: https://github.com/LostRuins/koboldcpp/blob/5789417802503b0d3f73b1a53e49bad4d46d4832/klite.embd#L12777

I was able to "fix" it locally with this change:

-           let audioContext = new AudioContext({ sampleRate: 16000 });
+           let audioContext = new AudioContext();

(it seemingly works, but I have no understanding of this code, why it failed and why it worked after this change)

LostRuins commented 3 weeks ago

Thanks, I've added a fix for that to perform resampling on the browser side. Can you see if it's fixed from https://lite.koboldai.net (just connect to your local endpoint)

NGgmnBQGwR commented 3 weeks ago

Indeed, now "Detect Voice" mode works without errors. Thank you!

LostRuins commented 1 week ago

The fix is now in the latest released version, please try it.