From 8016c0886acdeecd97057e43f2facad8feebb6be Mon Sep 17 00:00:00 2001 From: Quan HL Date: Mon, 16 Sep 2024 09:01:45 +0700 Subject: [PATCH 1/3] fix playht has stream and cached audio differrent quality --- lib/utils.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/utils.js b/lib/utils.js index 9d088c1..19c8004 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -48,6 +48,8 @@ function getFileExtension({vendor, renderForCaching = false}) { case 'deepgram': case 'elevenlabs': case 'rimlabs': + case 'playht': + case vendor.startsWith('custom') ? vendor : 'cant_match_value': if (!renderForCaching && !JAMBONES_DISABLE_TTS_STREAMING) { return r8Extension; } else { From c96f1e86eee23e368524a856802f95ca4d4fbb0e Mon Sep 17 00:00:00 2001 From: Quan HL Date: Mon, 16 Sep 2024 18:15:45 +0700 Subject: [PATCH 2/3] fix review comment --- lib/utils.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/utils.js b/lib/utils.js index 19c8004..b7a34cd 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -49,7 +49,6 @@ function getFileExtension({vendor, renderForCaching = false}) { case 'elevenlabs': case 'rimlabs': case 'playht': - case vendor.startsWith('custom') ? vendor : 'cant_match_value': if (!renderForCaching && !JAMBONES_DISABLE_TTS_STREAMING) { return r8Extension; } else { @@ -60,6 +59,12 @@ function getFileExtension({vendor, renderForCaching = false}) { case 'verbio': return r8Extension; default: + // If vendor is custom + if (vendor.startsWith('custom') && + !renderForCaching && + !JAMBONES_DISABLE_TTS_STREAMING) { + return r8Extension; + } return mp3Extension; } } From 91a5eebbafc616cf7101587a215bbb63eafc40cd Mon Sep 17 00:00:00 2001 From: Quan HL Date: Mon, 16 Sep 2024 18:46:10 +0700 Subject: [PATCH 3/3] fixed review comment --- lib/utils.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/utils.js b/lib/utils.js index b7a34cd..a6b5970 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -49,10 +49,10 @@ function getFileExtension({vendor, renderForCaching = false}) { case 'elevenlabs': case 'rimlabs': case 'playht': - if (!renderForCaching && !JAMBONES_DISABLE_TTS_STREAMING) { - return r8Extension; - } else { + if (renderForCaching || JAMBONES_DISABLE_TTS_STREAMING) { return mp3Extension; + } else { + return r8Extension; } case 'nuance': case 'nvidia': @@ -60,10 +60,12 @@ function getFileExtension({vendor, renderForCaching = false}) { return r8Extension; default: // If vendor is custom - if (vendor.startsWith('custom') && - !renderForCaching && - !JAMBONES_DISABLE_TTS_STREAMING) { - return r8Extension; + if (vendor.startsWith('custom')) { + if (renderForCaching || JAMBONES_DISABLE_TTS_STREAMING) { + return mp3Extension; + } else { + return r8Extension; + } } return mp3Extension; }