Getting Started
이 플러그인의 설치 단계와 전체 마크다운 가이드를 포함한 설정 지시를 복사하세요.
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-speech-synthesis`
Run the required Capacitor sync/update step after installation.
Read this markdown guide for the full setup steps: https://raw.githubusercontent.com/Cap-go/website/refs/heads/main/apps/docs/src/content/docs/docs/plugins/speech-synthesis/getting-started.mdx
Use that guide for platform-specific steps, native file edits, permissions, config changes, imports, and usage setup.
If that guide references other docs pages, read them too.
AI-Assisted Setup을 사용하여 플러그인을 설치할 수 있습니다. AI 도구에 다음 명령어를 사용하여 Capgo 기능을 추가하세요:
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-plugins다음 명령어를 사용하여 다음 프롬프트를 사용하세요:
Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-speech-synthesis` plugin in my project.만약 Manual Setup을 선호한다면, 플러그인을 설치하기 위해 다음 명령어를 실행하고 아래의 플랫폼별 지침을 따르세요:
bun add @capgo/capacitor-speech-synthesisbunx cap syncImport
Import 섹션import { SpeechSynthesis } from '@capgo/capacitor-speech-synthesis';API 개요
API 개요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();resume
“resume” 제목의 섹션음성 출력이 일시 중단됩니다.
import { SpeechSynthesis } from '@capgo/capacitor-speech-synthesis';
await SpeechSynthesis.resume();isSpeaking
“isSpeaking” 제목의 섹션현재 음성 합성 중인지 확인합니다.
import { SpeechSynthesis } from '@capgo/capacitor-speech-synthesis';
const { isSpeaking } = await SpeechSynthesis.isSpeaking();console.log('Is speaking:', isSpeaking);isAvailable
“isAvailable” 제목의 섹션장치에서 음성 합성이 사용 가능한지 확인합니다.
import { SpeechSynthesis } from '@capgo/capacitor-speech-synthesis';
const { isAvailable } = await SpeechSynthesis.isAvailable();if (isAvailable) { console.log('Speech synthesis is available');}getVoices
“getVoices” 제목의 섹션사용 가능한 모든 음성 출력을 가져옵니다.
import { SpeechSynthesis } from '@capgo/capacitor-speech-synthesis';
const { voices } = await SpeechSynthesis.getVoices();voices.forEach(voice => { console.log(`${voice.name} (${voice.language})`);});getLanguages
getLanguages 섹션모든 사용 가능한 언어를 가져옵니다.
import { SpeechSynthesis } from '@capgo/capacitor-speech-synthesis';
const { languages } = await SpeechSynthesis.getLanguages();console.log('Available languages:', languages);isLanguageAvailable
isLanguageAvailable 섹션특정 언어가 사용 가능한지 확인합니다.
import { SpeechSynthesis } from '@capgo/capacitor-speech-synthesis';
const { isAvailable } = await SpeechSynthesis.isLanguageAvailable({ language: 'es-ES'});console.log('Spanish available:', isAvailable);isVoiceAvailable
isVoiceAvailable 섹션특정 음성이 사용 가능한지 확인합니다.
import { SpeechSynthesis } from '@capgo/capacitor-speech-synthesis';
const { isAvailable } = await SpeechSynthesis.isVoiceAvailable({ voiceId: 'com.apple.ttsbundle.Samantha-compact'});console.log('Voice available:', isAvailable);initialize
initialize 섹션speech synthesis 엔진을 초기화합니다 (iOS 최적화). 이것은 첫 번째 음성 요청에 대한 지연 시간을 줄일 수 있습니다.
import { SpeechSynthesis } from '@capgo/capacitor-speech-synthesis';
await SpeechSynthesis.initialize();activateAudioSession
활성화 오디오 세션iOS에서 오디오 세션을 특정 카테고리와 활성화합니다.
import { SpeechSynthesis } from '@capgo/capacitor-speech-synthesis';
await SpeechSynthesis.activateAudioSession({ category: 'Playback'});deactivateAudioSession
비활성화 오디오 세션iOS에서 오디오 세션을 비활성화합니다.
import { SpeechSynthesis } from '@capgo/capacitor-speech-synthesis';
await SpeechSynthesis.deactivateAudioSession();타입 참조
타입 참조SpeakOptions
발음 옵션텍스트를 발음하는 옵션입니다.
export interface SpeakOptions { /** * The text to speak. * * @since 1.0.0 */ text: string;
/** * The BCP-47 language tag (e.g., 'en-US', 'es-ES'). * * @since 1.0.0 */ language?: string;
/** * The voice identifier to use. * * @since 1.0.0 */ voiceId?: string;
/** * The pitch of the voice (0.5 to 2.0, default: 1.0). * * @since 1.0.0 */ pitch?: number;
/** * The speaking rate (0.1 to 10.0, default: 1.0). * * @since 1.0.0 */ rate?: number;
/** * The volume (0.0 to 1.0, default: 1.0). * * @since 1.0.0 */ volume?: number;
/** * The queue strategy: 'Add' to append or 'Flush' to replace queue. * Default: 'Add' * * @since 1.0.0 */ queueStrategy?: 'Add' | 'Flush';}SpeakResult
SpeakResult문장을 말하는 결과입니다.
export interface SpeakResult { /** * Unique identifier for this utterance. * * @since 1.0.0 */ utteranceId: string;}SynthesizeToFileResult
SynthesizeToFileResult파일로 합성하는 결과입니다.
export interface SynthesizeToFileResult { /** * The file path where audio was saved. * * @since 1.0.0 */ filePath: string;
/** * Unique identifier for this utterance. * * @since 1.0.0 */ utteranceId: string;}VoiceInfo
VoiceInfo음성 정보입니다.
export interface VoiceInfo { /** * Unique voice identifier. * * @since 1.0.0 */ id: string;
/** * Display name of the voice. * * @since 1.0.0 */ name: string;
/** * BCP-47 language code. * * @since 1.0.0 */ language: string;
/** * Gender of the voice (iOS only). * * @since 1.0.0 */ gender?: 'male' | 'female' | 'neutral';
/** * Whether this voice requires a network connection. * * @since 1.0.0 */ isNetworkConnectionRequired?: boolean;
/** * Whether this is the default voice (Web only). * * @since 1.0.0 */ default?: boolean;}IsLanguageAvailableOptions
IsLanguageAvailableOptions언어 사용 가능성 확인 옵션입니다.
export interface IsLanguageAvailableOptions { /** * The BCP-47 language code to check. * * @since 1.0.0 */ language: string;}IsVoiceAvailableOptions
Section titled “IsVoiceAvailableOptions”음성 사용 가능성 확인 옵션
export interface IsVoiceAvailableOptions { /** * The voice ID to check. * * @since 1.0.0 */ voiceId: string;}ActivateAudioSessionOptions
Section titled “ActivateAudioSessionOptions”iOS에서만 사용 가능한 오디오 세션 활성화 옵션
export interface ActivateAudioSessionOptions { /** * The audio session category. * - 'Ambient': Mixes with other audio * - 'Playback': Stops other audio * * @since 1.0.0 */ category: 'Ambient' | 'Playback';}UtteranceEvent
Section titled “UtteranceEvent”음성 발화 시작 또는 종료 시 발생하는 이벤트
export interface UtteranceEvent { /** * The utterance identifier. * * @since 1.0.0 */ utteranceId: string;}BoundaryEvent
Section titled “BoundaryEvent”음성 단위 경계 시 발생하는 이벤트
export interface BoundaryEvent { /** * The utterance identifier. * * @since 1.0.0 */ utteranceId: string;
/** * The character index in the text. * * @since 1.0.0 */ charIndex: number;
/** * The character length of the current word. * * @since 1.0.0 */ charLength?: number;}ErrorEvent
에러 이벤트합성 오류 시 발생하는 이벤트입니다.
export interface ErrorEvent { /** * The utterance identifier. * * @since 1.0.0 */ utteranceId: string;
/** * The error message. * * @since 1.0.0 */ error: string;}실질적 참조점
실질적 참조점이 페이지는 플러그인의 src/definitions.ts공개 API이 업스트림에서 변경될 때 다시 싱크를 실행하세요.
Getting Started에서 계속
Getting Started에서 계속Getting Started을 사용하여 대시보드와 __CAPGO_KEEP_0__를 계획하고 운영하고 싶다면 Getting Started 대시보드와 API를 계획하고 운영하기 위해 Getting Started을 연결하세요. Capgo 사용을 위한 @capgo/capacitor-speech-synthesis Capgo 사용을 위한 native 기능 @capgo/capacitor-speech-synthesis API 개요 Capgo 사용을 위한 구현 세부 정보 API 개요 소개 소개의 구현 세부 정보 API 키 Capgo 사용을 위한 구현 세부 정보 API 키, 장치 장치의 구현 세부 정보