메인 콘텐츠로 바로 가기
플러그인으로 돌아가기
@capgo/capacitor-speech-synthesis
튜토리얼
@capgo/capacitor-speech-synthesis

음성 합성

텍스트에서 음성을 합성하고 언어, 음성,.pitch, 속도 및 음량과 같은 모든 요소를 완벽하게 제어할 수 있습니다.

가이드

음성 합성에 대한 튜토리얼

장치에서 테스트

다운로드한 Capgo 앱을 열고 QR 코드 code을 스캔하세요.

음성 합성 플러그인 미리보기 QR code

Using @capgo/capacitor-speech-synthesis

음성 합성 플러그인: 텍스트에서 음성을 합성하는 플러그인

설치

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

이 기능을 사용 중이라면 Using @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 플러그인 추가 또는 업데이트 구현 세부 정보에 대한 플러그인 추가 또는 업데이트