mirror of
https://github.com/lightsoutgames/godot-tts
synced 2024-11-22 15:05:56 +00:00
Use floats for JavaScript rate, hopefully fixing slow speech issues likely caused by rate being 0.
This commit is contained in:
parent
ba22fddf37
commit
35a34871a3
6
TTS.gd
6
TTS.gd
|
@ -43,12 +43,12 @@ func speak(text, interrupt := true):
|
||||||
if tts != null:
|
if tts != null:
|
||||||
tts.speak(text, interrupt)
|
tts.speak(text, interrupt)
|
||||||
elif OS.has_feature('JavaScript'):
|
elif OS.has_feature('JavaScript'):
|
||||||
var scaled_rate
|
var scaled_rate: float
|
||||||
if javascript_rate <= 50:
|
if javascript_rate <= 50:
|
||||||
scaled_rate = javascript_rate / 50
|
scaled_rate = javascript_rate / 50.0
|
||||||
else:
|
else:
|
||||||
scaled_rate = javascript_rate - 50
|
scaled_rate = javascript_rate - 50
|
||||||
scaled_rate = 1 + (scaled_rate / 5)
|
scaled_rate = 1 + (scaled_rate / 5.0)
|
||||||
var code = """
|
var code = """
|
||||||
let utterance = new SpeechSynthesisUtterance("%s")
|
let utterance = new SpeechSynthesisUtterance("%s")
|
||||||
utterance.rate = %s
|
utterance.rate = %s
|
||||||
|
|
Loading…
Reference in New Issue
Block a user