https://github.com/theresnotime/ipa-to-ssml
Node package for converting IPA to valid SSML elements
https://github.com/theresnotime/ipa-to-ssml
ipa ssml
Last synced: 8 months ago
JSON representation
Node package for converting IPA to valid SSML elements
- Host: GitHub
- URL: https://github.com/theresnotime/ipa-to-ssml
- Owner: theresnotime
- License: mit
- Created: 2022-05-13T14:52:37.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2023-03-06T20:35:22.000Z (over 3 years ago)
- Last Synced: 2025-09-18T18:29:44.138Z (9 months ago)
- Topics: ipa, ssml
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/@theresnotime/ipa-to-ssml
- Size: 576 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Node package for converting IPA to valid SSML elements
[](https://github.com/theresnotime/ipa-to-ssml/actions/workflows/node.js.yml)
[](https://github.com/theresnotime/ipa-to-ssml/actions/workflows/codeql-analysis.yml)
[](https://packagephobia.com/result?p=@theresnotime/ipa-to-ssml)
Sometimes you just wish there was a Node.js package that did a *thing*, such as convert [IPA](https://en.wikipedia.org/wiki/International_Phonetic_Alphabet) to a valid [SSML](https://en.wikipedia.org/wiki/Speech_Synthesis_Markup_Language) element — sometimes you wish it ***so much*** you end up writing it. 😅
## Installing
Go grab it on [npmjs](https://www.npmjs.com/package/@theresnotime/ipa-to-ssml) via `npm i @theresnotime/ipa-to-ssml`
You'll then be all set to `require` it:
```js
const ipaToSSML = require('@theresnotime/ipa-to-ssml');
```
Simples!
## IPA goes in..
We pass the represented `word`, its `ipa` representation, and optionally a `variant` of SSML to generate:
```js
let ssmlResult = await ipaToSSML.convertToSSML('hello', '/həˈləʊ/', 'default');
```
## ..and SSML comes out!
```xml
hello
```
*(don't blame **me** for how ugly that looks, blame [the w3c](https://www.w3.org/TR/speech-synthesis11/)...)*
## Variants
- `default` — this is valid SSML, and *should* be accepted by all (SSML accepting) TTS engines
- `polly` — for now, just a copy of `default` 🤷♀️ works with [Amazon Polly](https://aws.amazon.com/polly/)
- `larynx` — this larger SSML element is required for getting [rhasspy/larynx](https://github.com/rhasspy/larynx) (a *very* cool TTS engine..) to play ball
## Contributing
This is the first module I've ever published to npmjs, *and* my first foray into Node modules, so there's bound to be things you spot and want to fix — I'd love to get your feedback and PRs!
### Quick steps
1. [Fork n' clone](https://docs.github.com/en/get-started/quickstart/contributing-to-projects) this repo
2. Do a `npm install`
3. Run `npm test` because who knows, maybe its already broken
4. Hack!
### Tests? For JavaScript!?
In writing this I discovered [Jest](https://jestjs.io/), a *"delightful JavaScript Testing Framework with a focus on simplicity"* — I dunno about that, as I've never written tests for JavaScript, but it was pretty painless :> they live in [tests/](tests/) and the syntax for them is [super simple](https://jestjs.io/docs/getting-started).