@webnativellc/services
v0.1.6
Published
Text-to-Speech REST API service using local Piper models via sherpa-onnx
Maintainers
Readme
webnative-services
A Text-to-Speech REST API service using local Piper models via sherpa-onnx. Provides high-quality voice synthesis with multiple English voices.
Installation
Global Installation
npm install -g webnative-services
webnative-servicesUsing npx (No Installation Required)
npx webnative-servicesThe server will start and display the available endpoints:
Starting webnative-services...
Text-to-Speech REST API
========================
Server is running on:
➜ http://localhost:3000
➜ http://192.168.1.x:3000Development Setup
- Clone the repository
- Install dependencies:
bun install - Run the development server:
bun run dev
API Endpoints
GET /help
Returns API documentation in JSON format.
GET /voices
Returns a list of available voice models.
Response:
{
"voices": [
"en_US-amy-medium",
"en_GB-alan-medium",
...
]
}POST /tts
Generates speech from text.
Query Parameters:
voice(optional): The name of the voice model to use (e.g.,en_US-amy-medium). Defaults toen_US-amy-medium.
Body:
{
"text": "The text to convert to speech"
}Response:
Returns an audio file (audio/wav).
Example:
curl -X POST "http://localhost:3000/tts?voice=en_US-amy-medium" \
-H "Content-Type: application/json" \
-d '{"text": "Hello world"}' \
--output output.wavAvailable Voices
(Check GET /voices for the most up-to-date list)
en_GB-alan-mediumen_GB-alba-mediumen_GB-aru-mediumen_GB-cori-highen_GB-cori-mediumen_GB-jenny_dioco-mediumen_GB-northern_english_male-mediumen_GB-semaine-mediumen_GB-vctk-mediumen_US-amy-mediumen_US-bryce-mediumen_US-hfc_female-mediumen_US-hfc_male-mediumen_US-joe-mediumen_US-kusal-mediumen_US-lessac-highen_US-lessac-mediumen_US-libritts-highen_US-ryan-highen_US-ryan-medium
Publishing to NPM
Automated Publishing (Recommended)
This repository includes a GitHub Action workflow that automatically publishes to npm when a new release is created.
Configure Secrets:
- Go to repository Settings → Secrets and variables → Actions
- Add a repository secret named
NPM_TOKENwith your npm automation token.
Trigger Release:
- Update the version in
package.json:npm version patch # or minor, or major - Push changes and tags:
git push origin main --tags - Create a release on GitHub using the new tag (e.g.,
v0.1.1). - The "Publish Package" workflow will run automatically, building, testing, and publishing the package.
- Update the version in
Manual Publishing
For maintainers who want to publish updates manually:
Login to npm (first time only):
npm loginTest the package locally:
npm link npx webnative-servicesVerify package contents:
npm pack --dry-runPublish to npm:
npm publish # Note: prepublishOnly script will automatically run 'npm run build'
License
MIT
