# @junaga/tts

> A simple CLI around `@google-cloud/text-to-speech`, with support for "Speech Markdown"

Latest version **0.2.0** (published 2021-10-24) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install @junaga/tts
pnpm add @junaga/tts
yarn add @junaga/tts
bun add @junaga/tts
```

Provides the command `tts`.

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.2.0 |
| Published | 2021-10-24 |
| First published | 2021-10-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM |
| Dependencies | 5 |
| Unpacked size | 7.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | junaga |
| Maintainers | junaga |

## Links

- npm: https://www.npmjs.com/package/@junaga/tts
- Repository: https://github.com/junaga/text-to-speech
- Homepage: https://github.com/junaga/text-to-speech#readme
- Issues: https://github.com/junaga/text-to-speech/issues
- npm.io page: https://npm.io/package/@junaga/tts

## Dependencies (5)

- [fs-extra](https://npm.io/package/fs-extra.md) ^10.0.0
- [prettier](https://npm.io/package/prettier.md) ^2.4.1
- [commander](https://npm.io/package/commander.md) ^8.2.0
- [speechmarkdown-js](https://npm.io/package/speechmarkdown-js.md) ^1.9.0
- [@google-cloud/text-to-speech](https://npm.io/package/@google-cloud/text-to-speech.md) ^3.3.1

## Recent versions

- 0.2.0 (latest) — 2021-10-24
- 0.1.0 — 2021-10-24

## README

A CLI to transform written text files (`.txt`, `.smd` and `.ssml`) into naturally sounding, spoken human voice, audio files (`.mp3` or `.wav`). Using the [partially free](https://cloud.google.com/text-to-speech/pricing), Google Cloud Platform, Machine Learning, Text to Speech API.

- [API demo](https://cloud.google.com/text-to-speech#section-2)
- [API docs](https://cloud.google.com/text-to-speech/docs/apis)
- [Speech Markdown (`.smd`) docs](https://www.speechmarkdown.org/basics/what/)

## Get a GCP service account

You need a GCP _service account_ JSON key file as credential to authenticate against the API. A service account is a Google account, but for computers/containers, not humans.

1. Option one

   Ask your local GCP admin. lol

1. Option two

   Follow [this guide](https://cloud.google.com/text-to-speech/docs/before-you-begin#overview), where you're going to:

   1. Create a [GCP Project](https://cloud.google.com/docs/overview), with billing enabled
   2. Turn on the Text to Speech API
   3. Generated a [service account](https://cloud.google.com/docs/authentication/production) that has project access (i.e. viewer)

Set the `GOOGLE_APPLICATION_CREDENTIALS` environment variable to the _absolute_, not _relative_ path of the key file. The variable is read by the `@google-cloud/text-to-speech` package, the APIs' official nodejs client used in this tool.

## Usage

```sh
sudo npm install --global @junaga/tts

# # Assuming the following:
# $ ls -1
# service-account.json
# text-smd-or-ssml-files/

# use the `$PWD` variable to save 5 seconds of your life
export GOOGLE_APPLICATION_CREDENTIALS=$PWD/service-account.json

# The default `--voice` is `germanSales`
tts --voice tikTok text-smd-or-ssml-files/ mp3-output/

# Check out `mp3-output/`
```

Run `tts --help` for all options.

---
_Source: https://npm.io/package/@junaga/tts · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
