having a voice recite a score
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
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
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.
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.
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
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
http://speedy.sh/93WwW/TimeFeedback.zip
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
Thanks for sharing!
RThurman
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.
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