@marswave/coli
Advanced tools
| import type { SpeakerLanguage } from './types.js'; | ||
| export declare const defaultSpeaker: Record<SpeakerLanguage, string>; |
| export const defaultSpeaker = { | ||
| en: 'chat-girl-105-cn', | ||
| zh: 'leo-9328b6d2', | ||
| ja: 'tianzhongdunzi-5d612542', | ||
| }; |
| import { type KyInstance } from 'ky'; | ||
| import type { ApiResponse, SpeakerLanguage } from './types.js'; | ||
| export * from './constants.js'; | ||
| export type * from './types.js'; | ||
@@ -13,3 +14,3 @@ export type ListenHubApiOptions = { | ||
| * @param options - The options for the speakers request. | ||
| * @param options.language - Optional. The language of the speakers to get, defaults to list all languages. | ||
| * @param options.language - Optional. The language of the speakers to get, defaults to English. | ||
| * @returns A list of available speakers. | ||
@@ -16,0 +17,0 @@ * @see {@link https://listenhub.ai/docs/en/openapi/api-reference/speakers#list-available-speakers|List Available Speakers} |
| import ky from 'ky'; | ||
| export * from './constants.js'; | ||
| export class ListenHubApi { | ||
@@ -16,3 +17,3 @@ api; | ||
| * @param options - The options for the speakers request. | ||
| * @param options.language - Optional. The language of the speakers to get, defaults to list all languages. | ||
| * @param options.language - Optional. The language of the speakers to get, defaults to English. | ||
| * @returns A list of available speakers. | ||
@@ -19,0 +20,0 @@ * @see {@link https://listenhub.ai/docs/en/openapi/api-reference/speakers#list-available-speakers|List Available Speakers} |
| import process from 'node:process'; | ||
| import { defaultSpeaker } from '../_api/constants.js'; | ||
| import { listSpeakers, runCloudTts } from './cloud-tts.js'; | ||
@@ -20,3 +21,3 @@ function getApiKey(options) { | ||
| .option('--list-speakers', 'List available speakers') | ||
| .option('--language <lang>', 'Filter speakers by language (use with --list-speakers)') | ||
| .option('--language <lang>', 'Speaker language (en, zh, ja)') | ||
| .option('-j, --json', 'Output in JSON format (use with --list-speakers)') | ||
@@ -43,4 +44,6 @@ .action(async (text, options) => { | ||
| } | ||
| if (!options.voice) { | ||
| throw new Error('Please specify a speaker with --voice. Use --list-speakers to see available speakers.'); | ||
| const voice = options.voice ?? | ||
| (options.language && defaultSpeaker[options.language]); | ||
| if (!voice) { | ||
| throw new Error('Please specify a speaker with --voice or a language with --language. Use --list-speakers to see available speakers.'); | ||
| } | ||
@@ -50,3 +53,3 @@ const apiKey = getApiKey(options); | ||
| apiKey, | ||
| voice: options.voice, | ||
| voice, | ||
| model: options.model, | ||
@@ -53,0 +56,0 @@ output: options.output, |
@@ -18,3 +18,6 @@ # Cloud TTS | ||
| # Generate speech and play directly | ||
| # Generate speech with default voice for a language | ||
| coli cloud-tts --language en "Hello world" | ||
| # Generate speech with a specific speaker | ||
| coli cloud-tts --voice cozy-man-english "Hello world" | ||
@@ -34,6 +37,6 @@ | ||
| --voice <id> Speaker ID to use | ||
| --language <lang> Speaker language (en, zh, ja). Uses default voice if --voice is omitted | ||
| --model <name> Model to use (default: flowtts) | ||
| -o, --output <file> Save audio to file | ||
| --list-speakers List available speakers | ||
| --language <lang> Filter speakers by language: en, zh, ja (use with --list-speakers) | ||
| -j, --json Output in JSON format (use with --list-speakers) | ||
@@ -40,0 +43,0 @@ ``` |
@@ -27,5 +27,5 @@ # ListenHub OpenAPI | ||
| | Property | Type | Description | | ||
| | ---------- | ---------------------- | ---------------------------------------------- | | ||
| | `language` | `'en' \| 'zh' \| 'ja'` | Filter speakers by language. Omit to list all. | | ||
| | Property | Type | Description | | ||
| | ---------- | ---------------------- | ------------------------------------------------- | | ||
| | `language` | `'en' \| 'zh' \| 'ja'` | Filter speakers by language. Defaults to English. | | ||
@@ -32,0 +32,0 @@ **Response item** |
+1
-1
| { | ||
| "name": "@marswave/coli", | ||
| "private": false, | ||
| "version": "0.0.11", | ||
| "version": "0.0.12", | ||
| "description": "A CLI for the Cola", | ||
@@ -6,0 +6,0 @@ "repository": "marswaveai/coli", |
+1
-0
@@ -25,2 +25,3 @@ # coli | ||
| $ coli tts -v Samantha -r 200 "Hello world" | ||
| $ coli cloud-tts --language en "Hello world" | ||
| $ coli cloud-tts --voice cozy-man-english "Hello world" | ||
@@ -27,0 +28,0 @@ ``` |
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
44306
1.35%38
5.56%724
1.69%63
1.61%