# OpenAI TTS - help with playing returned MP3

**URL:** https://community.thunkable.com/t/openai-tts-help-with-playing-returned-mp3/2737229
**Category:** Web API's
**Created:** [December 3, 2023, 10:54pm UTC](https://community.thunkable.com/t/openai-tts-help-with-playing-returned-mp3/2737229 "2023-12-03T22:54:57Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![nathanburley21656](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/nathanburley21656/32/150307_2.png) [@nathanburley21656](https://community.thunkable.com/u/nathanburley21656)
#### Post date: [December 3, 2023, 10:54pm UTC](https://community.thunkable.com/t/openai-tts-help-with-playing-returned-mp3/2737229/1 "2023-12-03T22:54:57Z")

</div>

Hey All,

I’m trying to get OpenAI’s TTS to work in my app. I’ve managed to generate MP3’s with this using python and I can load them into my app and play them just fine but playing them in app… I’m not even sure it’s possible.

I’m making a successful API call (so the Auth and Content-Type and end point are all OK):

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/3/2/32ee0608d07710ac809f9433ade885fff8bd8286.png)

I’m getting a response from the end point but it’s just 4x diamonds with ?'s in each one. I assume this is because it’s trying to send an MP3 back. If I just try to ‘play’ block the response, I get nothing.

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/f/8/f87f43966046569c15b54e2e7f8f5c9d3174a64e.png)

I tried a couple of other things:

1. Treating it a base 64 encoded and playing it my appending the base64 string - no dice  

2. immediately uploading the response to cloudinary and playing from there… also no good.  

any ideas?

PS - here’s the API docs:

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/4/1/41983c8775c8ccaea8ae9eb80242ff6121913b99.png)

---

<div class="post-metadata">

### Author: ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)
#### Post date: [December 3, 2023, 11:11pm UTC](https://community.thunkable.com/t/openai-tts-help-with-playing-returned-mp3/2737229/2 "2023-12-03T23:11:33Z")

</div>

I’m not sure if this will work for what you’re trying to do but this worked for me with the Google Cloud API:

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/4/5/453f7173badc565ad2009f03c973807d22b549d9.png)

---

<div class="post-metadata">

### Author: ![nathanburley21656](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/nathanburley21656/32/150307_2.png) [@nathanburley21656](https://community.thunkable.com/u/nathanburley21656)
#### Post date: [December 4, 2023, 9:29am UTC](https://community.thunkable.com/t/openai-tts-help-with-playing-returned-mp3/2737229/3 "2023-12-04T09:29:50Z")

</div>

So that was the arrangement I first went with for the base 64 decoding. That didn’t work here as it doesn’t seem like OpenAI is returning a JSON file - I’ve tried just printing what comes back to inspect it but it either comes out as null / the four diamonds.

What are the other two blocks though? At first I thought the green one was relating to a webviewer or video control but I don’t see “set X’s source…” block relating to either. I also don’t see it in the logic box (which is green). Is it an advance version of some other block?

Ditto the particular play arrangement you have there too. I don’t see an advanced vs of play which would let do that either.

---

<div class="post-metadata">

### Author: ![nathanburley21656](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/nathanburley21656/32/150307_2.png) [@nathanburley21656](https://community.thunkable.com/u/nathanburley21656)
#### Post date: [December 4, 2023, 7:26pm UTC](https://community.thunkable.com/t/openai-tts-help-with-playing-returned-mp3/2737229/4 "2023-12-04T19:26:49Z")

</div>

Ohh you’re in Snap-to-place. OK, I just built a test app in StP and did exactly what you showed here which didn’t work ☹

Since the OpenAI TTS API is returning just an mp3, I also tried just playing the ‘response’ from the API call too. Again, no dice ☹

---

<div class="post-metadata">

### Author: ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)
#### Post date: [December 4, 2023, 9:34pm UTC](https://community.thunkable.com/t/openai-tts-help-with-playing-returned-mp3/2737229/5 "2023-12-04T21:34:40Z")

</div>

Sorry for any confusion there.

I actually had to go back and find the topic where we discussed a solution to this: [Play mp3 sound from API response](https://community.thunkable.com/t/play-mp3-sound-from-api-response/2183817)

I was able to finally get it to work… I don’t remember all of the details but they should be in that topic.

---

<div class="post-metadata">

### Author: ![nathanburley21656](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/nathanburley21656/32/150307_2.png) [@nathanburley21656](https://community.thunkable.com/u/nathanburley21656)
#### Post date: [December 4, 2023, 10:36pm UTC](https://community.thunkable.com/t/openai-tts-help-with-playing-returned-mp3/2737229/6 "2023-12-04T22:36:58Z")

</div>

Ahh thanks man, I appreciate that!

Hmm looks like I might have to start from scratch (open an StP then convert to DnD and then rebuild…ugh Thunkable - this is the stuff that breaks my heart about this program).

---

<div class="post-metadata">

### Author: ![ioannis](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ioannis/32/146956_2.png) [@ioannis](https://community.thunkable.com/u/ioannis)
#### Post date: [December 6, 2023, 11:29pm UTC](https://community.thunkable.com/t/openai-tts-help-with-playing-returned-mp3/2737229/7 "2023-12-06T23:29:20Z")

</div>

Hello @nathanburley21656  
A solution could be to use a [backend service such as Xano](https://blog.thunkable.com/backend-service-no-code-app-xano) or Firebase.  
I mean to use a third-party API to call OpenAI API, and then store the files from the response on your backend and return it as a URL on Thunkable.

---

<div class="post-metadata">

### Author: ![ioannis](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ioannis/32/146956_2.png) [@ioannis](https://community.thunkable.com/u/ioannis)
#### Post date: [November 8, 2024, 1:33pm UTC](https://community.thunkable.com/t/openai-tts-help-with-playing-returned-mp3/2737229/8 "2024-11-08T13:33:18Z")

</div>


