#I found something but give me a sec to
1 messages · Page 1 of 1 (latest)
Thanks so much! This looks almost spot on the code I have. I will have to do some more troubleshooting. May be in the fact that I was running into CORS issues so spun up a proxy server and maybe my response is getting reformatted in my proxy before I send it to the client side which is why it's failing?
Better idea than what I could come up with, so not sure
Hey just wanted to say thanks again. The response type: blob is working on the front end (got rid of the proxy for now). Got my project moving along! I'll have to revisit the proxy if i want to hide the api key in the future but for now I have progress. If you are working in JS I'm happy to help if I can or post code:
const data = {
text: "The time is now 7:30 AM. It is time to begin cooking breakfast!",
voice_settings: {
stability: 0,
similarity_boost: 0
}
}
const config = {
headers: {
'xi-api-key': apiKey
},
responseType: 'blob'
};
try {
const response = await axios.post('https://api.elevenlabs.io/v1/text-to-speech/AZnzlk1XvdvUeBnXmlld', data, config)
const blob = new Blob([response.data], { type: 'audio/mpeg' });
const blobURL = URL.createObjectURL(blob)
const blobAudio = new Audio(blobURL)
blobAudio.play().catch(err => console.log('blobAudio Err:', err))