silverlight text to speech? - silverlight

Any silverlight text to speech engine available now? I am looking for very simple text to speech engine which needs to read out numbers.
I dont want to rely on any web service.In worstcase I will record some voices for numbers and stitch them together.
Any pointers are highly appreciated. My application need not work on MAC or linux.

There is another option, which doesn't involve ActiveX or Silverlight 4 COM interop. You simply have your Silverlight application send the text to a WCF service which will convert the text to a WAV stream and then decode the stream returned by the service and place it in a MediaStreamSource for playback in Silverlight. I wrote a blog post on it and it includes sample code.
http://www.brianlagunas.com/index.php/2010/03/07/text-to-speech-in-silverlight-using-wcf

Converting text to speech using speech SDK consists of a few simple steps. The following code shows the important pieces in performing text to speech.
dynamic textToSpeech = AutomationFactory.CreateObject("Sapi.SpVoice");
textToSpeech.Volume = book.Volume;
textToSpeech.Rate = book.SpeekSpeed;
textToSpeech.Voice = book.speeker;
textToSpeech.Speak(book.Content);
SpVoice is the class that is used for text to speech conversion. The speak method takes in a string that needs to be spoken.
code sample: http://funducodes.blogspot.com/p/silver-light.html

You will probably have to build your own for a truely cross compatible application.
Silverlight 3: Use active X to call the Microsoft Speech SDK. (not recommended at all)
Silverlight 4: Use COM integration to call the Microsoft Speech SDK.
These will work on windows only OS.

Of course, with all these suggestions, the underlying flaw is in the speech rendering engine itself - every one of these sample results in a nasty clicking at the start of the speech, I'm thinking this is garbage collection on the stream.
Would be nice to finally have something cross platform that can create realistic speech.
I am not holding my breath.

Related

Creating Reports in Silverlight (either as PDF or send it off to a printer)

