- Speaker(text, lang?, volume?, pitch?, rate?): {
getInstance: (() => SpeechSynthesisUtterance);
getVoices: (() => SpeechSynthesisVoice[]);
setLang: ((lang: string) => void);
setPitch: ((pitch: number) => void);
setRate: ((rate: number) => void);
setText: ((txt: string) => void);
setVoice: ((voice: any) => void);
setVolume: ((volume: number) => void);
speak: (() => void);
stop: (() => void);
} Parameters
- text: string
- lang: string = 'zh-CN'
- volume: number = 1
- pitch: number = 1
- rate: number = 1
Returns {
getInstance: (() => SpeechSynthesisUtterance);
getVoices: (() => SpeechSynthesisVoice[]);
setLang: ((lang: string) => void);
setPitch: ((pitch: number) => void);
setRate: ((rate: number) => void);
setText: ((txt: string) => void);
setVoice: ((voice: any) => void);
setVolume: ((volume: number) => void);
speak: (() => void);
stop: (() => void);
}
getInstance: (() => SpeechSynthesisUtterance)
- (): SpeechSynthesisUtterance
Returns SpeechSynthesisUtterance
getVoices: (() => SpeechSynthesisVoice[])
- (): SpeechSynthesisVoice[]
Returns SpeechSynthesisVoice[]
setLang: ((lang: string) => void)
setPitch: ((pitch: number) => void)
- (pitch): void
Returns void
setRate: ((rate: number) => void)
setText: ((txt: string) => void)
setVoice: ((voice: any) => void)
- (voice): void
Returns void
setVolume: ((volume: number) => void)
- (volume): void
Returns void
speak: (() => void)
stop: (() => void)
TTS 语音,可以在现代浏览器直接运行。