Using @capgo/capacitor-speech-synthesis
Speech Synthesis Plugin for synthesizing speech from text.
Install
bun add @capgo/capacitor-speech-synthesis
bunx cap sync
What This Plugin Exposes
speak- Speaks the given text with specified options. The utterance is added to the speech queue.synthesizeToFile-cancel-pause-
-
speak
-
import { SpeechSynthesis } from '@capgo/capacitor-speech-synthesis';
const result = await SpeechSynthesis.speak({
text: 'Hello, world!',
language: 'en-US',
rate: 1.0,
pitch: 1.0,
volume: 1.0,
queueStrategy: 'Add'
});
console.log('Utterance ID:', result.utteranceId);
synthesizeToFile
音声合成を音声ファイルに合成し、Android/iOSのみ。音声ファイルの保存先のファイルパスを返します。
import { SpeechSynthesis } from '@capgo/capacitor-speech-synthesis';
const result = await SpeechSynthesis.synthesizeToFile({
text: 'Hello, world!',
language: 'en-US'
});
console.log('Audio file saved at:', result.filePath);
cancel
すべてのキューされた発話をキャンセルし、現在の発話を停止します。
import { SpeechSynthesis } from '@capgo/capacitor-speech-synthesis';
await SpeechSynthesis.cancel();
pause
発話を即時停止します。
import { SpeechSynthesis } from '@capgo/capacitor-speech-synthesis';
await SpeechSynthesis.pause();
フルリファレンス
- GitHub: https://github.com/Cap-go/capacitor-speech-synthesis/
- ドキュメント: /docs/plugins/speech-synthesis/
capgoの@capgo/capacitor-speech-synthesisを使用して、続行してください。
__CAPGO_KEEP_0__を使用している場合 capgo/capacitor-speech-synthesisを使用して、ネイティブプラグインの作業を計画する場合、@capgo/capacitor-speech-synthesisと接続してください。 __CAPGO_KEEP_0__/__CAPGO_KEEP_1__-speech-synthesisを使用している場合 capgo/capacitor-speech-synthesisと接続してください 実装詳細については @capgo/capacitor-speech-synthesis に Getting Started 実装詳細については Getting Started に Capgo プラグイン ディレクトリ Capgo プラグイン ディレクトリの製品ワークフローについては Capacitor プラグイン ( Capgo によって提供 ) 実装詳細については Capacitor プラグイン ( Capgo によって提供 ) に プラグインの追加または更新 実装詳細については プラグインの追加または更新 に