I have this code right here which download Dynamic generated Audio from speechSynthesis API, But every time click the download button it says the file is not supported or the file extension is incorrect, So please can any one help me with this ?
const button = document.getElementById("a1")
button.addEventListener('click',function(data , name = "try.mp3"){
var voiceVal = synth.speak(speakText)
const blob = new Blob([voiceVal], {type:"audio/mpeg"})
const href = URL.createObjectURL(blob)
const a = Object.assign(document.createElement('a'), {
href,
style:"display:none",
download:"try"
});
document.body.appendChild(a)
a.click()
URL.revokeObjectURL(href)
a.remove()
})