# tts-simple

> A simple and lightweight package for text to speach conversion

Latest version **1.0.2** (published 2020-12-10) · ISC license · 0 weekly downloads

## Install

```sh
npm install tts-simple
pnpm add tts-simple
yarn add tts-simple
bun add tts-simple
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2020-12-10 |
| First published | 2020-12-10 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 2.7 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | CheeseDanish |
| Maintainers | cheesedanish |
| Keywords | tts, discordjs, nodejs, text-to-speach, simple |

## Links

- npm: https://www.npmjs.com/package/tts-simple
- Repository: https://github.com/CheeseDanish1/tts-simple
- Homepage: https://github.com/CheeseDanish1/tts-simple#README
- Issues: https://github.com/CheeseDanish1/tts-simple/issues
- npm.io page: https://npm.io/package/tts-simple

## Dependencies (1)

- [request](https://npm.io/package/request.md) ^2.88.2

## Recent versions

- 1.0.2 (latest) — 2020-12-10
- 1.0.1 — 2020-12-10
- 1.0.0 — 2020-12-10

## README

# What is this?

This is a simple and light weight package for turning text into a .mp3 file

# Installation

```
npm i tts-simple
```
---

# Paramaters
```js
const tts = require('tts-simple')

tts({
  text: "The text you want it to say",
  fileName: "The name of this file (make this unique)"
})
```
None of these params are optional

---

# Simple Example
```js
const tts = require('tts-simple)

tts({
  text: "Hello there",
  fileName: "greeting"
})
```

This will create a mp3 file name greeting with the audio saying `Hello there`

---

# Example text to speech command in discordjs

```js
const tts = require('tts-simple')
const text = message.content.split(/ +/g).slice(1).join(" ")
const fileName = `tts_${message.id}`

if (!message.member.voice.channel) return message.channel.send("You need to be in a voice channel")

let res = tts({text: text, fileName: fileName})
if (res.type == "error") return message.channel.send(res.message)

const connection = await message.member.voice.channel.join()

const dispatcher = await connection.play(fileName)

dispatcher.on('finish', () => {
        dispatcher.destroy();
        connection.disconnect();
        try {
            fs.unlinkSync(`tts_${message.id}.mp3`)
        } catch(err) {
            console.error(err)
        }
    });

dispatcher.on('error', console.error);
```

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