Hi,

first off many thanks for making this!

I'm running this script:

#file : Clock.tickTockSound.py

# IMPORTANT! Since AudioFile (http://myrobotlab.org/service/AudioFile)
# has other dependencies it must be "installed" be sure to 
# install the AudioFile service otherwise you will not be able to play
# audio files
 
#create a clock service named clock
clock = Runtime.createAndStart("clock","Clock")
#create an audio file player service named audio
audio = Runtime.createAndStart("audio","AudioFile")
def ticktock():
    #if tick.mp3 is not in the main folder (myrobotlab)
    #it should be replaced with the full file-path eg. "C:\\myrobotlab\\src\\resource\\Clock\\tick.mp3"
    #audio.playFile("tick.mp3")
    audio.playResource("/resource/Clock/tick.mp3")
#create a message between clock and audio, so a tick tock sound could be played
clock.addListener("pulse", python.name, "ticktock")
#start clock
clock.startClock()

and it works- I can hear the ticking- but I cannot see where the tick.mp3 is being triggered from; that is to say I cannot find a /resource/Clock/tick.mp3 file anywhere on my computer, so I cant see HOW its working, which is a bit worrying. In myrobotlab folder there is no resource folder- what is the (probably basic) thing I am missing?

My system is Linux Debian (mint)

again thanks for making this

spence

GroG

10 years 1 month ago

Hi And Welcome SpenMarsden 

the basic thing your missing is ELVES !!!  THERE ARE ELVES TICKING !

They are invisible most of the time - but the little devils still make noises, usually the sounds of servos breaking, or electronics frying .. but sometimes they just go Tick Tick Tick...

I like the fact you are curious enough to go exploring, and congenial enough to pleasantly ask about missing parts :D

Now the details of what's happening:

 audio.playResource("/resource/Clock/tick.mp3")

audio has another method  audio.playFile("somefile.mp3") which does what you would expect.  playResource  is playing a resource but its "inside" the myrobotlab.jar.  You can open up this jar with anything which can unzip - and inside you'll see TADAAAAAA  /resource/Clock/tick.mp3  

There's lots of other thingys in there too - pictures, Python files... mebbe even GOLD !  Ssssssh, don't let the elves find out that you know !

SpenMarsden

10 years 1 month ago

In reply to by GroG

Oh thats where it is...

So this would be the structure used by the java virtual machine? Theres quite the treasure in here- especially the python goodies. I Think I'll copy that lot to a more accessible place..whilst the machine elves are busy...

Thank you so much

Spence