@pompeii-labs/audio 0.0.6 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/voice.js +3 -3
- package/dist/voice.mjs +3 -3
- package/package.json +6 -3
package/dist/voice.js
CHANGED
|
@@ -375,7 +375,7 @@ function splitTextIntoChunks(text, targetLength = 100) {
|
|
|
375
375
|
const endOfSentencePunctuation = [".", "!", "?"];
|
|
376
376
|
const sentences = [];
|
|
377
377
|
for (let i = targetLength; i < text.length; i++) {
|
|
378
|
-
if (endOfSentencePunctuation.includes(text[i]) && (i === text.length - 1 || text[i + 1] === " ")) {
|
|
378
|
+
if (endOfSentencePunctuation.includes(text[i]) && (i === text.length - 1 || text[i + 1] === " " || text[i + 1] === "\n")) {
|
|
379
379
|
sentences.push(text.slice(0, i + 1));
|
|
380
380
|
text = text.slice(i + 1);
|
|
381
381
|
i = targetLength;
|
|
@@ -536,7 +536,7 @@ var DeepgramSTT = class extends MagmaFlowSpeechToText {
|
|
|
536
536
|
encoding: "linear16",
|
|
537
537
|
sample_rate: 48e3,
|
|
538
538
|
channels: 1,
|
|
539
|
-
utterance_end_ms:
|
|
539
|
+
utterance_end_ms: 1e3,
|
|
540
540
|
...args.config
|
|
541
541
|
};
|
|
542
542
|
this.client = args.client ?? new sdk.DeepgramClient({
|
|
@@ -702,7 +702,7 @@ var ElevenLabsTTS = class extends MagmaFlowTextToSpeech {
|
|
|
702
702
|
if (!text) {
|
|
703
703
|
return;
|
|
704
704
|
}
|
|
705
|
-
const textToSend = text.replaceAll(/([
|
|
705
|
+
const textToSend = text.replaceAll(/([A-Z])-([A-Z])/g, "$1 - $2").replaceAll(/([0-9])-([0-9])/g, "$1 - $2").replaceAll(/(-\s*[A-Z])\s+([A-Z]\s*-)/g, "$1 - $2").replaceAll(/(-\s*[0-9])\s+([0-9]\s*-)/g, "$1 - $2");
|
|
706
706
|
this.client.textToSpeech.stream(this.voice, {
|
|
707
707
|
text: textToSend,
|
|
708
708
|
outputFormat: "pcm_48000",
|
package/dist/voice.mjs
CHANGED
|
@@ -369,7 +369,7 @@ function splitTextIntoChunks(text, targetLength = 100) {
|
|
|
369
369
|
const endOfSentencePunctuation = [".", "!", "?"];
|
|
370
370
|
const sentences = [];
|
|
371
371
|
for (let i = targetLength; i < text.length; i++) {
|
|
372
|
-
if (endOfSentencePunctuation.includes(text[i]) && (i === text.length - 1 || text[i + 1] === " ")) {
|
|
372
|
+
if (endOfSentencePunctuation.includes(text[i]) && (i === text.length - 1 || text[i + 1] === " " || text[i + 1] === "\n")) {
|
|
373
373
|
sentences.push(text.slice(0, i + 1));
|
|
374
374
|
text = text.slice(i + 1);
|
|
375
375
|
i = targetLength;
|
|
@@ -530,7 +530,7 @@ var DeepgramSTT = class extends MagmaFlowSpeechToText {
|
|
|
530
530
|
encoding: "linear16",
|
|
531
531
|
sample_rate: 48e3,
|
|
532
532
|
channels: 1,
|
|
533
|
-
utterance_end_ms:
|
|
533
|
+
utterance_end_ms: 1e3,
|
|
534
534
|
...args.config
|
|
535
535
|
};
|
|
536
536
|
this.client = args.client ?? new DeepgramClient({
|
|
@@ -696,7 +696,7 @@ var ElevenLabsTTS = class extends MagmaFlowTextToSpeech {
|
|
|
696
696
|
if (!text) {
|
|
697
697
|
return;
|
|
698
698
|
}
|
|
699
|
-
const textToSend = text.replaceAll(/([
|
|
699
|
+
const textToSend = text.replaceAll(/([A-Z])-([A-Z])/g, "$1 - $2").replaceAll(/([0-9])-([0-9])/g, "$1 - $2").replaceAll(/(-\s*[A-Z])\s+([A-Z]\s*-)/g, "$1 - $2").replaceAll(/(-\s*[0-9])\s+([0-9]\s*-)/g, "$1 - $2");
|
|
700
700
|
this.client.textToSpeech.stream(this.voice, {
|
|
701
701
|
text: textToSend,
|
|
702
702
|
outputFormat: "pcm_48000",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pompeii-labs/audio",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.8",
|
|
4
4
|
"description": "The Audio SDK from Pompeii Labs",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Pompeii",
|
|
@@ -20,15 +20,18 @@
|
|
|
20
20
|
],
|
|
21
21
|
"repository": "pompeii-labs/pompeii-audio",
|
|
22
22
|
"main": "dist/index.js",
|
|
23
|
+
"module": "dist/index.mjs",
|
|
23
24
|
"types": "dist/index.d.ts",
|
|
24
25
|
"exports": {
|
|
25
26
|
".": {
|
|
26
27
|
"types": "./dist/index.d.ts",
|
|
27
|
-
"
|
|
28
|
+
"import": "./dist/index.mjs",
|
|
29
|
+
"require": "./dist/index.js"
|
|
28
30
|
},
|
|
29
31
|
"./voice": {
|
|
30
32
|
"types": "./dist/voice.d.ts",
|
|
31
|
-
"
|
|
33
|
+
"import": "./dist/voice.mjs",
|
|
34
|
+
"require": "./dist/voice.js"
|
|
32
35
|
}
|
|
33
36
|
},
|
|
34
37
|
"scripts": {
|