Sunday, June 24, 2012

Rendering the audio captured by a Windows Phone device

Code Sample

Background

In order to capture the audio on a Windows Phone device, you need an instance to the default microphone (Microphone.Default), decide how often you want samples using the BufferDuration-property and hook up the BufferReady-event. Then you control the capturing with the Start() and Stop() methods.
The microphone is giving you samples at a fixed rate of 16 000 Hz, i.e. 16 000 samples per second. There is a property SampleRate that will tell this value. This means that you won't be able to capture audio of higher frequency than 8000 Hz (without distortion) according to the sampling theorem.
You are also limited when it comes to choose the value for the BufferDuration-property; it must be between 0.1 and 1 seconds (100 - 1000 ms) in 10ms-steps. This means that you must choose a value of 100, 110, 120, ..., 990, 1000 milliseconds.
When the microphone event BufferReady is fired, you should call the microphone.GetData(myBuffer)-method, in order to copy the samples from the microphone's internal buffer to a buffer that belongs to you. The recorded audio comes in the form of a byte-array, but since the samples are actually signed 16-bits integers (i.e. an integer in the range of -32'768 ... 32'767), you will probably need to do some convertion before you can process them.

Saturday, June 23, 2012

Spongebob Alarm !

Spongebob Alarm is alarm application with the same properties of 
basic alarm application but with funny sounds from spongebob squarepants life .

Enjoy it .
 
Developed by Abdallah Shakhatreh
 

 


Download Link : http://www.windowsphone.com/en-GB/apps/88419c5b-c265-44aa-861f-c6848f4a4401 

Thursday, June 21, 2012

Windows Phone 7 Text Style Picker Control

It looks like the off-the-shelf WP7 SDK, the Silverlight SDK, and even the Coding4Fun suite lack one very basic piece of functionality that you may want to provide your WP7 app users with: selecting the font style (family, bold, italic), color and size.
Since I needed something like that myself, I thought: why won't I just pack it and share with the fellow developers? ;-)

So, here it is: http://wp7textstylepicker.codeplex.com/



Implementing Confirm on exit in Windows Phone

Close a WP7 application programatically? or Exiting a Windows Phone Application .

In this post I will show how to create a simple function for ask confirm on exit application.

Step 1. You need to create a function for clear navigation history:

private void ClearBackEntries()
{
    while (NavigationService.BackStack != null & NavigationService.BackStack.Count() > 0)
        NavigationService.RemoveBackEntry();
}

Wednesday, June 20, 2012

How do I Generate Random Number in Windows Phone ?


The following code snippet shows how to generate a random number between a range in C# (Windows Phone) , where min and max are minimum and maximum range of the new number.

private int RandomNumber(int min, int max)
{
Random random =
new Random();return random.Next(min, max);
}
How to use it?
Copy the above code in your class where you want to use it and call like this:
int returnValue = RandomNumber(5, 20);

Friday, June 15, 2012

Windows Phone 7 Prototype 001: Speech Recognition on WP7


At some point in the future it will be awesome when you can just tell your computer what to do and it does it – without typing to help those of us with a blistering 11 WPM hunk and peck technique. Siri, a mobile digital assistant using speech recognition was voted best tech at SXSW. I don’t know about that one. Although, I’m sure it will get better when Apple rebuilds it and  bundles on iPhone 5. So how would you do that on WP7? There have been some videos floating around showing Bing with some voice control so obviously the phone has speech recognition. So what options are there:
  • System.Speech? Not included in WP7/SL
  • Nuance software like Siri? No WP7/SL version yet.
  • Invoking the SAPI dlls on the phone? No automation factory in WP7 SL.
  • Web services using System.Speech and mic on the phone? YES!
The last one was my least favorite but that works for now.
I built a quick sample app to show how to do text-to-speech and speech recognition on WP7.




Thursday, June 14, 2012

Introduction to XNA on Windows Phone 7


What is XNA?

XNA is a development framework created by Microsoft which encapsulates low-level technological details involved in creating a game and allows you to concentrate on what makes the game fun. The XNA Framework runs on top of the .NET Framework, Microsoft’s standard development platform, and consists of a library of tools and code that allows developers to quickly create games for Windows, XBox 360 and Windows Phone 7.
The XNA Framework has evolved over the years and now includes support audio and video playback, Xbox Live multi-player features, Xbox 360 avatars, and more. Most importantly for your purposes, it makes it easy to draw on the screen of the device that you’re working with.

Create Your Project

In this tutorial, you’re going to build a simple application called Bouncing Balls. The screen will start blank. When you touch the screen, a new ball with a random velocity and color is added to the collection of bouncing balls. If you tap on the screen again another ball will be added. This application should take less than 30 minutes to create.
To begin, open Microsoft Visual Studio 2010 Express for Windows Phone. Once open, click the “New Project…” link in the left sidebar. In the dialog box that pops up, choose “XNA Game Studio 4” in the left column and make sure the “Windows Phone Game (4.0)” item is selected. Then, give your project a name. For this tutorial, I recommend calling your project “BouncingBalls.” Confirm that the “Create directory for solution” checkbox is selected. If you’ve done all this, your dialog will appear similar to mine (with less options, most likely):
Setting up a new Windows Phone Game project
Click “OK” to create your new project. Visual Studio will create all the required files in your specified directory and open Game1.cs for you.

Importing Required Resources