Created
June 4, 2022 12:56
-
-
Save GitHub30/7220ac68bc613c2941bcd26cbbf9efec to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
}); |
Author
GitHub30
commented
Jun 4, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment