@neosapience/n8n-nodes-typecast 1.2.4 → 1.2.6
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/README.md +19 -3
- package/dist/nodes/Typecast/Typecast.node.js +20 -18
- package/dist/nodes/Typecast/Typecast.node.js.map +1 -1
- package/dist/nodes/Typecast/resources/speech/index.js +5 -4
- package/dist/nodes/Typecast/resources/speech/index.js.map +1 -1
- package/dist/nodes/Typecast/resources/voice/index.js +1 -1
- package/dist/nodes/Typecast/shared/output.d.ts +2 -0
- package/dist/nodes/Typecast/shared/output.js +12 -0
- package/dist/nodes/Typecast/shared/output.js.map +1 -0
- package/dist/package.json +1 -9
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/nodes/Typecast/Typecast.node.ts +20 -20
- package/nodes/Typecast/resources/speech/index.ts +5 -4
- package/nodes/Typecast/resources/voice/index.ts +1 -1
- package/nodes/Typecast/shared/output.ts +9 -0
- package/package.json +1 -9
|
@@ -21,9 +21,20 @@ import {
|
|
|
21
21
|
import { voiceDescription } from './resources/voice';
|
|
22
22
|
import { speechDescription } from './resources/speech';
|
|
23
23
|
import { subscriptionDescription } from './resources/subscription';
|
|
24
|
+
import { silenceOutput } from './shared/output';
|
|
24
25
|
|
|
25
26
|
const CLONING_MAX_FILE_SIZE = 25 * 1024 * 1024;
|
|
26
27
|
|
|
28
|
+
function voiceDisplayName(voice: IDataObject): string {
|
|
29
|
+
const name = voice.voice_name;
|
|
30
|
+
if (typeof name === 'string') return name;
|
|
31
|
+
if (name && typeof name === 'object' && !Array.isArray(name)) {
|
|
32
|
+
const localized = name as IDataObject;
|
|
33
|
+
return (localized.eng || localized.kor || Object.values(localized)[0] || voice.voice_id) as string;
|
|
34
|
+
}
|
|
35
|
+
return voice.voice_id as string;
|
|
36
|
+
}
|
|
37
|
+
|
|
27
38
|
function guessAudioMime(filename: string, fallback: string | undefined, node: INode): string {
|
|
28
39
|
const lower = filename.toLowerCase();
|
|
29
40
|
if (lower.endsWith('.wav')) return 'audio/wav';
|
|
@@ -130,15 +141,14 @@ export class Typecast implements INodeType {
|
|
|
130
141
|
qs.model = model;
|
|
131
142
|
}
|
|
132
143
|
|
|
133
|
-
|
|
134
|
-
const response = await typecastApiRequest.call(this, 'GET', '/voices', {}, qs, 'v2');
|
|
144
|
+
const response = await typecastApiRequest.call(this, 'GET', '/voices', {}, qs, 'v3');
|
|
135
145
|
|
|
136
146
|
// Process the response - it could be an array directly or wrapped in a result object
|
|
137
147
|
const voices = Array.isArray(response) ? response : response.result || [];
|
|
138
148
|
|
|
139
149
|
for (const voice of voices) {
|
|
140
150
|
const voiceId = voice.voice_id;
|
|
141
|
-
const voiceName = voice
|
|
151
|
+
const voiceName = voiceDisplayName(voice);
|
|
142
152
|
const gender = voice.gender
|
|
143
153
|
? voice.gender.charAt(0).toUpperCase() + voice.gender.slice(1)
|
|
144
154
|
: 'Unknown';
|
|
@@ -288,7 +298,7 @@ export class Typecast implements INodeType {
|
|
|
288
298
|
const response = (await typecastApiRequestFormData.call(
|
|
289
299
|
this,
|
|
290
300
|
'POST',
|
|
291
|
-
'/voices/clone',
|
|
301
|
+
'/custom-voices/instant-clone',
|
|
292
302
|
form,
|
|
293
303
|
{},
|
|
294
304
|
'v1',
|
|
@@ -321,7 +331,7 @@ export class Typecast implements INodeType {
|
|
|
321
331
|
await typecastApiRequestNoContent.call(
|
|
322
332
|
this,
|
|
323
333
|
'DELETE',
|
|
324
|
-
`/voices/${encodeURIComponent(voiceId)}`,
|
|
334
|
+
`/custom-voices/${encodeURIComponent(voiceId)}`,
|
|
325
335
|
{},
|
|
326
336
|
'v1',
|
|
327
337
|
);
|
|
@@ -357,7 +367,7 @@ export class Typecast implements INodeType {
|
|
|
357
367
|
qs.use_cases = filters.use_cases;
|
|
358
368
|
}
|
|
359
369
|
|
|
360
|
-
const response = await typecastApiRequest.call(this, 'GET', '/voices', {}, qs, '
|
|
370
|
+
const response = await typecastApiRequest.call(this, 'GET', '/voices', {}, qs, 'v3');
|
|
361
371
|
returnData.push(
|
|
362
372
|
...this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(response), {
|
|
363
373
|
itemData: { item: i },
|
|
@@ -398,7 +408,7 @@ export class Typecast implements INodeType {
|
|
|
398
408
|
`/voices/${encodeURIComponent(voiceId)}`,
|
|
399
409
|
{},
|
|
400
410
|
{},
|
|
401
|
-
'
|
|
411
|
+
'v3',
|
|
402
412
|
);
|
|
403
413
|
returnData.push(
|
|
404
414
|
...this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(response), {
|
|
@@ -513,7 +523,7 @@ export class Typecast implements INodeType {
|
|
|
513
523
|
}
|
|
514
524
|
|
|
515
525
|
// Add output settings (target_lufs is mutually exclusive with volume)
|
|
516
|
-
const output: IDataObject =
|
|
526
|
+
const output: IDataObject = silenceOutput(additionalOptions.removeSilenceMs);
|
|
517
527
|
const targetLufs = additionalOptions.targetLufs;
|
|
518
528
|
const volumeOpt = additionalOptions.volume;
|
|
519
529
|
if (targetLufs !== undefined && volumeOpt !== undefined && volumeOpt !== 100) {
|
|
@@ -541,10 +551,6 @@ export class Typecast implements INodeType {
|
|
|
541
551
|
body.output = output;
|
|
542
552
|
}
|
|
543
553
|
|
|
544
|
-
// Add seed if provided
|
|
545
|
-
if (additionalOptions.seed !== undefined) {
|
|
546
|
-
body.seed = additionalOptions.seed;
|
|
547
|
-
}
|
|
548
554
|
|
|
549
555
|
const binaryProperty = additionalOptions.binaryProperty || 'data';
|
|
550
556
|
const audioFormat = additionalOptions.audioFormat || 'wav';
|
|
@@ -643,7 +649,7 @@ export class Typecast implements INodeType {
|
|
|
643
649
|
}
|
|
644
650
|
|
|
645
651
|
// Streaming output rejects volume, but supports target_lufs.
|
|
646
|
-
const output: IDataObject =
|
|
652
|
+
const output: IDataObject = silenceOutput(additionalOptions.removeSilenceMs);
|
|
647
653
|
if (
|
|
648
654
|
additionalOptions.targetLufs !== undefined &&
|
|
649
655
|
additionalOptions.volume !== undefined &&
|
|
@@ -671,9 +677,6 @@ export class Typecast implements INodeType {
|
|
|
671
677
|
body.output = output;
|
|
672
678
|
}
|
|
673
679
|
|
|
674
|
-
if (additionalOptions.seed !== undefined) {
|
|
675
|
-
body.seed = additionalOptions.seed;
|
|
676
|
-
}
|
|
677
680
|
|
|
678
681
|
const binaryProperty = (additionalOptions.binaryProperty as string) || 'data';
|
|
679
682
|
const audioFormat = (additionalOptions.audioFormat as string) || 'wav';
|
|
@@ -775,7 +778,7 @@ export class Typecast implements INodeType {
|
|
|
775
778
|
|
|
776
779
|
// with-timestamps accepts the same Output object as textToSpeech.
|
|
777
780
|
// Volume and target_lufs are mutually exclusive at the server.
|
|
778
|
-
const output: IDataObject =
|
|
781
|
+
const output: IDataObject = silenceOutput(additionalOptions.removeSilenceMs);
|
|
779
782
|
const targetLufs = additionalOptions.targetLufs;
|
|
780
783
|
const volume = additionalOptions.volume;
|
|
781
784
|
if (targetLufs !== undefined && volume !== undefined && volume !== 100) {
|
|
@@ -803,9 +806,6 @@ export class Typecast implements INodeType {
|
|
|
803
806
|
body.output = output;
|
|
804
807
|
}
|
|
805
808
|
|
|
806
|
-
if (additionalOptions.seed !== undefined) {
|
|
807
|
-
body.seed = additionalOptions.seed;
|
|
808
|
-
}
|
|
809
809
|
|
|
810
810
|
const qs: IDataObject = {};
|
|
811
811
|
if (granularity) qs.granularity = granularity;
|
|
@@ -603,12 +603,13 @@ export const speechDescription: INodeProperties[] = [
|
|
|
603
603
|
'Language code following ISO 639-3 standard Case-insensitive (both "ENG" and "eng" are accepted). If not provided, language will be auto-detected based on text content. ssfm-v30 supports 37 languages, ssfm-v21 supports 27 languages.',
|
|
604
604
|
},
|
|
605
605
|
{
|
|
606
|
-
displayName: '
|
|
607
|
-
name: '
|
|
606
|
+
displayName: 'Remaining Silence (Ms)',
|
|
607
|
+
name: 'removeSilenceMs',
|
|
608
608
|
type: 'number',
|
|
609
|
-
|
|
609
|
+
typeOptions: { minValue: 0, maxValue: 1000, numberPrecision: 0 },
|
|
610
|
+
default: 300,
|
|
610
611
|
description:
|
|
611
|
-
'
|
|
612
|
+
'Remaining detected silence in milliseconds (0–1000). Zero removes silence; omit this option to disable. Streaming playback may need additional buffering.',
|
|
612
613
|
},
|
|
613
614
|
{
|
|
614
615
|
displayName: 'Target LUFS',
|
|
@@ -141,7 +141,7 @@ export const voiceDescription: INodeProperties[] = [
|
|
|
141
141
|
},
|
|
142
142
|
default: '',
|
|
143
143
|
placeholder: 'e.g., tc_672c5f5ce59fac2a48faeaee',
|
|
144
|
-
description: 'The voice ID to look up via the
|
|
144
|
+
description: 'The voice ID to look up via the V3 voices endpoint',
|
|
145
145
|
},
|
|
146
146
|
// ----------------------------------
|
|
147
147
|
// voice:recommend
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { IDataObject } from 'n8n-workflow';
|
|
2
|
+
|
|
3
|
+
export function silenceOutput(value: unknown): IDataObject {
|
|
4
|
+
if (value === undefined || value === null) return {};
|
|
5
|
+
if (typeof value !== 'number' || !Number.isInteger(value) || value < 0 || value > 1000) {
|
|
6
|
+
throw new Error('Remaining Silence must be an integer between 0 and 1000 ms');
|
|
7
|
+
}
|
|
8
|
+
return { remove_silence_ms: value };
|
|
9
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neosapience/n8n-nodes-typecast",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.6",
|
|
4
4
|
"description": "n8n node for Typecast TTS API integration",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"n8n-community-node-package",
|
|
@@ -58,14 +58,6 @@
|
|
|
58
58
|
"dist/nodes/Typecast/Typecast.node.js"
|
|
59
59
|
]
|
|
60
60
|
},
|
|
61
|
-
"devDependencies": {
|
|
62
|
-
"@n8n/node-cli": "^0.40.3",
|
|
63
|
-
"@types/node": "^26.1.1",
|
|
64
|
-
"eslint": "9.39.5",
|
|
65
|
-
"n8n-workflow": "^2.16.0",
|
|
66
|
-
"prettier": "^3.9.5",
|
|
67
|
-
"typescript": "^6.0.3"
|
|
68
|
-
},
|
|
69
61
|
"peerDependencies": {
|
|
70
62
|
"n8n-workflow": "*"
|
|
71
63
|
}
|