2015-06-03 20:31:25

Folks I code for Audazzle. ( When I am allowed by Queen Dark Sock ) and one of the things that is slowing me down is developing a talking scoreboard.

Anyone got anything to share javascript or C# ... just talking numbers would do...

I'm new on here... but happy to share code and issues and learn the norms. You might find some of my stuff on stackoverflow and unity forums (same username)...

got to say I'm still rolling around after that post about socks

http://forum.audiogames.net/viewtopic.p … 19#p218819

hehe

2015-06-03 21:34:57

If all you want is numbers, you could sequence recordings of someone saying each number.
If you want text-to-speech instead, I'm not really sure. I know Javascript in IE6 use to support SAPI5 through Active X, but that seems like a terrible approach.
I suppose it has a good deal to do with your interface in general. IIUC, Unity renders text as geometric objects, which would make screen reader support difficult.
There might be a way to bundle a lightweight TTS library with a project, but there would be details to worry about with that, even before you get to how to handle it code-side.

If you could use an accessible GUI element, like a bog-standard text label or web page, screen readers could interact with it. If you're using a visually-friendly HUD, there probably wouldn't be a decent way to incorporate that, though.

I'm not familiar enough with Unity or C3 (or post HTML5 Javascript, for that matter) to be any more help ATM.

看過來!
"If you want utopia but reality gives you Lovecraft, you don't give up, you carve your utopia out of the corpses of dead gods."
MaxAngor wrote:
    George... Don't do that.

2015-06-03 21:58:19

For SAPI in C# you can add a reference to System.Speech under the .NET tab in the add reference dialog.

Here is sample code for using it:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Speech.Synthesis;

namespace SAPIExample
{
    class Program
    {
        static void Main(string[] args)
        {
            var ss = new SpeechSynthesizer();
            ss.Speak("Hello, here is some text to speech that speaks synchronously so your thread actually blocks until it is finished.");
            Console.ReadKey();
            ss.SpeakAsync("This will speak asynchronously so it doesn't block your game loop thread.  So you could press space at any time to end the program.");
            Console.ReadKey();
            // you can also stop asynchronous speech in order to play something new.
            ss.SpeakAsyncCancelAll();
        }
    } // end class
}

There are also C screen reader libraries you can wrap with PInvoke to make them usable by C#.
Quentin C. has two, and there is one called Tolk.
Craig Brett has made a C# wrapper for one of Quentin's.

Also worth noting that the System.Speech library used above has a slow memory leak.
It has a bug tracked with Microsoft, but they basically said its value to cost ratio was not high enough for them to fix.
That said, it is a good starting point.
I used it for over a year before the leak started becoming a problem for some of my players.
I've since replaced it with my own wrapper around the COM SAPI object to remove the memory leak.
I could share that sometime, but would need to clean it up first.

Hope that helps.

~ Ian Reed
Visit BlindGamers.com to rate blind accessible games and see how others have rated them.
Try my free JGT addon, the easy way to play Japanese games in English.
Or try the free games I've created.

2015-08-29 16:00:54

hey thanks for the replies, I didn't get any notification that you made the replies, but we do have a localTTS done in C# from recordings of me saying numbers etc... just debugging why it went silent today while preparing na new release. so I'm really sorry I never picked up these responses sooner.

so here is what we did. in simple terms

