ai-text-to-speech
Advanced tools
Comparing version 1.0.4 to 1.0.5
14
index.js
@@ -38,3 +38,3 @@ import fs from 'fs'; | ||
* @param {string} [options.dest_dir='./'] - The destination directory to save the audio file. Default value is './'. | ||
* @param {string} [options.file_name='speech-audio'] - The base name of the output file. Default value is 'speech-audio'. | ||
* @param {string} [options.file_name='speech-audio'] - The base name of the output file. Default value is 'speech-audio'. Used as the prefix of the name of the generated audio file. | ||
* @param {string} [options.voice='nova'] - The voice to use for speech synthesis. Supported voices are `alloy`, `echo`, `fable`, `onyx`, `nova`, and `shimmer`. | ||
@@ -62,3 +62,3 @@ * @param {string} [options.model='tts-1'] - The TTS model to use. Valid values are `tts-1` or `tts-1-hd` | ||
// check if text input was provided | ||
// Check if text input was provided | ||
if (!input) { | ||
@@ -68,3 +68,3 @@ throw new Error('No input text provided.'); | ||
// Input lenght validation | ||
if (input.length > 4096) { | ||
@@ -75,5 +75,4 @@ throw new Error( | ||
} | ||
// Voice option validation | ||
if (!allowedVoices.includes(voice)) { | ||
@@ -87,2 +86,3 @@ throw new Error( | ||
// Model option validation | ||
if (!allowedModels.includes(model)) { | ||
@@ -96,2 +96,3 @@ throw new Error( | ||
// Model option validation | ||
if (!allowedFormats.includes(response_format)) { | ||
@@ -164,6 +165,3 @@ throw new Error( | ||
dir_path, | ||
// `${file_name ?? 'speech-audio'}${suffix?('-'+suffix):''}.${response_format}` | ||
// `${file_name}${suffix ? '-' + suffix : ''}.${response_format}` | ||
`${file_name || 'speech-audio'}${suffix ? '-' + suffix : ''}.${response_format}` | ||
); | ||
@@ -170,0 +168,0 @@ |
{ | ||
"name": "ai-text-to-speech", | ||
"version": "1.0.4", | ||
"description": "A powerful and straightforward Node.js module for generating speech audio from text using the OpenAI API (support for other providers comming soon). ai-text-to-speech offers a simple and robust interface to convert text into high-quality speech audio files in various formats and voices.", | ||
"version": "1.0.5", | ||
"description": "A powerful and straightforward Node.js module for generating AI speech audio files from text using the OpenAI API (support for other providers is in the works). ai-text-to-speech offers a simple and robust interface to convert text into high-quality speech audio files in various formats and voices.", | ||
"main": "index.js", | ||
@@ -6,0 +6,0 @@ "type": "module", |
# ai-text-to-speech | ||
*Simplify your text-to-speech integration like never before!* | ||
***Simplify your AI text-to-speech integration!*** | ||
@@ -5,0 +5,0 @@ A powerful and straightforward Node.js module for generating speech audio from text using the OpenAI API (support for other TTS providers in the works). **ai-text-to-speech** offers a simple and robust interface to convert text into high-quality speech audio files in various formats and voices. |
18911
179