# earthy-player

> Intelligently convert HTML to audio.

Latest version **0.7.0** (published 2023-03-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install earthy-player
pnpm add earthy-player
yarn add earthy-player
bun add earthy-player
```

Provides the command `earthy`.

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.7.0 |
| Published | 2023-03-14 |
| First published | 2020-08-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 9 |
| Unpacked size | 3 MB |
| Known vulnerabilities | 0 (+24 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 3 |
| Maintainers | phildeschaine |
| Keywords | text to speech |

## Links

- npm: https://www.npmjs.com/package/earthy-player
- Repository: https://github.com/Arro/earthy-player
- Homepage: https://github.com/Arro/earthy-player#readme
- Issues: https://github.com/Arro/earthy-player/issues
- npm.io page: https://npm.io/package/earthy-player

## Dependencies (9)

- [axios](https://npm.io/package/axios.md) ^0.27.2
- [jsdom](https://npm.io/package/jsdom.md) ^19.0.0
- [dotenv](https://npm.io/package/dotenv.md) ^16.0.3
- [moment](https://npm.io/package/moment.md) ^2.29.4
- [core-js](https://npm.io/package/core-js.md) ^3.29.1
- [fs-extra](https://npm.io/package/fs-extra.md) ^10.1.0
- [lodash.curry](https://npm.io/package/lodash.curry.md) ^4.1.1
- [filenamify-url](https://npm.io/package/filenamify-url.md) ^3.0.0
- [@google-cloud/text-to-speech](https://npm.io/package/@google-cloud/text-to-speech.md) ^3.4.0

## Recent versions

- 0.7.0 (latest) — 2023-03-14
- 0.6.1 — 2022-06-01
- 0.6.0 — 2022-02-06
- 0.5.11 — 2021-11-15
- 0.5.10 — 2021-11-15
- 0.5.9 — 2021-11-15
- 0.5.8 — 2021-11-15
- 0.5.7 — 2021-11-15
- 0.5.6 — 2021-11-15
- 0.5.5 — 2021-11-15
- 0.5.4 — 2021-11-09
- 0.5.3 — 2021-11-09
- 0.5.2 — 2021-10-19
- 0.5.1 — 2021-10-19
- 0.5.0 — 2021-10-18
- … 23 more at https://npm.io/package/earthy-player/versions

## README

# Earthy Player

<img src="https://repository-images.githubusercontent.com/287707812/2242f100-4a9f-11eb-92b5-aa7d76758c55" width=300/>

### Intelligently convert HTML to audio.

[![CircleCI](https://img.shields.io/circleci/build/gh/Arro/earthy-player)](https://circleci.com/gh/Arro/earthy-player)

## Motivation

I've never been a fast reader. When I'm given a choice between a physical book, and an audiobook of
the same content, I'll reach for the latter... 100 times out of 100. Whenever there's a long piece
of text I need to read, I always look for an audio option first. While these options are expanding
in recent years, the vast majority of online prose does not allow for listening.

You can use your device's in-built accessibility tools to do text-to-speech. You can ask Siri "read
this article" and it **sometimes** works. But even when it does, this is far from ideal.

I've tried various text-to-speech APIs, and Google Cloud's is the best I've found. They use some
sort of machine-learning magic, and as a result, the output sounds extremely lifelike. This is far
more similar to a real human voice than AWS' equivalent offering ("Polly"), for example.

So I find myself writing various packages to convert HTML to an audio file I can listen to.
Therefore, I wanted to make an npm package from which all of my _other_ projects can import. This is
that project.

## What It Does

It can do the following things:

1. Take an HTML file and pull out the actual content of the article.
1. Break this text apart into "segments". This means putting pauses in the places where pauses
   should go, adding sound effects as desired, and cleaning up various abbreviations.
1. Take this "segments" file from the previous step and create an mp3 file.

Also:

1. The Google API will not work if you give it too much text at a time. This repo abstracts away
   that problem for you, chunking it into separate requests.
1. There are other potential headaches this repo may alleviate, and I will add them to this list
   later.

## Quick Start

You'll need to create a [Google Cloud](https://cloud.google.com/) API key. You can use
[this article](https://cloud.google.com/docs/authentication/getting-started) as instructions, but
the important part is that you end up with a file at `~/.google-api-credentials.json`. You'll need
to create a project within their console, and then enable the "Cloud Text-to-Speech API" on that
project.

You'll also need `ffmpeg` installed. Install this with `brew install ffmpeg` or similar.

Let's say you want to convert
[this article](https://local.theonion.com/cat-seemed-perfectly-content-right-up-until-point-he-bo-1819575397)
to speech. First clone this repo:

`git clone https://github.com/Arro/earthy-player.git`

Next, go to the example directory:

`cd earthy-player/example`

Next, install the example:

`npm install`

Now, run it:

`npm start`

Finally, check your `~/Downloads` folder. There should be a new folder there called `readme-cat/`.

## Run the Tests

These are the commands:

1. `npm run test` to run the tests. This repo uses `ava` for testing.
1. `npm run tdd` to run the test with "--watch" enabled.

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