0. recorded a load of spoken numbers, hundred, thousand etc (there aren't that many)
1. convert number to words algorithm / method / function (choose your semantic)
2. used unity's audio file player by passing a list / array of words to it...

should have said this is for Mobile so need to support iOS, Android and other later... hence native TTS was always going to befuddle.

lots more news to share, lesson was sometimes limitations lead to really good stuff... but we are going to get some folks with more entertaining voices to improve our talking ship's computer for sure!

big thanks for these pointers!.. now this time I better subscribe to the topic! wonder what made me think that was automatic. doh!

2015-10-05 21:18:09

... and he/she now has a name MaverickTTS ... not very catchy but the it comes across quite mad... needs to speed up and the rest smile

2015-10-05 21:25:12

Ian Reed wrote:

For SAPI in C# you can add a reference to System.Speech under the .NET tab in the add reference dialog.

....

I could share that sometime, but would need to clean it up first.

Hope that helps.

YES please!

so I'm new to C# and using Unity3D for the game engine, any idea if your work would be compatible with Unity? specifically when deployed on iOS, Android and OSX... I'm taking it that windows games its a big yes.

I'd be happy to share the code we have done for MaverickTTS its just playing word lists of word.wavs but there is something endearing about it especially the mix of different voices... I expect user my hate it but its given my children and I lots of fun making it speak.

2015-10-07 22:21:02

I'm not sure, when you are talking about javascript, are you dealing with the DOM? Because changing html elements has a way that triggers screen readers to read. Just add <p id="p1" role="status"></p>
to your page and change the content of p1.

2015-10-08 00:08:51

frastlin wrote:

I'm not sure, when you are talking about javascript, are you dealing with the DOM? Because changing html elements has a way that triggers screen readers to read. Just add <p id="p1" role="status"></p>
to your page and change the content of p1.

thats interesting especially since I now have unity web player on slow cook... actually its on medium heat. well joking aside does anyone know how to get unity's web player to be even recognised ?

I was watching a tester toggle through dom objects with JAWS and it just skipped right over the embedded player like it wasn't on the page...

crazy after all the effort to make a web version for everyone...

I'll share a link before the end of the week and see who can get it to play.

Must be a known issue somewhere or I am just being dumb. (again haha)

so you are saying I can flag dom elements to make them visible to JAWS etc ?and possibly need to do this for the Unity Player container?..

effectively if your sighted you click on the player and from then your keyboard can kick in. ...

I will revert. perhaps this should have its own topic.

2015-10-08 01:02:16

I assume the C# I shared would work with Unity for Windows.
It certainly works outside of Unity, on Windows.
I am certain it will not work for any other platform as the SpeechSynthesizer just wraps a COM object, and COM objects are specific to Windows.
You would have to build a custom solution for each platform.

urfx wrote: so you are saying I can flag dom elements to make them visible to JAWS etc ?and possibly need to do this for the Unity Player container?
I say: Frastlin was actually explaining how to trigger the screen reader viewing the web page to read some text.
When you change the text in the p tag with the status aria role, the screen reader automatically announces it, similar to if you had an API like ScreenReader.Speak("Message");.
If Unity gives you access to the DOM then Frastlin's suggestion should be a very cross platform way of getting a screen reader to announce text.

~ Ian Reed
Visit BlindGamers.com to rate blind accessible games and see how others have rated them.
Try my free JGT addon, the easy way to play Japanese games in English.
Or try the free games I've created.

2015-10-08 01:19:26

unity doesn't exactly give you access to the dom but it gives you access to Javascript so we have some access ... with a bit of though. all I did so far is popping our alerts ... since I do that now on the iPhone for rewards and android too. (native pop ups)... it bags a cheap way of getting some audio read out.

so thats very cool. thanks both for the idea and the explanation

I can write a middle man function to handle what comes out of unity... and follow Frastlin's suggestion.

unity gives you

Application.ExternalCall("functionName","string")

so I can fire some JSON via the string if I need to get more... or now seemingly have an alternative to simple javascript alerts ... (which will make most sighted users I met melt down and call a known geek)...

I was rambling about just getting the unity player embedded in such a way that a screen reader would tell you its there and let you select it.

I am hoping that this is about right below... and will get a build done in the morning and give it a whirl.

<object classid="clsid:someid" codebase="some-url"  id="jumpinsaucers-player" >
<param name="jumpinsaucers-player" value="jumpinsaucers.1.3.9.unity3d">
<embed src="jumpinsaucers.1.3.9.unity3d" type="application/vnd.unity" width="100%" height="100%" firstframecallback="UnityObject2.instances[0].firstFrameCallback();" backgroundcolor="A0A0A0" bordercolor="000000" textcolor="FFFFFF" logoimage="curly-sue.png" progressframeimage="loader.png" style="display: block; width: 100%; height: 100%;">
</object>


will keep you posted.