I am using TTS polly to convert text to speech.
Issue is voice is not clear and loud also , actually pitch issue is their.
below is the function that accepts parameters for tts aws polly
_ttsBuildParam(buildParamInfo) {
const { speed, voiceId, languageCode, speedRate } = buildParamInfo;
let text = buildParamInfo?.text;
let formattedText;
// add a pause of 0.5 sec if new line comes
text = text.replace(/\./g, '.<break time="500ms"/>');
if (text.startsWith("<")) {
//if text is received with tags
formattedText = `<speak>${text}</speak>`;
} else {
let rate;
// if speed rate comes as number value then set the rate else we can go for normal speed
if (speedRate) {
rate = Number(speedRate);
} else {
// set the speed for slow,normal and fast voice
rate = speed === "slow" ? 70 : (speed === "normal") ? 85 : 100;
}
formattedText = `<speak><prosody rate="${rate}%">${text}</prosody></speak>`;
}
return {
TextType: this.options.ivrPollySynthesizeSpeechTextType,
Text: `${formattedText}`,
OutputFormat: "mp3",
VoiceId: voiceId || this.options.ivrPollySynthesizeSpeechVoiceId,
SampleRate: this.options.ivrPollySynthesizeSpeechSampleRate,
// languageCode passed for setting voice type
LanguageCode: languageCode || "en-US"
};
}
Here voiceId is like “Joanna” in case of english and “Lupe” in case of spanish
SampleRate is 8000
Any help on this ?
@scolasticodev