@vdegenne/voicevox
v0.1.16
Published
Snar reactive controller TS helper to interact with VoiceVox TTS server.
Readme
@vdegenne/voicevox
Snar reactive controller TS helper to interact with a VOICEVOX TTS server.
Install
npm i -D @vdegenne/voicevoxUsage
First install and run VOICEVOX on your machine.
Then in your web app
import {VoicevoxClient} from '@vdegenne/voicevox';
const voicevox = new VoicevoxClient();
try {
await voicevox.connect();
voicevox.play('こんにちは');
} catch (err) {
console.error(`Server not reachable. (${err})`);
}Arguments
voicevox.play(
'こんにちは', // text
// options
{
voiceId: 0,
speed: 1,
volume: 1,
},
);Controller
voicevox is a controller, you can bind it to a LitElement custom element.
import {VoicevoxClient} from '@vdegenne/voicevox';
import {LitElement, customElement} from 'lit';
import {withController} from '@snar/lit';
const voicevox = new VoicevoxClient();
@customElement('settings-dialog')
@withController(voicevox)
class SettingsDialog extends LitElement {
// ...
}