Compare commits
4 Commits
v0.0.4.3
...
9b5a35cb4a
| Author | SHA1 | Date | |
|---|---|---|---|
| 9b5a35cb4a | |||
| 5ac1a0a522 | |||
| a28b46a809 | |||
| 59c8d36a3d |
@@ -79,8 +79,8 @@ android {
|
||||
applicationId "com.ariacockpit"
|
||||
minSdkVersion rootProject.ext.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.targetSdkVersion
|
||||
versionCode 403
|
||||
versionName "0.0.4.3"
|
||||
versionCode 404
|
||||
versionName "0.0.4.4"
|
||||
// Fallback fuer Libraries mit Product Flavors
|
||||
missingDimensionStrategy 'react-native-camera', 'general'
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "aria-cockpit",
|
||||
"version": "0.0.4.3",
|
||||
"version": "0.0.4.4",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"android": "react-native run-android",
|
||||
|
||||
+11
-20
@@ -195,35 +195,27 @@ async function _runTTSRequest(payload) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Ruft /tts_to_audio/ auf und streamt das resultierende WAV bereits waehrend
|
||||
* des Empfangs in PCM-Frames an den Callback. Der WAV-Header wird einmal
|
||||
* geparst, danach werden nur noch raw PCM-Samples weitergeleitet.
|
||||
* Ruft /tts_stream (GET) auf — echter Streaming-Endpoint bei daswer123.
|
||||
* Samples fliessen waehrend XTTS rendert (chunked transfer).
|
||||
* Time-to-first-audio ~300-500ms statt 2-4s beim batch-Endpoint.
|
||||
*
|
||||
* Warum nicht echtes /tts_stream/? daswer123 hat den Endpoint, aber die
|
||||
* Audio-Quality ist dort niedriger und er produziert beim ersten Chunk
|
||||
* oft Artefakte. Pragmatischer Weg: /tts_to_audio/ + Response-Stream
|
||||
* chunkweise auslesen. Das ist zwar kein echtes Server-Streaming, aber
|
||||
* gibt uns deutlich kleinere Netzwerk-Haeppchen und die App kann via
|
||||
* AudioTrack MODE_STREAM sofort nahtlos abspielen.
|
||||
* Parameter werden als Query-String uebergeben (GET-API).
|
||||
*/
|
||||
function streamXTTSAsPCM(text, language, speakerWav, onPcmChunk) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const body = JSON.stringify({
|
||||
const qs = new URLSearchParams({
|
||||
text,
|
||||
language,
|
||||
speaker_wav: speakerWav || "",
|
||||
language: language || "de",
|
||||
speaker_wav: speakerWav ? speakerWav : "",
|
||||
stream_chunk_size: "40",
|
||||
});
|
||||
|
||||
const url = new URL(`${XTTS_API_URL}/tts_to_audio/`);
|
||||
const url = new URL(`${XTTS_API_URL}/tts_stream?${qs.toString()}`);
|
||||
const options = {
|
||||
hostname: url.hostname,
|
||||
port: url.port,
|
||||
path: url.pathname,
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"Content-Length": Buffer.byteLength(body),
|
||||
},
|
||||
path: `${url.pathname}?${url.searchParams.toString()}`,
|
||||
method: "GET",
|
||||
timeout: 60000,
|
||||
};
|
||||
|
||||
@@ -285,7 +277,6 @@ function streamXTTSAsPCM(text, language, speakerWav, onPcmChunk) {
|
||||
|
||||
req.on("error", reject);
|
||||
req.on("timeout", () => { req.destroy(); reject(new Error("XTTS API Timeout (60s)")); });
|
||||
req.write(body);
|
||||
req.end();
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user