Wednesday, May 7, 2014

Text To Speech and Cortana in Windows Phone 8.1

Hi !

I have written a blog post on on Text To Speech in Windows Phone 8.1 where I have shared information on various aspects of Speech in Windows Phone including Cortana, Here is URL :

Do read the post and let me know your feedback ! I am bit occupied in //publish event so I will be writing more soon here on this blog. Till then enjoy my post on DotNetCurry


Wednesday, April 9, 2014

First look at Windows Phone 8.1 Emulator

Hi! Hope you already know about the wonderful announcements made in Build 2014 recently about Windows, Azure and Windows Phone. So we are now in new era of Windows Phone as Windows Phone 8.1. I am here blogging on Windows Phone since it was in version 7. Journey continues and as a part of this ongoing long journey, today I am going to share what new things you can observe, analysis and utilize if you are planning to build Apps for Windows Phone 8.1. Many of us who have not yet installed the new bits might be under impression that it will not be very different emulator from 8.0. In reality you can see and experience tons of changes, some are small changes and some are totally new.

Windows Phone 8.1 SDK and/or Tools are now part of Visual Studio Update 2 RC. So now once you update your Visual Studio 2013 with this update, you are all set for building apps on Windows Phone 8.1. What only thing I don’t like here is I don’t get ISO for this and Update happens over the wire. It took lot of time (Almost 5-6 hours) to download and install, especially in countries like India where you have low bandwidth, it is painful. You can download Update 2 RC from here

New Windows Phone 8.1 Project :

First thing you will notice once you install tooling via Update 2 RC is Windows Phone Project Templates are now under Store Apps like shown below:


You can then choose Specific Template from Windows Phone Apps category like shown here:


So now we have 2 Set of Templates one with suffix (Windows Phone) and other with (Windows Phone Silverlight), so what is the difference and when to use what?

Answer is simple! If you have existing Windows Phone 8 App and if you wish to leverage some new features of 8.1 without modifying much of your current code then you need to take Windows Phone Silverlight App. Please visit here to know more about Silverlight Windows Phone 8.1 Project Templates If you take this template it does show you OS Switching dialog shown below:


If you choose Windows Phone Only Project Template (without Silverlight suffix) then your App will be by default taken to Windows Phone 8.1 Windows Runtime XAML(Same platform which used for building Windows 8 Apps). In this particular post I am purposefully not discussing things like Backward Compatibility and Universal Project App since I need to talk about it with you in great depth in my upcoming posts. So for the time being, let us quickly digest the different project templates. Another significant name change is for Panorama, Now Panorama is replaced with Hub. Let us talk more about Hub and WebView App templates in upcoming posts. So if you are planning to first do a Hello World and wish to put a MessageBox, it will not work as I said this project templates inclined towards Windows Runtime.

private async void btnClick_Click(object sender, RoutedEventArgs e)

{  MessageDialog msdlg = new MessageDialog("Hello World !!", "My First WP8.1 App");

await msdlg.ShowAsync();}

Home Screen :

Here is the First look of Emulator :


Once you run Emulator, you will notice couple of new things in Additional Tools as well as on Toolbar for Emulator, like now we have Multitouch Option here. This can be used to Test Multitouch scenarios. I have shown one scenario below where I am scaling one Image with this Multitouch.

image image

Volume Up / Down :

Now you can change the Volume by pressing “Volume Up/Down” key on emulator which will give you a quick dashboard to control Sound for Phone and Apps like shown below:


Additional Tools:

Most beautiful feature in Additional Tool I found is “Checkpoint”, Checkpoint helps you take Snapshot of your emulator state. You can Create or Restore old checkpoints and delete the same. Idea behind checkpoint is to fix and freeze the environment so that Developers don’t need to do common things repetitively like loading Contacts or Settings etc.


Another good additions are SD Card, Sensors and Notifications, I will talk about them with examples in coming posts. For today we will just have a look at them in a pictorial way.



