I am sorry for troubling you when you are busy. I don't mind any hints or expectations, so I would appreciate it if you could tell me. this is the first time for me to question here. I am a Japanese student.
This time, I want to remake watson-voice-bot, the open source code for IBM Cloud, for Japanese. However, I've tried a lot of things for a long time, but they only speak English. I will continue to challenge, but I would be very happy if someone could give me some advice.
This code is made using the apis of three services: speech to text, text to speech, and watson assistant. The main function is a chatbot that gets the human voice on the web site and the AI responds by voice.
https://www.youtube.com/watch?v=umf5egQPPRI
What is certain now is to set the url for a foreign language in the source code to convert it to English.
So I tried to set the environment variables properly, but I remained English-speaking. Of course, natural language data sets have Japanese.
recorder.js and welcome.py, etc. tried various things, such as changing the value i think suspicious, but the chat bot itself will not work.
Especially in recorder.js, I thought that values such as recordeng would lead to a solution, but i can't come up with a clear solution because I don't have enough knowledge about Javascript.
Part of recorder.js
recorder.setupDownload = function(blob){
if($('#isRecording').prop('value')=='recordEng')
{
window.postEnglishAudio(blob);
var url = (window.URL || window.webkitURL).createObjectURL(blob);
var link = document.getElementById("saveEnglish");
link.href = url;
link.download = 'EnglishRecording.wav';
link.target = '_blank';
}
else {
window.postHindiAudio(blob);
var url = (window.URL || window.webkitURL).createObjectURL(blob);
var link = document.getElementById("saveHindi");
link.href = url;
link.download = 'HindiRecording.wav';
link.target = '_blank';
}
document.getElementById("isRecording").value="none";
// var url = (window.URL || window.webkitURL).createObjectURL(blob);
// var link = document.getElementById("save");
// link.href = url;
// link.download = filename || 'output.wav';
}
Part of welcome.py
@app.route('/api/text-to-speech', methods=['POST'])
def getSpeechFromText():
tts_kwargs = {
'username': textToSpeechUser,
'password': textToSpeechPassword,
'iam_apikey': textToSpeechIAMKey,
'url': textToSpeechUrl
}
inputText = request.form.get('text')
ttsService = TextToSpeechV1(**tts_kwargs)
def generate():
audioOut = ttsService.synthesize(
inputText,
'audio/wav',
'ja-JP_EmiVoice').get_result()
data = audioOut.content
yield data
return Response(response=generate(), mimetype="audio/x-wav")