Here, I'm trying to convert the text to speech from django object and sorry to say that I don't know basic Js. Here is what I've tried.
Code
HTML
<p class="mb-1">{{ obj.reply }}</p>
<button class="btn btn-dark" onclick="txttospeech(obj.reply)">listen</button>
js
function txttospeech(txt) {
var utterance = new SpeechSynthesisUtterance();
utterance.text = txt;
speechSynthesis.speak(utterance);
}
{{ obj.reply }}there are some texts. And I want to convert it in audio.