Camera by default loads burst mode and not it shows couple of more options like Lens, Quick Front Camera toggling etc.



Much awaited Cortana helps you as your own Personal Digital Assistance. You can invoke it from Apps or from Search. You need to sign in with your Live Account on emulator to experience it. I played couple of Songs in front of my Laptop and guess what ! Cortana worked like Shaazam for me and identified what Music I am playing. This itself shows power of Cortana, Here is the first look:

image image

image image


Here is the new improved look of Calendar which now shows bit of Weather and also gives to look in different views like Day, Week, Month and Year.

image  image

Dialing / Calling:

Till Windows Phone 8 we use to Dial and Number and post call we use to Save the Number. Here in 8.1 now, once you type number and if you know its correct you can then save it right away by clicking on Save button on Dial Pad. Also it now shows Number of calls made by adding suffice (<Number of times dialed>). It also shows People icon next to number to navigate quickly to Contact. Also it is now showing Speed Dial.

image image


Developer Power Tools for Windows Phone 8.1 :

Here is the Quick Tool for profiling your Windows Phone 8.1 App which takes Traces (Performance Recorder),Application Verifier and Performance Monitor. It does not required to any new learning, it is easy and user friendly.


I hope with this little information shared above, you must have got glimpse of Windows Phone 8.1. Actually it is much more than that in reality. So let us explore more on Windows Phone 8.1 here in coming days. Let me know your feedback and keep visiting here for more Windows Phone 8.1 stuff.


Saturday, April 5, 2014

Building Windows Phone Apps using App Studio Article in DNC.NET Magazine

Hi !

After a long gap.. I started writing again !

While my offline sessions continues, I wrote an article in leading .NET Developer Magazine DNC Magazine run by fellow MVP in Pune. It is the 11th Issue of this Magazine. I wrote a full length article covering all possible aspects of building Windows Phone Applications using App Studio Beta.

I highly recommend to Subscribe and Download the Magazine here . It covers lot of other wonderful .NET Articles too.

You can also read the complete App Studio Article on DotNetCurry site here.

Do check it out an let me know your feedback !.


Tuesday, August 27, 2013

My New Microsoft MVP Status, Xamarin and Steve Ballmer

Hello everyone ! long time…

My New MVP Status and  Summary of Journey as a MVP from last 6 years :

Writing after a long time. Yes ! I am no more Silverlight MVP !! I am now Windows Phone MVP rather 2nd Windows Phone MVP in India after my best friend Mayur Tendulkar who won the title recently. I won Microsoft MVP title 6th time in a row.


