Skip to content

JstnMcBrd/dectalk-tts

Repository files navigation

dectalk-tts

API status Validate
NPM Version NPM License NPM Type Definitions NPM Downloads
Node version

About

dectalk-tts is a simple Node package to interact with the aeiou Dectalk web API. It is developed in TypeScript and transpiles to JavaScript (ESM).

Dectalk is a text-to-speech engine originally created in the 1980s. Today, it is best known for viral videos of the game Moonbase Alpha.

aeiou is a third-party web API that makes interacting with Dectalk much easier.

Warning

This package sends all input to a third-party API, which could be a possible privacy concern! By using this package, you acknowledge and agree to not hold the author of this package liable for how the third party uses your data.

Please read the usage guidelines of the API.

Prerequesites

This package has no production dependencies!

However, it does require Node 18 or higher. Use node --version to check your node version.

Installation

npm install dectalk-tts

Usage

If the API returns a non-200 response, an error will be thrown. None of the examples below include error handling, but don't forget it!

ES Modules

import dectalk from 'dectalk-tts';
import { writeFileSync } from 'node:fs';

const output = await dectalk('aeiou');
writeFileSync('output.wav', output);

CommonJS

const dectalk = require('dectalk-tts');
const { writeFileSync } = require('node:fs');

(async () => {
	const output = await dectalk('John Madden');
	writeFileSync('output.wav', output);
})();

// or

dectalk('uuuuuuuuuu').then((output) => writeFileSync('output.wav', output));

Options

Please see Chapter 2 of the Dectalk guide PDF for details on how to customize your requests. You can choose different voices, have Dectalk sing, and more!

None of these options are hard-coded into this package, so you must format the request string yourself.

(The Dectalk guide PDF was copied from the Dectalk 4.61 release download, which can be found here.)

Development

When a merge request is created, the changes must pass linting, building, and unit tests. These checks are run automatically by GitHub. You can run them manually using npm run lint, npm run build, and npm test.

GitHub will also periodically run a test to confirm the API is still working. You can run this test manually with npm run test-api.

When a new Release is created, GitHub will automatically deploy the new version to the npm registry.

This project abides by Semantic Versioning and Keep A Changelog. To see a list of changes for each update, check the description of releases on GitHub.