having a voice recite a score

part12studiospart12studios Member Posts: 620
edited January 2012 in Working with GS (Mac)
I have a project that needs your score to SAY the time you get. Like.. "Your Time" "one" "point" "seven" "five" "seconds". each "quote" being an isolated sound effect..

I have an idea on how to do it, but my lack of understanding forces the idea to fall short. My hope is that using something similar to how custom fonts are used to display different numeric characters i could trigger an appropriate sound to speak for each of the 0-9 numbers. However I'm not sure how i could tap into that information to read off the numbers.. below is the formula used in the constratin attribute behavior for self.image.

floor(( game.Score % self.divider )/( self.divider /10))


Any advice here would be super welcome. I feel like its probably pretty easy to do, but only with a better understanding of this above formula or something similar (or heck, maybe totally different)

Thanks!
Caleb

Comments

  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    Thats gonna be a tough one cause basically its just a matter of timing and since you have so many possibilities its gonna be a massive amount of audio files to cover all the possibilities. and that doesn't begin to compare to the amount of work coding all those possibilities will be.
  • part12studiospart12studios Member Posts: 620
    Thanks for responding. I think it would only be a voice saying "zero" through "nine" and "your time was" and "seconds" not too much information.

    when i think about the score system when i use a custom font, i only have 10 number graphics which get used in several columns. my hope would be that i could tap into that same information to indicate which number to speak.

    but yea perhaps it is impossible in game salad. kinda like my problem doing a "snake" style game. perhaps with tables become available this will be more practical.
  • CloudsClouds Member Posts: 1,599
    I can't see this being particularly hard to do (if I have understood it correctly) ?

    If you time the game - and as the time progresses you pass values over to attributes (eg: if time > than 1':00" then change 'minutes' attribute to 'minute' +1)

    And then at the end of the game use these attributes to compile the voiced score.

    Minutes rule - if minutes = 1 play "one"
    Minutes rule - if minutes = 2 play "two"
    Minutes rule - if minutes = 3 play "three"
    Minutes rule - if minutes = 4 play "four"

    . . . . . all the way to 9.
  • MotherHooseMotherHoose Member Posts: 2,456
    edited January 2012
    I for one, would find an announcement including something like .75 seconds would send my cognition on a tangent to convert .75 to real seconds (45) … and, I wouldn't enjoy doing so!

    better to announce only the minutes with sound!
    and, have a clocking ticking sound running as music. (lots of nice free ones)

    add a game.minCount attribute Index type … set value at 9
    import sounds: Out of time and 1 through 9

    add a small controlTime actor:
    Timer: Every: 60 seconds
    --changeAttribute: game.minCount To: game.minCount-1
    {place in scene outside display area}

    add an announcerActor:
    Rule: when
    Attribute: game.minCount = 9
    --Play Sound
    ----SelectSound 9 … √Run to completion (so it runs only once)

    Rule: when
    Attribute: game.minCount = 8
    --Play Sound
    ----SelectSound 8 … √Run to completion (so it runs only once)

    {and so on and so forth}
    ending with: "Out of Time"

    you could make a secondCount and run that when minCount = 0 (easy as you have all the sounds but 10!)

    to keep your sound voice files uniform and small fileSize:
    download; Verbalize it is FREE
    then you just type in a number (or any text) select a voice and save … then import in GS



    @};- MH
  • part12studiospart12studios Member Posts: 620
    thanks for the encouraging ideas! To explain better.. this is a reaction time measurement so i'm dealing more in milliseconds than minutes / hours.. so my scores will always be in fractions of seconds.. so this helps keep conversion simple.. if the timer reads. 1.53 seconds.. i just read out the numbers.. 1 . 5 3 seconds

    I'll have to try some stuff.. i just don't know how to process the timer number. like if i have a value of 1.47 seconds.. i'm not sure how i know to have it say 1 4 and 7.. i mean over 1.0 to say one is easy.. but the 4 is nested between 1 and 7.. not sure how to dig into that..

    one idea could be to say.. if it's over 1.0.. say "one" and subtract 1.0.. then the next rule is like.. if it's over 9 8 7 6 5 4.. etc.. subtract that value.. and then the remaining number would be the last number said..

    The suggestions above sound good, but it sounds more like hours minuntes and seconds.. since my score is a float.. not sure if it makes a big difference.

    verbalize is neat. thanks for sharing that app!

    Thanks!
    Caleb
  • part12studiospart12studios Member Posts: 620
    yea i think i have a good system now thanks to the helpful feedback! :) you all rock!
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    I see you already have a solution, but I thought I would share a way that I did it. (Sometimes it's good to compare alternate ways.) If your solution is more efficient -- I'd sure like to hear about it.
    http://speedy.sh/93WwW/TimeFeedback.zip

    RThurman
  • part12studiospart12studios Member Posts: 620
    edited January 2012
    Hi RThurman,

    Thanks for sharing your approach.. your approach works very well. I think you deployed some stuff that was much more advanced than what i did.. mine is a bit more "pain english". I can't share my file right now because my web site is being overhauled right now and i'm waiting for some stuff to get cleared up.. but in a nutshell my approach is like this:

    My timed event passes.. it stores a value which is displayed as the time.. say .97 it saves the score to a displayed time on the HUD.. and a temp one which the voice system reads.. (the temp is very important)

    so a timer goes off when the timer is done.. and after say .5 seconds i trigger "your time"

    then at 1.2 seconds i trigger "point"

    then at 2.0 seconds i do a series of checks.. 10 rules.. each seeing if the value is greater than or less than a series of values.. is it greater than .89 or less than 1.0? if it is.. play "nine" and if it is subtract .9 from the score..

    repeat this all the way down..

    then at 2.5 seconds do the same 10 rules but this time checking.. is it greter than .089 and .010..

    then at 3.0 seconds play "seconds"

    each of these times above is also a variable.. so i can make mass changes to the timing of each set of rules.. i'm still plugging in the rules right now for the .00 range.. and these values above are all estimates. once all the rules are in place i'll have a much better idea of the pace / spacing of sounds.



    Thanks!
    Caleb


  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    @part12studios -- Ah... I see how you are parsing the number. Very ingenious! I think that's a much better solution.

    Thanks for sharing!
    RThurman
  • part12studiospart12studios Member Posts: 620
    edited January 2012
    sure thing.. i wish i had a better comprehension of the math functions. like the ones you did, because i know there are things i could do cooler stuff.

    I really hope in the next release or soon they make a better formula editor.. its really difficult to compose complex formulas and even harder to see them when dealing with a complex actor.
  • part12studiospart12studios Member Posts: 620
    as a follow up about my previous method.. i have to say that things didn't work as well in practice as they did in theory.. if anyone tries something like what i did.. the one BIG hangup that i had to figure out was the 2nd decimal place.. the first worked smoothly as planned.. but having the 2nd timer check the balance after the first subtraction didn't work as i would have thought..

    instead I had to setup a timer that changed a bool condition after x amount of time to then run the 2nd checker.. I probably should have inserted a floor or or ceil in there somewhere.. because i do get occasionally slightly off (by 01. sec) which could very well be lag between the actual value and the displayed text.. still having numbers be rounded off would be good since i was dealing in real numbers..

    So yea i finally hacked my way through it. Rthurman's way is definitely more elegant, mine is more crude but maybe easier for a beginner to grasp.

    Thanks!
    Caleb
Sign In or Register to comment.