I already have my pre-trained model and its working fine. When I say something, it outputs the text. Now, I want to do the text-to-speech, for example when I say “I am not fine”, a wav file shall be outputted saying “what happened?”
I tried to do it using the package “node-wav-player” in the app.js and its being compiled successfully but the wav file is not outputted when I say something.
Code in app.js:
renderRecognitionOutput() {
return (<ul>
{this.state.recognitionOutput.map((r) => {
if (r.text === "I am not fine"){
const player = require('node-wav-player');
player.play({
path: 'M2File5.wav',
}).then(() => {
console.log('The wav file started to be played successfully.');
}).catch((error) => {
console.error(error);
});
}
else {
const player = require('node-wav-player');
player.play({
path: 'M2File7.wav',
}).then(() => {
console.log('The wav file started to be played successfully.');
}).catch((error) => {
console.error(error);
});
}
return (<li key={r.id}>{r.text}</li>);
})}
</ul>)
}
Please help