import random
from gtts import gTTS
import time
from IPython.display import Image, display, clear_output
from ipywidgets import widgets
import os
import platform
speechflag = 0
if (platform.system()=='Windows'):
    speechflag = 2
if (platform.system()!='Windows'):
    speechflag = 1


display(Image('dep/images/glasses.jpg'))
tts = gTTS(text=('In this sonification,we try to represent the emptiness or fullness of something. For instance a drop of water falling into an empty glass sounds like'), lang='en')
tts.save("dep/audio/num.mp3")
if (speechflag==1):
                os.system("dep/audio/afplay num.mp3")
                os.system("dep/audio/afplay empty.mp3")
if (speechflag==2):
                os.system("cmdmp3 dep/audio/num.mp3")
                os.system("cmdmp3 dep/audio/empty.mp3")


tts = gTTS(text=('Or the same drop of water falling into a full glass might sound like'), lang='en')
tts.save("dep/audio/num.mp3")
if (speechflag==1):
                os.system("afplay dep/audio/num.mp3")
                os.system("afplay dep/audio/full.mp3")
if (speechflag==2):
                os.system("cmdmp3 dep/audio/num.mp3")
                os.system("cmdmp3 dep/audio/full.mp3")

tts = gTTS(text=('Notice, as how the saying goes, it is difficult to say if a glass is half empty '), lang='en')
tts.save("dep/audio/num.mp3")
if (speechflag==1):
                os.system("afplay dep/audio/num.mp3")
                os.system("afplay half_empty.mp3")
if (speechflag==2):
                os.system("cmdmp3 dep/audio/num.mp3")
                os.system("cmdmp3 dep/audio/half_empty.mp3")

tts = gTTS(text=('or half full '), lang='en')
tts.save("num.mp3")
if (speechflag==1):
                os.system("afplay dep/audio/num.mp3")
                os.system("afplay dep/audio/half_full.mp3")
if (speechflag==2):
                os.system("cmdmp3 dep/audio/num.mp3")
                os.system("cmdmp3 dep/audio/half_full.mp3")

tts = gTTS(text=('Ok. Hit space bar to go to the next section where you can explore this sonification (before taking the test)'), lang='en')
tts.save("num.mp3")
if (speechflag==1):
                os.system("afplay dep/audio/num.mp3")
if (speechflag==2):
                os.system("cmdmp3 dep/audio/num.mp3")
                



  


"""
Explanation: As Before, Please put on your best headphones on and Set your system Volume to 50%.
Words are not sonification, exactly, but listen in this next section use your ears!
Use Space Bar or arrows at bottom right to navigate to next section
End of explanation
"""


## Time to move onto the Exploration Module

Now that you have the general idea of this straight forward sound representation.
It is time to move on to the next phase of exploring the sonification. 
Go back to the list of available notebooks and select "Full or Empty Exploration Module"


"""
Explanation: Time to move onto the Exploration Module
Now that you have the general idea of this straight forward sound representation.
It is time to move on to the next phase of exploring the sonification. 
Go back to the list of available notebooks and select "Full or Empty Training Module"
End of explanation
"""


