Open mohit4bug opened 1 year ago
You are using this code:
let arrayString = 'data:audio/wav;base64,' + response["audio"][0]["audioContent"] console.log(arrayString) // let arrayBuffer = atob(arrayString) // console.log(arrayBuffer) // const blob = new Blob([arrayBuffer], { type: "audio/wav; codecs=MS_PCM" }); // const url = window.URL.createObjectURL(blob); audioElement = document.getElementById("audio-output") audioElement.src = arrayString; audioElement.style.display = 'block'``` Why do you directly adding arrayString into src of audioElement, and i tried the same in vanilla JS is does not work for me. `generateButton.addEventListener("click", async () => { const source = sourceRef.value const base64 = await fetchAudio(source) // console.log(base64) let arrayString = "data:audio/wav;base64," + base64 audioElement.src = arrayString // let arrayBuffer = atob(arrayString) // console.log(arrayBuffer + "This is buffer") // const blob = new Blob([arrayBuffer], { type: "audio/wav; codecs=MS_PCM" }); // const url = window.URL.createObjectURL(blob) // audioElement.src = url }) `
Inside index.html in (front_end/index.html)
You are using this code: