{"id":51244421,"url":"https://github.com/cstrp/ttsg","last_synced_at":"2026-06-29T03:01:42.864Z","repository":{"id":365902678,"uuid":"1274277002","full_name":"Cstrp/ttsg","owner":"Cstrp","description":"A NestJS-powered command-line tool for synthesizing speech with Google Cloud Text-to-Speech. Run an interactive terminal UI or use non-interactive subcommands for scripting and automation.","archived":false,"fork":false,"pushed_at":"2026-06-19T10:57:57.000Z","size":107,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-19T12:28:35.787Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Cstrp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-06-19T10:55:20.000Z","updated_at":"2026-06-19T10:58:01.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/Cstrp/ttsg","commit_stats":null,"previous_names":["cstrp/ttsg"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/Cstrp/ttsg","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cstrp%2Fttsg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cstrp%2Fttsg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cstrp%2Fttsg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cstrp%2Fttsg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Cstrp","download_url":"https://codeload.github.com/Cstrp/ttsg/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cstrp%2Fttsg/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34911134,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-29T02:00:05.398Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-06-29T03:01:39.159Z","updated_at":"2026-06-29T03:01:42.854Z","avatar_url":"https://github.com/Cstrp.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ttsg — Google Cloud Text-to-Speech CLI\n\nA NestJS-powered command-line tool for synthesizing speech with Google Cloud Text-to-Speech. Run an interactive terminal UI or use non-interactive subcommands for scripting and automation.\n\n## Features\n\n- Interactive TUI with menus for synthesis, batch processing, file management, and settings\n- Non-interactive subcommands: `synthesize`, `batch`, `voices`, `files`\n- Parallel batch synthesis with configurable concurrency (`p-limit`)\n- Persisted user preferences (voice, format, rate, pitch, output directory)\n- Typed configuration with Joi validation at startup\n- Docker support with credential and output volume mounts\n\n## Prerequisites\n\n- Node.js 22+\n- [pnpm](https://pnpm.io/)\n- A Google Cloud project with the [Cloud Text-to-Speech API](https://cloud.google.com/text-to-speech) enabled\n- A service account JSON key with Text-to-Speech permissions\n\n## GCP Setup\n\n1. Create or select a GCP project in the [Google Cloud Console](https://console.cloud.google.com/).\n2. Enable the **Cloud Text-to-Speech API** for your project.\n3. Create a service account with the **Cloud Text-to-Speech API User** role (or a custom role with `texttospeech.*` permissions).\n4. Download the service account JSON key and save it locally (e.g. `./credentials/service-account.json`).\n\n## Installation\n\n```bash\npnpm install\ncp .env.example .env\n```\n\nEdit `.env` with your project ID and credentials path.\n\n## Configuration\n\n| Variable | Description | Default |\n|----------|-------------|---------|\n| `GOOGLE_APPLICATION_CREDENTIALS` | Path to service account JSON | *(required)* |\n| `GOOGLE_CLOUD_PROJECT` | GCP project ID | *(required)* |\n| `TTS_OUTPUT_DIR` | Directory for synthesized audio | `./output` |\n| `TTS_DEFAULT_LANGUAGE` | Default BCP-47 language code | `en-US` |\n| `TTS_DEFAULT_VOICE` | Default voice name (empty = auto) | |\n| `TTS_DEFAULT_FORMAT` | Default audio format | `MP3` |\n| `TTS_SPEAKING_RATE` | Speaking rate (0.25–4.0) | `1.0` |\n| `TTS_PITCH` | Pitch (-20.0–20.0) | `0.0` |\n| `TTS_CONCURRENCY` | Batch parallel limit (1–20) | `3` |\n\n## Usage\n\n### Interactive mode (default)\n\n```bash\npnpm cli:dev\n# or after build:\npnpm cli:prod\n```\n\n### Non-interactive subcommands\n\n```bash\n# Synthesize text\nnode dist/main.js synthesize --text \"Hello, world!\" --format MP3 --output hello\n\n# Synthesize from file\nnode dist/main.js synthesize --file ./input.txt --voice en-US-Neural2-F\n\n# Batch synthesize a directory of .txt files\nnode dist/main.js batch --dir ./texts --concurrency 5\n\n# List voices\nnode dist/main.js voices --language en-US\n\n# List output files\nnode dist/main.js files\n\n# Delete an output file\nnode dist/main.js files --delete hello.mp3\n```\n\n### Supported audio formats\n\n| Format | Encoding | Extension |\n|--------|----------|-----------|\n| MP3 | MP3 | `.mp3` |\n| WAV | LINEAR16 | `.wav` |\n| OGG | OGG_OPUS | `.ogg` |\n| M4A | M4A | `.m4a` |\n\n## Docker\n\n```bash\ndocker build -t ttsg .\ndocker run -it --rm \\\n  -v $(pwd)/credentials:/app/credentials:ro \\\n  -v $(pwd)/output:/app/output \\\n  -e GOOGLE_CLOUD_PROJECT=your-project-id \\\n  ttsg synthesize --text \"Hello from Docker\"\n```\n\nOr with docker-compose:\n\n```bash\ndocker compose run --rm ttsg voices --language en-US\n```\n\n## Development\n\n```bash\npnpm cli:dev      # watch mode\npnpm test         # unit tests\npnpm lint         # ESLint\npnpm build        # compile to dist/\n```\n\n## Project structure\n\n```\nsrc/\n  config/           # Typed configuration and Joi validation\n  common/           # Shared types and constants\n  tts/              # Google TTS client and synthesis service\n  storage/          # Output file I/O\n  settings/         # Persisted user preferences\n  cli/\n    commands/       # nest-commander subcommands\n    menus/          # Interactive TUI handlers\n```\n\n## License\n\n[LICENSE](LICENSE)\n\n---\n\n\u003cp align=\"center\"\u003e\n  \u003cstrong\u003eBuilt with ❤️ by \u003ca href=\"https://github.com/Cstrp\"\u003e@Cstrp\u003c/a\u003e\u003c/strong\u003e\n\u003c/p\u003e\n\n---","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcstrp%2Fttsg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcstrp%2Fttsg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcstrp%2Fttsg/lists"}