Playing audio files in Datalore

I’m not sure if this is a capability of Datalore, but I would like to convert text to sound using Google Translate’s Text-to-Speech API. I was able to get the following code to compile, however it does not play the sound. Is it possible to play sounds using Datalore? The following is the code I compiled:

from gtts import gTTS
from io import BytesIO

mp3_fp = BytesIO()
tts = gTTS(‘hello’, lang=‘en’)
tts.write_to_fp(mp3_fp)

Thank you!

Hello @S_H,

You can use IPython.display.Audio widget

1 Like

Hi Artem,

Thank you for your response! I was able to get the audio playing in my notebook using the widget you mentioned.

1 Like