메인 콘텐츠로 건너뛰기
플러그인으로 돌아가기
@capgo/capacitor-speech-synthesis
튜토리얼
github.com/Cap-go에 의해

음성 합성

텍스트에서 음성을 합성하고 언어, 음성,.pitch, 속도 및 음량에 대한 완전한 제어를 제공합니다.

가이드

음성 합성 튜토리얼

@capgo/capacitor-음성 합성 사용

음성 합성 플러그인: 텍스트에서 음성을 합성합니다.

설치

bun add @capgo/capacitor-speech-synthesis
bunx cap sync

이 플러그인은 다음을 제공합니다.

  • speak - 지정된 옵션으로 주어진 텍스트를 말합니다. 발화는 음성 큐에 추가됩니다.
  • synthesizeToFile - 음성 파일로 음성을 합성합니다 (Android/iOS만). 음성 파일이 저장된 경로를 반환합니다.
  • 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();

전체 참조

Using @capgo/capacitor-speech-synthesis에서 계속하세요.

__CAPGO_KEEP_0__을 사용 중이라면 Using @capgo/capacitor-speech-synthesis native 플러그인 작업을 계획하고 싶다면 @__CAPGO_KEEP_0__/__CAPGO_KEEP_1__-speech-synthesis와 연결하세요. @capgo/capacitor-speech-synthesis를 사용하여 @capgo/capacitor-speech-synthesis의 구현 세부 사항을 확인하세요. for the implementation detail in @capgo/capacitor-speech-synthesis, @__CAPGO_KEEP_0__/__CAPGO_KEEP_1__-speech-synthesis의 구현 세부 사항을 확인하세요. __CAPGO_KEEP_0__ 플러그인 디렉토리 Capgo 플러그인 디렉토리의 제품 워크플로우를 확인하세요. for the product workflow in Capgo Plugin Directory, Capacitor 플러그인들에 의해 Capgo Capacitor 플러그인들에 의해 Capgo의 구현 세부 정보에 대해 플러그인 추가 또는 업데이트 플러그인 추가 또는 업데이트의 구현 세부 정보에 대해