mirror of
https://github.com/Pax1601/DCSOlympus.git
synced 2025-10-29 16:56:34 +00:00
Started google cloud tests
This commit is contained in:
@@ -158,8 +158,6 @@ export class AudioManager {
|
||||
this.#devices = devices;
|
||||
AudioManagerDevicesChangedEvent.dispatch(devices);
|
||||
});
|
||||
|
||||
this.#startSpeechRecognition();
|
||||
}
|
||||
|
||||
stop() {
|
||||
@@ -330,30 +328,4 @@ export class AudioManager {
|
||||
|
||||
if (this.#socket?.readyState == 1) this.#socket?.send(new Uint8Array([AudioMessageType.settings, ...Buffer.from(JSON.stringify(message), "utf-8")]));
|
||||
}
|
||||
|
||||
#startSpeechRecognition() {
|
||||
const grammar =
|
||||
"#JSGF V1.0; grammar colors; public <color> = aqua | azure | beige | bisque | black | blue | brown | chocolate | coral | crimson | cyan | fuchsia | ghostwhite | gold | goldenrod | gray | green | indigo | ivory | khaki | lavender | lime | linen | magenta | maroon | moccasin | navy | olive | orange | orchid | peru | pink | plum | purple | red | salmon | sienna | silver | snow | tan | teal | thistle | tomato | turquoise | violet | white | yellow ;";
|
||||
//@ts-ignore
|
||||
const recognition = new window.webkitSpeechRecognition();
|
||||
//@ts-ignore
|
||||
const speechRecognitionList = new window.webkitSpeechGrammarList();
|
||||
speechRecognitionList.addFromString(grammar, 1);
|
||||
recognition.grammars = speechRecognitionList;
|
||||
recognition.continuous = true;
|
||||
recognition.lang = "en-US";
|
||||
recognition.interimResults = true;
|
||||
//recognition.maxAlternatives = 1;
|
||||
|
||||
const diagnostic = document.querySelector(".output");
|
||||
const bg = document.querySelector("html");
|
||||
recognition.start();
|
||||
|
||||
|
||||
recognition.onresult = (event) => {
|
||||
const color = event.results[0][0].transcript;
|
||||
diagnostic.textContent = `Result received: ${color}`;
|
||||
bg.style.backgroundColor = color;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ export class TextToSpeechSource extends AudioSource {
|
||||
body: JSON.stringify({ text }), // Send the data in JSON format
|
||||
};
|
||||
|
||||
fetch(getApp().getExpressAddress() + `/api/texttospeech/generate`, requestOptions)
|
||||
fetch(getApp().getExpressAddress() + `/api/speech/generate`, requestOptions)
|
||||
.then((response) => {
|
||||
if (response.status === 200) {
|
||||
console.log(`Text to speech generate correctly`);
|
||||
|
||||
Reference in New Issue
Block a user