add custome voice
This commit is contained in:
@@ -335,8 +335,8 @@ export function speakTextHelper(text, { state, currentLanguage }, options = {})
|
||||
const utterance = new SpeechSynthesisUtterance(text);
|
||||
const language = options.language || currentLanguage();
|
||||
utterance.lang = String(language).toLowerCase().startsWith("sv") ? "sv-SE" : "en-US";
|
||||
utterance.rate = Math.max(0.65, Math.min(1.35, Number(state.settings.speechRate || 0.95) || 0.95));
|
||||
utterance.pitch = Math.max(0.7, Math.min(1.3, Number(state.settings.speechPitch || 1) || 1));
|
||||
utterance.rate = Math.max(0.65, Math.min(1.35, Number(options.rate ?? state.settings.speechRate ?? 0.95) || 0.95));
|
||||
utterance.pitch = Math.max(0.7, Math.min(1.3, Number(options.pitch ?? state.settings.speechPitch ?? 1) || 1));
|
||||
utterance.volume = Math.max(0, Math.min(1, Number(options.volume ?? 1)));
|
||||
if (typeof options.onEnd === "function") utterance.onend = options.onEnd;
|
||||
if (typeof options.onError === "function") utterance.onerror = options.onError;
|
||||
|
||||
Reference in New Issue
Block a user