![]() |
3 years ago | |
---|---|---|
.. | ||
AudioStream.js | 3 years ago | |
README.md | 3 years ago | |
background.js | 3 years ago | |
index.php | 3 years ago | |
local_server.sh | 3 years ago | |
manifest.json | 3 years ago | |
nativeTransferableStream.html | 3 years ago | |
nativeTransferableStream.js | 3 years ago | |
native_messaging_espeakng.json | 3 years ago |
Web Speech API does not support SSML input to the speech synthesis engine https://github.com/WICG/speech-api/issues/10, or the ability to capture the output of speechSynthesis.speak()
as aMedaiStreamTrack
or raw audio https://lists.w3.org/Archives/Public/public-speech-api/2017Jun/0000.html.
See Issue 1115640: [FUGU] NativeTransferableStream.
Native Messaging => eSpeak NG => PHP passthru()
=> fetch()
=> Transferable Streams => MediaStreamTrack
.
Use local espeak-ng
with -m
option set in the browser.
Output speech sythesis audio as a live MediaStreamTrack
.
Use Native Messaging, PHP passthru()
to input text and Speech Synthesis Markup Language as STDIN to espeak-ng
, stream STDOUT in “real-time” as live MediaStreamTrack
.
On origins listed in "matches"
array in "web_accessible_resources"
object in manifest.json
, e.g., at console
var text = `Test`;
var stdin = `espeak-ng -m --stdout "${text}"`;
var espeakng = new AudioStream({ stdin, recorder: true });
// espeakng.mediaStream: MediaStream containing MediaStreamTrack source output of espeak-ng --stdout
var ab = await espeakng.start();
console.log(
URL.createObjectURL(new Blob([ab], { type: 'audio/webm;codecs=opus' }))
);
Abort the request and audio output.
await espeakng.abort()
To turn local server on and off with user action pin and click the extension icon on Chromium or Chrome toolbar.