As a commitment, I will resume my blogging soon and will post some good stuff on Windows Phone like I use to give my best for Silverlight. You will not believe but the Transition from Silverlight to Windows Phone was not easy and equally “Painful” for me. With the growing popularity of HTML5 (I still call it as Hype), Silverlight lost its momentum. This put me in position to start look for new avenues and I found Windows Phone is one of the close one (XAML + C#). My mind is yet to accept that I love Windows 8 since I have Windows 8 but neither I upgraded to 8.1 nor I am fond of Metro aka Store UI, I am still prefer desktop mode. Not to blame my mind and not to blame Microsoft. It is my region who plays trick with me.Where are those devices in India?? Whatever ! and who cares.. I always worked for Community and I devote my time either here or with my wonderful local .NET User Group (Pune User Group, which is one of the most active and biggest UG in India or rather South Asia)

Xamarin :

While I was on vacation to Goa for South Asia MVP Open Days, I had lot of interaction with Xamarin Tools and enthusiasts in the same community. We exchanged our thoughts and what I found more interesting is that I can use C# to build Android and iOS apps.So it might happen that out of interest you could see me writing about Xamarin and talking about Xamarin using C#. Though I will be learning Xamarin and building expertise around just for my hobby and passion towards mobility, My entire focus will be always and always and always on Windows Phone Platform and it will be always at Top in my Community commitment list. So now its Windows Phone 24x7 on my head !

Steve Ballmer :

I personally feel that Steve Ballmer did a fantastic jobs after Bill Gates. During the Steve Ballmer era both Phone and Windows saw lot of innovation. Being and Becoming Microsoft CEO is not a easy job. I as a Microsoft Technology enthusiast will surely miss him and specially his love towards “Developers Developers Developers” .Since I am just a Senior Software Developer and not even hold 1% of Microsoft Stock on NASDAQ, I am holding myself back from posting my views on this topic and making shit on forums and blogs who are currently running long lasting discussions about Steve Ballmer’s replacement.I tell you, If you love Windows Phone then just post on your  Facebook wall “I Love Windows Phone”. Within a minute people will start shitting on your wall with Android and iPhone comparisons and facts sheets with dumb videos and Urls. Even its your personal view and people in your friend list not even developed “Hello World” on any Windows Phone, Android or iPhone, It became a habit of people to criticize Microsoft. So I tell my mind in such situations..”Either live with it or leave it !”. My friend and fellow Windows Phone MVP written a good post about this shitty habit here :

No Water on Moon?? Blame Microsoft !!

Whatever.. I love Windows Phone and other Microsoft Products irrespective of what people have their opinion for it. I will keep on working as Community Member and keep on contributing on Microsoft Technologies till I don’t step down from my work.

Thanks once again for making visit here and I will make sure you keep visiting here more and more in coming days !


Sunday, April 21, 2013

Introduction to Speech Capabilities in Windows Phone 8 – Part 3

Today I am going to post last part of this series, Hope Part1 and Part2 went well with you and hope you tried out the Speech Capabilities of Windows Phone 8. We already talked a lot about the different approaches of Text To Speech, In this we will see exactly reverse approach that its Speech To Text. Most of the time it is considered to be vary hard and difficult to implement, But with the given APIs in Windows Phone 8 makes them pretty easy to implement.So Lets see how you can build such app quickly.

Take a new Windows Phone 8 Application Project. Design I will leave that to you, Right now I have put this inside a Pivot item like this :


<phone:PivotItem Header="Speech2Text" DoubleTap="LoadSpeechToText">               

C# Code :

private async void LoadSpeechToText(object sender, RoutedEventArgs e)
           SpeechRecognizerUI myspeechRecognizer = new SpeechRecognizerUI();
           myspeechRecognizer.Settings.ExampleText = "Ex. Call,Search,Run";
           myspeechRecognizer.Settings.ListenText = "Listening...";


This will bring up the Popup where you need to suppose to talk or give command, To enable this functionality, you need to add two more lines of code

myspeechRecognizer.Settings.ReadoutEnabled = true;
myspeechRecognizer.Settings.ShowConfirmation = true;

Once you run this you will see our regular Speech Popup like this :


But just showing this screen is not sufficient, we need to capture the Text and display it to user, So for this we need to add few more lines of code

SpeechRecognitionUIResult Speechresult = await speechRecognizer.RecognizeWithUIAsync();
if (Speechresult.ResultStatus == SpeechRecognitionUIStatus.Succeeded)

Now you can see the result on a MessageBox, While doing the test I said “Nokia” and you can see the result on the screen.


And here you can see the Result on MessageBox.  finalNow its your decision where you want this piece of code to be use, There are lot of Business cases where you can use this kind of Speech Recognition. You can use this to launch certain Commands in your application or you can use to record voice as well and convert to text for any purpose.Hope you will find this useful and thus quick end of my Speech Capability series, I have kept it short but in coming days I am going to put detail article on these features by taking a Business Case.Till then Happy Coding, I will soon post a Calendar related article and we will see how we can use that API at our best.


Tuesday, April 2, 2013

Introduction to Speech Capabilities in Windows Phone 8 – Part 2

Hope you enjoyed my last article on Speech Capability in Windows Phone 8, Today I am posting another part or you can say little extension to what I did in Part 1.

In the first part we saw how we can incorporate the built in Speech Capability with the given set of Speech APIs in Windows Phone 8 SDK and how they have edge over earlier Windows Phone builds like 7 and above.We saw I simple Hello World kind of demo, Today I am going to demonstrate how we can leverage the SSML (Speech Synthesis Markup Language) using Speech APIs in Windows Phone.

What is SSML ? :

As per W3C, SSML can be defined as :

SSML is part of a larger set of markup specifications for voice browsers developed through the open processes of the W3C. It is designed to provide a rich, XML-based markup language for assisting the generation of synthetic speech in Web and other applications.

Possible Scenarios of SSML Implementation : This is very useful in a multilingual app where you need to implement Text to Speech of the content in different languages. Also it provides high level control over the grammer, choice of language, voice of male or female etc. with the help of tags defined in SSML.So let’s see a simple demo of incorporating SSML in Windows Phone 8, Then how you will use that in your app, Its your call !

Namespaces :

using Windows.Phone.Speech.Synthesis;

Design (XAML) :

<phone:PivotItem Header="SSML" DoubleTap="LoadSSML">
                <TextBlock x:Name="TTSSSML" HorizontalAlignment="Left" Height="500" Margin="33,26,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="389"/>

C# Code :

private async void LoadSSML(object sender,RoutedEventArgs e)
{ … }

I am using an async method here which have 2 parts, First will just display the Text on the Textblock and second part will actually reading of that SSML markup using Speech Synthesizer, Here is the first part :

//Speech Synthesis Markup Language for Display
          TTSSSML.Text = @"<speak version=""1.0""
           xmlns="""" xml:lang=""ja-JP"">
           <voice gender=""male"">       

Here you can see the SSML Markup, I agree, I am not SSML Expert and I have taken this piece of SSML tags by doing some research over internet and I spend little time to convert it to Japanese (I actually can read and write Japanese :) ..its a different story ) instead of keeping it in simple English. In your scenario all you need to do is change the “ja-JP” attribute to your own language like en-US etc and try out with that specific language content.You can also change gender to male or female with <voice gender=”<value>> attribute. All assumption is you have Speech enabled on your phone and also you have marked or enabled Speech in manifest file as I have demonstrated in my first article. Then rest is just routine coding nothing else.Now I am showing part two of this snippet, After looking at it, you will realize that I hardly making any changes here :

//Actual Speech in Japanese Language using SSML
            var ttsJP = new SpeechSynthesizer();
            await ttsJP.SpeakSsmlAsync(@"<speak version=""1.0""
            xmlns="""" xml:lang=""ja-JP"">
            <voice gender=""male"">       

All set ! Now just press F5 and Enjoy ! here are few screenshots if you are trying to visualize how it will look on device.

In English version of SSML :


In Japanese version of SSML


That’s all ! Hope you like this part, Till now in both parts we actually saw Text To Speech Capability in a nutshell, In my next article which might be last in the short speech capability series, I am going to talk on Speech To Text. Post these parts, I will move to Maps for a while and then will come back with few more interesting and deep dive articles.Till then..enjoy Windows Phone 8


Introduction to Speech Capabilities in Windows Phone 8 – Part 1

After a long..I am writing blog, I hope and I wish I will resume blogging like I use to in past. Lots of things happened in past few months. I changed my job,got married and what not ! Well, Life !

Today I am going to share few things about Speech Capabilities in Windows Phone 8, Although I haven’t talked about it in past for Windows Phone 7-7.5 just because there were lots of limitations in this area in terms of APIs and Accuracy as well.With Phone 8 things are totally different. Earlier till 7.5 it was totally dependent on Bing Service which has to be online and network or internet connection was mandatory to have.Now it works offline without having any data/internet connection. Thanks to Microsoft for this improvement. Little Thanks to Microsoft MVPs like me ! (little pat on back)..surprised? Well I was a volunteer and part of a Secret mission, Proud to get associated with it, Although our contribution was small compare to efforts taken by Microsoft Product Group Members but it was got recognized in recent Microsoft TechEd 2013 at Pune, India by Sanket Akerkar,Managing Director, Microsoft India at Microsoft.


Well, Lets come back to main topic, So I am actually planning to write a big article but now plan to break it in few,So today let’s build a Hello World type App to understand TTS (Text To Speech) Capabilities.

Initial Work :

Open a brand new Windows Phone Project from Visual Studio 2012


Choose Windows Phone OS 8.0


Design :

<phone:Pivot Title="Speech Capability">
            <!--Pivot item one-->
            <phone:PivotItem Header="howdy">
                <Button x:Name="TTSHowdy" Content="Hello World !" HorizontalAlignment="Left" Width="456" Height="87" VerticalAlignment="Top" Margin="0,82,0,0" Click="TTSHowdy_Click"/>


I am actually putting it in a Pivot Navigation as I wish to demonstrate couple of more features of Speech within a single app, In your design you can very well change the layout.

Namespace Required :

using Windows.Phone.Speech.Synthesis;
using Windows.Phone.Speech.Recognition;

C# Code :

private async void TTSHowdy_Click(object sender, RoutedEventArgs e)
            var TTS = new SpeechSynthesizer();
            await TTS.SpeakTextAsync("Welcome to Microsoft TechEd India 2013 in Pune");

So SpeakTextAsync basically an async method which take 2 parameters as Content and Content and ObjectState. So similarly we can pass big string or textblock data to this method so that it will speak the content for you with the default voices installed on your phone.

Here is the output : (On actual device/emulator, you can hear the Sound )


Now after this Hello World, Lets build another Pivot which will display as well as play all the voices installed on your phone. To showcase this, I am making use of “Long List Selector” on my UI.

Design :

<phone:PivotItem Header="voices" DoubleTap="LoadTTSAllVoices">
               <phone:LongListSelector  x:Name="llstNames" HorizontalAlignment="Left" Width="456" Height="232" VerticalAlignment="Top" Margin="0,3,0,0"/>              

C# Code :

List<string> lstVoices = new List<string>();

private async void LoadTTSAllVoices(object sender, RoutedEventArgs e)
           //Get all the Voices
           foreach (var voice in InstalledVoices.All)
               lstVoices.Add(voice.DisplayName + ", " + voice.Language + ", " + voice.Gender);
               using (var text2speech = new SpeechSynthesizer())
                   await text2speech.SpeakTextAsync("Hello world! I'm " + voice.DisplayName + ".");

               llstNames.ItemsSource = lstVoices.ToList();

Basically, This async methods loops over collection of Voices installed and add each one to the List<T>. So once the voice is picked and set in the SetVoice Method, We can then use the same method SpeakTextAsync which we used above to read the text content.So after reading via each of the voice, We add the voice reader information to a List<T> and bind it further to Long List Selector. So it reads the content and add each voice to the list one after the another.

Here is the Output : (On actual device/emulator, you can hear the Sound )


So that all I want to cover in Part –1, I will post another interesting stuff in upcoming parts, I am actually planning to post 2-3 more.Meanwhile you can try this and check the point to remember or conclusion :

1. Your PC/Laptop Speakers should be on to experience the voices coming out

2. There is no separate SDKs or Tools to be installed, These Speech APIs comes by default with the Phone SDK.

3. You need to Turn On Microphone and Speech Capability option from WMAppManifest.xml like this :


So that all I want to cover in Part –1 , I am already in progress for Part 2 and expect few more deep dive stuff on Speech Capabilities in coming parts as we progress. Do enjoy and try out the above capabilities and feel free to share your feedbak.