I have recently attempted to generate reports in Silverlight 4. In my problem domain, these reports either need to go directly to the printer and/or the client-side SL application creates a PDF and allows the user to store it somewhere.
As for the report, it's roughly composed of 50% flow text (incl. enumerations), 30% tables and 20% charts. The flow text part makes it slighty more challenging, as proper line breaking would have to take place.
So far, I have tried the following approaches - each with its own shortcomings that make them not so much feasible:
Silverlight's own PrintDocument: technically, there are two major concerns. For one, getting page breaks to work and printing UIElements on it with proper layout is a bit of a dirty hackjob and full of compromises; thankfully that's the part I've managed to get working so far. However, the PrintDocument class always renders all visuals as bitmaps before sending them off; this is not so much fun, if one uses a PDF printer and hopes to still be able to search in / select text. David Poll's approach in "Silverlight and Beyond" [1] wasn't that helpful as well as it inherently follows the same approach and thus suffers from very similar issues.
silverPDF [2]: a barely documented library that requires to do most of the layout manually (the former approach at least allowed me to re-use Silverlight's layouting engine). So far, I see no way to (for instance) measure paragraphs and the only sample with long flowtext uses hardcoded absolute values for layout rectangles. Also, the developing party seems to be inactive.
Personally, I'm now thinking of following an entirely different strategy: simply generate HTML documents. But I was hoping that the community here might have hints for the two approaches above or know other good approaches.
Thanks in advance,
~Manny
Do you need to generate the report on the client, or can you get the server to generate it? Your options are better if you can generate it on the server. Personally, I think the way Silverlight printing works at the moment is pretty poor for report usage (sending each page to the printer as raster rather than vector, resulting in potentially huge amounts of data travelling through the network, and lower printing quality output). I've found the best strategy is to generate the PDF on the server (enabling you to take advantage of a reporting engine), and display it in your application. There are also a few commercial products (such as Telerik's Silverlight Report Viewer, Report Sharp Shooter, or even First Floor Software's Document Toolkit). If a client side solution is really required, perhaps one of these might be the best option (although the printing quality will still be poor). Note that Silverlight 5 is supposed to have support for vector printing, but it's another 6 months or more away from release. Yet another option is Pete Brown and David Poll's open source reporting framework here: http://silverlightreporting.codeplex.com/.
If you want to take the option of generating the report on the server as a PDF and displaying it in your application, I've written an article on doing so here: http://www.silverlightshow.net/items/Building-a-Silverlight-Line-Of-Business-Application-Part-6.aspx. This doesn't work for OOB applications, but the source code accompanying my book (Pro Business Applications with Silverlight 4) does: apress.com/book/view/9781430272076.
Hope this helps...
Chris Anderson

What audio format works for Silverlight + WPF?

I'm writing a pair of applications for distributing audio (among other features). I have a WPF program that allows an artist to record and edit audio. Clicking a button then uploads this to a silverlight-powered website. A consumer visiting this website can then listen to the audio. Simple. It works. But I'd like it to be better: I need an audio format that works seamlessly on both the recording and playback sides.
I'm currently using mp3 format, and I'm not happy with it. For the recording/editing, I use the Alvas Audio c# library. It works ok, but for MP3 recording requires that the artist goes into his registry to change msacm.l3acm to l3codecp.acm. That's a lot to ask of an end-user. Furthermore mp3 recording seems rather fragile when I install on a new machine. (Sometimes it randomly just doesn't work until you've fiddled around for a while. I still don't know why.) I've been told that unless I want to pay royalties to the mp3 patent holders, I always need to rely on this type of registry change.
So what other audio format could I use instead? I need something compressed. Alvas audio can also record to GSM, for example, but that won't play back in silverlight. Silverlight will play WMA, but I don't know how to record in that format - Alvas Audio won't. I'd be open to using another recording library instead, but I haven't managed to find one.
Am I missing something obvious, or is there really no user-friendly way to record audio in WPF and play it back in Silverlight? It seems like there should be...
Any suggestions greatly appreciated.
Thanks.
IMO, WMA would be your best bet. I'm not sure how your application is setup or how low level you want to go, but the Windows Media Format SDK is a great way to encode WMA and the runtimes come with Windows. There are .NET PIAs and samples for it here: http://windowsmedianet.sourceforge.net/
Given that Ogg Vorbis is being adopted for the new HTML audio tag in (cough) some browsers, it's probably worth checking it out. You won't get bitten by any licensing concerns if you follow this route. If ease of deployment is top of your list, then go with WMA.
[tries hard not to start ranting about fragmented state of codec options in browsers and the commercial interests that scupper any concensus]

Getting Silverlight Video Stream

Suppose there is a Silverlight streaming video player on a random web site. How can I intercept the video stream and for example save it to file - i.e. the real source of the file.
I know some of the sites embed the source in tag - or at least that was the case with Flash. But sometimes, players are smarter than that and call some logic via web service. It is still possible to figure everything out by analyzing the .dll with reflector, but that is hardcore! Every player may have a different logic, so I figured out it would be easier to just get the current stream somehow.
Any thoughts?
Ooook! Got me an answer that could be used as a nice workaround. With the use of fiddler I was able to capture the traffic and figure out what's going on. Now I'm happily watchin the same video as before only using the uber feature of WMP that lets me play videos faster.

Google Wave applications

My understanding is that Google wave is a communications and collaboration tool. But is it only limited to IM/Twitter type interface or can it do much more? Can it be something completely different than the top-down conversation format?
Say I want to build a collaborative photo editing app with google wave. which API should I use? or am I not getting it?
That would be a gadget, I believe (possibly combined with a robot). I'm not sure whether photo editing would really be a practical application of Wave, although a "collaborative canvas" certainly works.
The gadget would be used for the user interface side of things, and the robot could be used for more complex effects that you didn't want to implement in JavaScript. You'd add a bit of data representing "I want posterisation applied" (for example) and the robot would see that, apply the effect and then send back the modified blip with the posterised version.
The main problem I'd see with collaborative photo editing is the amount of potentially changed data for each edit. I suspect it would technically work, but it may not be great in terms of space/bandwidth usage...
If you are interested in collaborative diagramming, take a look at the video demo on the following page:
http://www.googlewaveblogger.com/collaboration/gravity-the-best-business-example-of-google-wave-period/
Midway through the video, you can see several users collaboratively editing a SAP business process (flowchart). Super cool.
There are three aspects to Google Wave:
A product: Wave is a web app using HTML5 built on GWT
A protocol: Wave also denotes the underlying format for storing and sharing waves
A platform: Wave provides a set of open APIs for developers
The platform can further be divided into Wave extensions, and the Embed API. Wave extensions include robots and gadgets, and the Embed API allows you to embed waves into third party applications and websites. A gadget is an application that runs within a wave, and a robot is an automated participant in a wave.
Some links that might be useful to you:
Google wave blog post: http://googleblog.blogspot.com/2009/05/went-walkabout-brought-back-google-wave.html
Google Wave API overview: http://code.google.com/apis/wave/guide.html
Google Wave Federation Architecture whitepaper: http://www.waveprotocol.org/whitepapers/google-wave-architecture
Google Wave Data Model and Client-Server Protorol whitepaper: http://www.waveprotocol.org/whitepapers/internal-client-server-protocol
Google Wave Extensions, An Inside Look: http://mashable.com/2009/06/11/google-wave-extensions/
Here is a searchable collection of Google Wave Gadgets and Robots in order to look at some examples of what you can do.
You can check out the Cards gadget, for example that has source code available.

Convert pcl to image

I'm communicating with a logic analyzer (HP 1660A) over RS232. I issue a command which tells the analyzer to print screen its display and send it over to the controller (my pc) through serial communication. I'm saving the result (which is usually abut 25kB) to my computer and I would like to view it as a TIFF or other format. The problem is that the response from the analyzer comes in PCL format, therefore suitable to be sent to a printer and printed directly, but not to be opened as an image. I have tried a few PCL to image converters to do the job, I found one which does it properly, however I've used the trial version and I am reluctant to purchase it. I've given you the background of my labour. I would appreciate any kind of help, a reference to the commands in pcl 1 and what should I do in order to extract the data and format it properly from the PCL file. I have no experience with PCL and image processing whatsoever, so please, give me a hand here. Thank you.
P.S. I've obtained the PCL file from the analyzer, both in C# and matlab... I have one slight problem in C# with the serial port control, some images have some uninterpreted characters in the image, when using the above converters. I say all these because I need an algorithm or some indications, no matter the programming language, so please feel free to post.
PCL is complex to read. There are only a handful of tools out there that do a good job of this. We have lots of PCL expertise and still often look to other to supply conversion to PDF and other formats. If the PCL is quite simple, that is, just text, a few fonts, and a graphic or two, a couple of RegEx commands could deal with the extraction of the text and then you could mock up a new document using whatever tools you wish.
Looking at these files in stackoverflow might be tough. If you can get them on an ftp and post a link I can take a quick look and post my findings/thoughts here. The other option is to look to an outside tool. There are a few we've had success with. Our needs are broad so I've settled on one that works the best with many different PCL streams (some PCL coding is better than others). As you are dealing with a known quantity of PCL you may have a few options. Here are a few we've used and had some success with (in order of usefulness to us)
PCLWorks by PageTech (they have a GUI viewer and complete SDK)
VeryPDF PCL Converter (command line tool)
SwiftView
There are others, and even an opensource variant of Ghostscript that handles PCL (we've never had much luck as the PCL we use often contains very custom fonts, symbol sets, and tons of macros which seem to choke it.
GhostPCL
EDIT: Most recently we've been working with LincPDF (http://www.lincolnco.com/). This is also an excellent product with has one big benefit, deployment is simple. Some of the other tools have complex software installations. This solution is very easy for us to deploy as a feature in an application. It's also faster then any tools we've tested to date (at least with the PCL that we generate from our apps which is quite complex as they include specialized fonts and macros).
According to the spec sheet for the HP 1660 (pdf) series can send the TIFF,PCX and postscript.
Wouldn't it be easier to use TIFF?
The project was put on hold for a while, but I would like to offer a complete and usable solution.
#Adrian
You can save the image to a floppy disk, I've done that, saved it as TIFF and everything worked fine. Unfortunately, it sends only PCL through RS232. The idea to save the print screen over serial communication was to avoid using too much the floppy disk, which the device uses in order to boot.
#Douglas
Thank you for your elaborate answer. I'll take a look at the indicated tools, however, my desire is to offer a complete front-end solution, which yields directly the graphic. I've put some files from my tests here in order to see the complexity of the PCL constructions. Do you have any knowledge of a possible API that I could integrate into my application, which can parse the file and interpret the PCL?
Regards,
Cosmin
We capture the serial input via a serial spooler that watches COM1:. It's called SSpool.exe. It redirects the PCL as input to PCLXForm. PCLXForm converts it into any raster format (TIFF, JPG, PDF, BMP, etc.) However, we can also extract the text during the conversion and we can extract individual raster objects from the PCL for re-arrangement in the downstream application. Our pricing model is positioned for licensee's that need to convert up to 50,000 pages of invoices into indexed PDF's per month. However, this type of application normally requires a custom license in order to get our pricing down to the level required. In order to do so, we often have to restrict our product to convert unlimited files, but only up to the 20th page within any one PCL print file. That provides enough page volume and gives us the ability to reduce the pricing per unit. To demo, you would need the PCLTool SDK.

Resources