Skip to content

Instantly share code, notes, and snippets.

@GitHub30
Created June 4, 2022 12:56
Show Gist options
  • Save GitHub30/7220ac68bc613c2941bcd26cbbf9efec to your computer and use it in GitHub Desktop.
Save GitHub30/7220ac68bc613c2941bcd26cbbf9efec to your computer and use it in GitHub Desktop.
text = document.all['question-prompt'].textContent + ' ' + document.querySelector('[aria-labelledby="question-prompt"]').textContent
text = text.replaceAll('ComputeEngine', 'コンピュートエンジン').replaceAll('Pub / Sub', 'パブサブ').replaceAll('Cloud', 'クラウド').replaceAll('Memorystore', 'メモリーストア')
const temp1 = await fetch('http://localhost:50021/audio_query?' + new URLSearchParams({speaker: 1, text}), {method: 'POST'}).then(r=>r.text())
var audioCtx = new AudioContext();
var audioFile = fetch('http://localhost:50021/synthesis?speaker=1', {method: 'POST', headers: {'content-type': 'application/json'}, body: temp1}).then(response => response.arrayBuffer()).then(buffer => audioCtx.decodeAudioData(buffer)).then(buffer => {
var track = audioCtx.createBufferSource();
track.buffer = buffer;
track.connect(audioCtx.destination);
track.start(0);
});
@GitHub30
Copy link
Author

GitHub30 commented Jun 4, 2022

speechSynthesis.speak(new SpeechSynthesisUtterance('貨物追跡アプリケーションは、センサーからデータを受信します。仮想マシンが処理できるよりも多くのデータが到着する場合があります。追加の仮想マシンを使用したくない。データの損失を防ぐために何ができますか?また、最も経済的なソリューションも必要です。 ComputeEngine仮想マシンのローカルSSDにデータを書き込む必要があります。Cloud Pub / Subキューにデータを書き込む必要があり、アプリケーションはキューからデータを読み取る必要があります。CPUを増やす必要があります。Cloud Memorystoreにデータを書き込む必要があり、アプリケーションはキャッシュからデータを読み取る必要があります。'))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment