Andrej Tozon's blog

In the Attic

NAVIGATION - SEARCH

Make your application speak

.NET Framework 2.0 simplified the way of playing audio files from desktop applications. .NET Framework 3.0 takes this one step further by introducing the speech API, residing in the System.Speech namespace (it's basically a wrapper around Microsoft SAPI and is packed in System.Speech.Dll).

Using the SpeechSynthesizer class you can make your computer actually speak the text you feed to it:

SpeechSynthesizer synth = new SpeechSynthesizer();
synth.Speak("Hello world!");

If you don't want to stop your application from blocking the execution while speaking, this is there's the asynchronous equivalent to this method:

SpeechSynthesizer synth = new SpeechSynthesizer();
synth.SpeakAsync("Hello universe!");

The class provides a lot of ways of influencing the sound, like changing the rate, volume, providing hints on pronunciation, including existing sounds and changing the voice. Windows Vista comes with the preinstalled voice called Microsoft Anna, while Microsoft Sam should be available on Windows XP.

OK, so I thought I would update my You've got mail application sample by including some spoken text when new mail "arrives". This is the code I used:

PromptBuilder builder = new PromptBuilder();
builder.AppendAudio(new Uri(@"file://\windows\media\windows notify.wav"));
builder.AppendBreak(PromptBreak.Small);
builder.AppendText("You've got mail.");
builder.AppendBreak(PromptBreak.Small);
builder.AppendText("I think it's from your... wife.");

SpeechSynthesizer synth = new SpeechSynthesizer();
synth.SpeakAsync(builder);

And this is the extended You've got mail sample project for download.

Enjoy. A couple of notes though: The speech API does not require you to build a WPF to use it. You can also use it from Windows Forms or a Console application, just as long as you're targeting .NET FX 3.0. And don't forget to reference the System.Speech.Dll.

You've got mail

Alt-Tab flipping in Windows Vista

When running Windows Vista on a non-graphic-capable PC [not having at least DirectX 9 capable graphics processor], you lose the comfort of enjoying eye-candy features like Aero Glass, Flip 3D [Win-Tab switching] and graphically enhanced Windows Flip [Alt-Tab switching]...

What you can start to enjoy [even without having a capable graphics card], is the ability to switch to preferred application simply by clicking its icon while holding the Flip window open. Proves useful when having a lot of applications open at once. In pre-Vista Windows editions you'd have to tap the Tab key a few times to get desired application's tile selected and release the keys to set application focus.

No more excuses...

... for not running Visual Studio 2005 on Windows Vista. Visual Studio 2005 Service Pack 1 Update for Windows Vista is available for download. Remember to uninstall the Beta before installing this release version.

And if you've installed SQL2005 SP2 already, here's a critical hotfix you may want to apply... This fix is however included in the refreshed SP2 package, so if you download it now (goes for downloads after 5th of March), you'll be fine.

Smarter Client Development with Visual Studio "Orcas"

This series of posts will follow my exploration in forthcoming Visual Studio "Orcas" features, focusing on developing Smart(er) Clients, or, as the above title permits, smarter developing of (desktop) clients. I'll begin the series with my "Orcas" installation experience.

As mentioned, you can try out VS "Orcas" by mounting a Virtual PC image or by a separate installation. Choosing VPC, you get Windows 2003, together with VS2005, SQL2005 and VS 9.0 ("Orcas") already installed. On the other hand, separate installer will install "Orcas" bits only. But before you do that, just make sure you don't have any previous "Orcas" CTPs installed on your PC or you'll get some weird installer errors, complaining on some files being missing from your temp folder. To help you with uninstalling unwanted CTP leftovers, see this page; in my case, I had to manually delete the "Program Files\Microsoft Visual Studio 9.0" folder for a successful install.

To continue, there are some quite serious issues involved with the product installation, some of which are closely related to side-by-side installation with VS2005 and/or SQL2005 (see numbers I./7., II./19. and II./20. in Visual Studio Code Name "Orcas" Release Notes). Although the same release notes suggest using the March CTP from a VPC image, this doesn't seem to fix it, because both VS2005 and SQL2005 are co-installed with "Orcas", therefore suffering from this same issue. It looks like what we really need is a fresh, VS2005-less machine...

One of my next steps will include setting up a separate Windows Vista VPC with clean "Orcas" installation and see how it goes from there. But before that, we'll going to look into some new client features "Orcas" has in store for us... Stay tuned!

Adobe Acrobat 8 on Vista

Looks like quite a few "big" applications still have issues with Windows Vista OS. "Problems Reports and Solutions" Vista feature just notified me today about Adobe Acrobate Reader constant crashing, and reported that there's a new Reader version available, which "might address these problems". Following the provided link, I downloaded latest version of Acrobate Reader (8.0.0 for Windows Vista) and tried to run it. Here's what I got after initial setup files got unpacked:

Before investigating if this happened due to incorrect UAC setting or other security issue, I simply navigated to the folder where setup files were unpacked to [C:\Users\<User>\AppData\LocalLow\Netopsystems\temp\Adobe Reader 8.0\] and simply copied all the files to a new folder on the c:\ root. After running Setup.exe from there, Acrobat Reader installed correctly. Problem solved.

It's probably too early to really complain about issues like this, since Vista is still quite fresh, and this may only be an installer issue, but they certainly don't make it easy for users wanting to adopt Windows Vista right now.

NX7010 SD Card Reader under Vista

Starting with my new life role, I finally found some use for the SD Card reader on my HP NX7010 notebook. Digital baby photos can take up a lot of memory space and soon you find yourself copying them everywhere... one of those locations being my Garmin nuvi 660, the little Car GPS Navigator thingy. Since it can be expanded by SD memory cards, the same kind that can be fed to the NX7010, I thought - why not - and bought a 1G card.

But... somewhere on the road installing Windows Vista versions on the notebook, I lost my SD Card Reader due to a missing Vista driver that wasn't installed in the process. Now, how to get it back? XP drivers usually work, but what happens if you don't have your CD anywhere at your hand's reach? Internet, of course... Well, yes... It turned out that NX7010 SD Card reader XP driver wasn't listed on the NX7010 driver list... Digging all around HP's web site I found one on the NX7000 list, and it worked...

In short - if you're trying to enable SD card reader on NX7010 after upgrading to Windows Vista, here's the place to look: Winbond SD Card Reader Software

On a side note: Microsoft released ASP.NET AJAX v1.0 - get it here!

VS2005 SP1 - uninstalling the Beta

 

If you're going to install Visual Studio 2005 SP1 on a machine, running the Beta version of the same service pack (VS2005 SP1 Beta), you'll have to uninstall that first, otherwise this nasty message will prevent you from installing the release version. To uninstall the SP1 Beta, go to Control Panel and review installed updates:

  • [Win XP] - Go to Add or Remove programs and check "Show Updates"
  • [Win Vista] - Go to Programs, Programs and Features and choose "View Installed Updates"

The VS2005 Service Pack 1 should appear right under the Microsoft Visual Studio 2005. Select "Service Pack 1 Beta" and choose to uninstall it.

It will take a while for SP1 Beta to uninstall and perhaps you'll need your copy of Visual Studio 2005 installation CDs/DVD handy, just in case some old files are needed to reinstall... After setup program is done uninstalling, you can continue installing the release version of VS2005 SP1.

VS2005 SP1 is ready

Yes, it's finally out. Visit the official SP1 web page and download your updates. If you're working on Windows Vista, there's another update in the making - "Visual Studio 2005 SP1 Update for Windows Vista" - it's currently still in Beta and looks like download is not available yet.

[Update: Visual Studio 2005 SP1 Update for Windows Vista Beta is now available for download]