How to write an application that reads text and produces speech - c#

I'm an IT student. I want to write an web browser for blind people. How can I use C# or java to write an application to pronounce some text from a XML file (Text to Speech)?

You can use the SpeechSynthesizer class from the .Net Framework:
Add a reference to System.Speech.dll
Add a using statement for System.Speech.Synthesis
Use this code:
SpeechSynthesizer synthesizer = new SpeechSynthesizer();
synthesizer.Speak("Hello world! How are you?");

For .NET, have a look at the Speech APIs. There's a quick introduction to it here.
Hope that's enough to get you started.

It might be worth looking at accessibility guidelines for the web, this is a good place to start: http://www.w3.org/TR/WCAG10/
This will at least indicate what people are doing to support accessibility which will give you an idea of what your application should do. (eg reading ALT and TITLE tags)
C# can certainly be used to parse web pages and in addition to the text to speech built into the .NET framework there will be 3rd party libraries that you can integrate with.
You can also have a look at existing screen reader applications to give you some inspiration: eg: http://www.freedomscientific.com/products/fs/jaws-product-page.asp

For Java, this question gives you some Text To Speach options, but writing a whole web browser has a lot more to it than just the text to speech. Unless you are looking for something specifically cross platform (which I'm guessing not since you include .NET as an option), Windows comes with TTS accessibility options and of course a web browser built in.
With .NET you can use it's Speech API and interact with Internet Explorer to get you the web browser functionality. Definitely the shortest route, but it may not bring much over the built in Windows abilities.

Related

Accessing web app from personal project [C#]

I would like to know how can I access some web application from my personal project in C#?
To be specific, I would like to access this website https://dictation.io/
In my console app in VS record speech from my mic then pass it to that web app and then returns in my app result as e.g. string.
If someone could give an advice, it would be really fine (not looking for exact code)
Thank you!
Typically, accessing external resources (such as Dictation.io) would require an API. As they don't offer one, there's no (legal) way to use their speech-to-text.
Instead, you can build your own using Microsoft's own libraries and APIs. An example, and probably your best bet, would be https://msdn.microsoft.com/en-us/library/office/hh361683(v=office.14).aspx

PHP (HTML5) based Windows Software

Is it possible to make from a HTML5-APP (PHP,SQLITE,HTML,CSS,JS) a installable Windows Software in c#?
The software must start PHP (5.4), and must just load the document-root in the webbrowser object.
In theory it should work without problems. But what about protecting this code? Is it possible to protect at least the PHP part? Will ioncube or zend-guard work on PHP 5.4's embeded server? And is it possible to hide the shell window, which will open everytime, when i start the PHP Webserver via cmd?
Or do you know an alternate, how i can make a software from a HTML-5 (with PHP) App?
Your choosing the wrong language. PHP, HTML, JS, CSS and SQLLite are separate technologies.
I'd suggest writing the app in another language capable of producing an executable like C / C++ (and one that can plug into to SQLITE fairly easy).
If you want to create a installer out of HTML5-APP (PHP,SQLITE,HTML,CSS,JS) , take a look at bitnami package, it may solve your problem, if you have any explicit reason to use C#, and then you have see its library or namespace which may give you installer capability. However your question is unclear, can be be more clear?
You can embed a Chrome browser in C# using the CefSharp project. You would also need to embed some webserver (php built-in webserver might work, but it's single threaded so it might be an issue).
If it doesn't necessarily need to be C#, then take a look at the PHP Desktop project that is using C++ to embed a Chrome engine, a multithreaded webserver Mongoose and a PHP interpreter. Sources can be protected using many available php encoders, see the KnowledgeBase wiki page on the project site for details.

Integrating an application in the windows shell?

I am creating a file-sharing application I want to integrate into a windows shell. I am writing the core in portable C but the windows GUI in C#.
What I want to achieve is to for example add custom selection/option when you right-click a file (like, WinRAR adds custom option when you right-click a file, it allows you to rar the file and whatnot). I am not sure what the term is called though.
How do you do this in C#?
Thanks!
You're talking about something called a "shell extension". There are degrees of complexity associated with doing this sort of thing, as with everything. This is a good starting point and example; searching Google for "C# shell extension" returns lots of useful links.

Using Mapnik in .net environment

Has anybody used Mapnik for rendering Maps from .net c# environment? I would like to use it to render maps in a desktop application developed under .net4. I found it the best open source map renderer tool, much more better, than the well known sharpmap, dotspatial (...). The 'only' problem is that it was written in C++ and Python and does not have a trivial way to use it from C#.
Do you know any .net Mapnik wrappers? Do you know any sample code?
I've just published my attempts in C# bindings.
They are available at: http://sourceforge.net/projects/mapniknet/
Some good new about Mapnik-.Net integration:
"Another thing that will help Windows developers is a way to use Mapnik from .Net languages. Although a full .Net wrapper is too much work besides all the other issues, hopefully I can make a meaningful start and open the door for .Net developers to leverage Mapnik in their applications."
Source: Mapnik homepage http://mapnik.org/news/2011/jun/09/gsoc_2011_windows_build_system_introduction/
NET-Mapnik
You might want to give this a try. Its pretty recent and has a simple example with options to create vector tiles.
https://github.com/kernelsanders/NET-Mapnik
So, finally I hacked it. Not a nice solution, but it works at least. In nutshell it operates in the following way:
developed a python script, which takes parameters as command line arguments. (using python api of mapnik)
call this python script by shell fom c# code (Process)
after map image has been generated, I show it in SharpMap as a background layer
In case of any map refresh (zoom, pan) I regenerate 'mapnik map layer'. I have also some kind of cache, in which I can store generated maps, so I can make tricks by using earlier generated map images or pre-generate them (e.g. generate maps for the next zoom level when user uses zoom tool). I also use some asynchron calls to do this, so I can create 1-3 map images paralelly.
The weak part of this solution is the communication between python and c# modules. I could not find better than command line arguments + shell.
My solution works, mapnik is fast, can genarate my maps less than a sec.
If you have any advice on .net - python communication (NO ironpython, it is not suitable for manik api), pls write it here. Thx.
Do you know about TAO Project?
It is a .Net project that takes unmanaged opengle library to .Net Managed Form by calling DllIMport() in C#.
You must do it for Mapnik, simaliar to TAOFramework.net

Best practices to support white-labeling in C# winforms application

I've developed an application that helps users to play casino games "better", based on statistical calculations.
It's an external application that sniffs network, understands certain casino room protocols(some web based, some native application) and gives real time advices to user.
Recently I was contacted by different casino room operators that want to license the software from me, customize the graphics/strings/feature set and give it to their users under their brand name.
So I'm going to have N different installs for N different casinos, with different graphics for each, different strings, different feature set enabled etc.
What are best practices to handle such requirements in c# winforms application, should I have different resource files for each vendor ? Is there something built in .net framework to handle such scenarios? Are there 3rd party software that can help me to manage this ?
Please be as verbose as possible, and thanks in advance!
If this was an asp.net application I'd suggest using themes. They are not as well supported in form applications but there is good theme support in WPF. Check out http://wpfthemes.codeplex.com/
This should be straightforward because winforms is pretty "battleship grey" so once you've peeled off all decoration it'll be pretty plain and ready to start building up again.
Essentially:
Remove any and all references in the code/forms to product name/company/customer.
Start adding in specific "branding" items in the form of images and text etc.
Specifically:
Make sure the code has no reference to the product name/company/customer in namespaces etc.
Have all strings loaded from resource files (this'll help with localisation anyway).
If you want some "obvious branding" then have an image file loaded form disk or resources and displayed in a picturebox.
You can then have the same code built multiple times using a build tool, each time configuring the build with different resources.

Categories

Resources