我希望你会好起来的。我对使用TTS(文本到语音)的Ionic 4有疑问,我尝试了Ionic本机插件,但没有解决方案。我想创建一个可以发出乌尔都语声音的应用程序。
我也使用speak-tts,但不能解决我的问题,请帮我。
我尝试使用上述NPM软件包。
export class HomePage {
speech = new Speech();
constructor(
private textToSpeech: TextToSpeech
) {
this.speech.init({
lang: 'ur-PK'
}).then((data) => {
console.log(data);
console.log('Success !');
}).catch(e => {
console.error('An error occurred :', e);
});
}
speach() {
this.speech.speak({
text: 'شیر'
}).then(() => {
console.log('Success !');
}).catch(e => {
console.error('An error occurred :', e);
});
}
}
以下是我的问题上方的答案。我像乌尔都语单词一样将乌尔都语单词转换为罗马乌尔都语英语。我使用印地语翻译单词,因为它不带有巴基斯坦乌尔都语单词。这就是为什么我测试声音并为我完美工作的原因。
export class HomePage {
speech = new Speech();
constructor(
private textToSpeech: TextToSpeech
) {
this.speech.init({
lang: 'hi-IN'
}).then((data) => {
console.log(data);
console.log('Success !');
}).catch(e => {
console.error('An error occurred :', e);
});
}
speach() {
this.speech.speak({
text: 'Shair'
}).then(() => {
console.log('Success !');
}).catch(e => {
console.error('An error occurred :', e);
});
}
}