Ritesh’s Technical Blog

Posts Tagged ‘riteshhowto

Before starting let us know some basics.

What Is a Sidebar Gadget?

You already know what a sidebar is, but for those who dont know see the below image-
A Sidebar is shown with a lot of gadgets in it at the right side of the desktop in the above image.
A sidebar gadget is a powerful and handy little tool. A gadget is made up of nothing more than a
  • HTML file and
  • an XML definition file.

Apart from that, most gadgets include other files, such as

  • image files (PNG and JPG),
  • style sheets (CSS), and
  • scripting (JavaScript and VBScript source files)

which give them good look and feel. All of the content is stored in a ZIP file that is renamed with a .gadget extension. If you have read my tutorial on how to create window media player skin, then I may assure you, that this is also as simple as that one. If you want, you can grab a gadget online, rename it with a .zip extension, and easily explore its contents.

XML Definition File

The XML definition file, or manifest, is the glue that holds a gadget together. It only contains links to the main HTML file (which has links to the other files), a few icon files, and the gadget author’s Web site.
A typical XML definition file is shown below. As you can see, it is a standard XML file with a base element of gadget.
  <name>Gadget Name Here</name>
  <author name=”Company Name Here”>
    <info url=”http://contoso.com” text=”Vist our Web site” />
    <logo src=”logo.png” />
  <copyright>© 2007</copyright>
  <description>your gadget description</description>
    <icon width=”64” height=”64” src=”icon.png” />
    <host name=”sidebar”>
      <base type=”HTML” apiVersion=”1.0.0” src=”gadget.html” />
      <platform minPlatformVersion=”0.3” />
 Here is a list of the elements you should be most concerned with:
  • name: Title of your gadget.
  • version: Version number of your gadget.
  • author: Your name or your company’s name.
  • info url: Web site address.
  • info text: Friendly name for your Web site.
  • logo src: Name of company’s logo image file.
  • copyright: Copyright notice.
  • description: Description of the gadget.
  • icon src: Name of icon image file for the gadget.
  • base src: Name of gadget’s main HTML file.
Most of the elements in the definition file are used for displaying the gadget in the gallery. The one truly functional element is the src attribute of the base element—this points to the HTML file that will kickstart the gadget. I make it a practice to name this file gadget.html, but any valid filename will do.

The Main HTML File

The implementation of a gadget is nothing more than an HTML page that is a maximum of 130 pixels wide. Though this isn’t readily evident, the main HTML file (the one referenced in the XML definition file) is actually loaded into an Internet Explorer® 7 window. There is, of course, no chrome surrounding this window and its location is controlled by Sidebar, but everything inside is basically a Web application.
You can also use APIs from the Sidebar Gadget Object Model. These APIs provide a way for your gadget to interface with the system. For example, you can read the signal strength of your wireless network card, play a sound file, or determine the CPU usage.
As you look at the HTML for a gadget, you’ll notice that there is absolutely nothing that distinguishes it from HTML that you would code for a regular Web page. Here is the HTML code I use to start practically all of my Sidebar gadget projects:
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
<html xmlns=”http://www.w3.org/1999/xhtml”>
   <meta http-equiv=”Content-Type” content=”text/html; charset=utf-8” />
   <link href=”style.css” rel=”stylesheet” type=”text/css” />
   <script src=”local.js” type=”text/javascript”></script>
   <script src=”gadget.js” type=”text/javascript”></script>
   <div id=”gadget” class=”gadget”></div>
In the sample presented here, all of the HTML for the gadget is created dynamically from within the gadget.js JavaScript file. You could include most of the markup in the main HTML file, but what fun would that be?
Notice that I use CSS style sheets. This is what will drive the look of my gadget. As with any Web page, style sheets are an essential part of designing good-looking gadgets. Thus a good understanding of CSS is critical when producing a professional-looking gadget.
I should point out that while developing the main HTML file for a gadget is entirely like building a page that will be deployed online, the gadget implementation has a major advantage. You don’t have to worry about cross-browser issues. Since your gadget will always be run under Internet Explorer, you can rely on support for Internet Explorer features, such as native PNG alpha support, and there’s no need to write code to account for browser incompatibilities.
When I started developing Sidebar gadgets, I found this very refreshing. Over time, I began to take this for granted and when I recently had to design a Web page, I found myself getting very aggravated when I had to deal with cross-browser issues once again.


If you plan on doing anything interesting within your gadget, you’d better brush up on your JavaScript. You can code with any scripting language that is supported by Internet Explorer 7, but you will find that most of the gadget samples on “the Internets” are written in JavaScript.
If you have worked with JavaScript for any time at all, you have probably heard the phrase “eval is evil.” If not, go ahead and look it up online. I’ll wait.
Now that you understand why you should never use eval, I’m going to amend that rule to include that you should never place JavaScript text in an attribute inside of your HTML nor pass a string to setInterval or setTimeout. And when I say that you should never place JavaScript text in an attribute inside your HTML, this includes the body onload attribute, as this is interpreted internally just as an eval statement would be.
I’m sure some of you are saying, “No body onload? How will my code execute?” I suggest that you get in the habit of attaching a function to the onload event of the window object. This code snippet shows how to attach to the onload and onunload events:
function pageLoad() {
    window.detachEvent(“onload”, pageLoad);
    window.attachEvent(“onunload”, pageUnload);
    //page initalization here

function pageUnload() {
    window.detachEvent(“onload”, pageUnload);
    //gadget is closing, clean up

window.attachEvent(“onload”, pageLoad);
By using this method, function pageLoad is called well after the page loads (when the DOM is complete). Notice that the first thing I do in pageLoad is detatch the event. It is always a good idea to clean up after yourself in JavaScript to prevent memory leaks.
Next, I set up the onunload event that will be called as the gadget is destroyed—either as the user closes the gadget or when Sidebar is shut down. Again, this is done to free up any references that may cause memory leaks. It is also your last chance to save any settings if need be. I’ll talk all about settings a little later in the article.
You may have noticed by now that I’m a bit of a stickler for writing good, clean JavaScript, so please indulge me one more time on the subject. I strongly suggest that you “lint” your code before deployment. This will not only make your code better, but it may even root out some bugs before they happen.
Lint was the original name given to a tool that flagged problem areas in C source code. It is now a general term applied to many source languages. One of the better lint applications for JavaScript is a free online tool called JSLint (available at www.jslint.com).
The May 2007 issue of MSDN Magazine has an excellent feature on JavaScript titled “Create Advanced Web Applications with Object Oriented Techniques” by Ray Djajadinata. You should check it out if you haven’t already done so. This article will go a long way to helping you write a better gadget.

Docked and Floating

When a gadget is nestled in the Sidebar, it is considered to be in the docked state. Once dragged onto the desktop, it is floating or undocked. As I mentioned, the maximum width for a docked gadget is 130 pixels. An undocked gadget has no restriction on width, allowing you to design an expanded view. You can take advantage of this extra room to provide a richer experience. (Microsoft recommends that you don’t exceed 400 pixels square for an undocked gadget.) Figure 2 shows my MSDN Magazine Ticker gadget (that shows scrolling article headlines from the most recent issue) and a weather gadget (that ships with Windows Vista) in both their docked and floating states. The weather gadget is an excellent example of a gadget that provides a richer experience when floating—it goes from giving just the current temperature to giving a detailed three day forecast. The MSDN Magazine Ticker gadget doesn’t display any additional information; it simply expands to show the same information in a wider format.
Figure 2 Docked and Floating Gadgets (Click the image for a larger view)
Note that there is an undocumented minimum height of 57 pixels for a gadget (whether docked or floating). The reason for this minimum is simple: the height of the toolbar when a gadget is in its floating state is 57 pixels (see Figure 3).
Figure 3
You can query the current state of a gadget with System.Gadget.docked. It returns true if docked, false if undocked. There are also two events that you can monitor, System.Gadget.onDock and System.Gadget.onUndock, to determine when the docking state changes.
You cannot simply change the class of the document.body from within an onDocked or onUndocked event to change the height, width, or background image of a gadget (this is contrary to my initial expectations). Instead, you must specifically set the properties of the style object of the body element. To change the background image, use the System.Gadget.background API to set the filename of the background image. Here’s an example:
// called when the docked state changes
function dockStateChanged() {
    if (System.Gadget.docked) {
        System.Gadget.background = “images/background.png”;
        document.body.style.width = “130px”;
    } else {
        System.Gadget.background = “images/background-undocked.png”;
        document.body.style.width = “230px”;


A flyout extends the user interface outside of the gadget’s own borders. You can use this window for anything you wish. (There is no maximum size imposed for flyout windows.) A good example of a gadget that uses a flyout is the Stocks gadget that ships with Windows Vista. Clicking on a stock causes a window to fly out to the side of the gadget, displaying a graph of that stock’s activity (see Figure 4). The Live Search gadget also uses a flyout, displaying search results for the query you entered. Figure 5 shows a flyout from our MSDN Magazine Ticker gadget. Notice that when a headline is clicked, the UI extends out from the docked gadget to show the article title, a description, and the author’s name.
Figure 4 Stocks Gadget Displaying a Flyout (Click the image for a larger view)
Figure 5Ticker Gadget Displaying a Flyout (Click the image for a larger view)
Note that Sidebar gadget flyouts are system modal—only one can be displayed at a time. If the user clicks on Gadget A, causing a flyout, and then clicks on Gadget B, causing another flyout, Gadget A’s flyout will close. Furthermore, when a gadget loses focus, its flyout will close.
The flyout APIs are exposed from the System.Gadget.Flyout object. A flyout lives in a completely isolated window (with its own DOM) from that of the main HTML window. As such, you need to provide a separate flyout HTML file, along with any other necessary supporting files. The flyout file is specified by setting System.Gadget.Flyout.file to the name of the flyout HTML file.
There is an API you can use to facilitate communication between the main and flyout windows. System.Gadget.Flyout.document returns the Document object of the flyout window. You can use this from the main gadget window to dynamically generate HTML in the flyout window.
There are also events that can be captured by both the main and flyout code. These include onShow, which is called just after the flyout document has been created, and onHide, which is called just before the flyout document is destroyed.
You can programmatically show or hide the flyout by setting System.Gadget.Flyout.show to true or false, respectively. And reading this value will tell you the current state of the flyout window.
Keep in mind that you cannot control the location of the flyout. Sidebar determines the location based on screen real estate and the position of the gadget itself. For example, the flyout could be displayed to the left or to the right of the gadget. Or even below it.

Options Dialog

The options dialog allows you to present the user with a list of gadget preferences. The user experience can be most anything you want. The dialog can be just like a regular Web page with radio buttons, checkboxes, and textboxes.
A user can access the options dialog by clicking on the wrench icon in the gadget’s toolbar (see Figure 3), which appears when you hover over the gadget. When a user opens the options dialog of a gadget, Sidebar takes a snapshot of the gadget and displays the image as a small icon (see Figure 6).
Figure 6 

Options Dialog

I would like to point out that there is some ambiguity when it comes to the name of this dialog. When you right-click on a gadget, the gadget UI presents a menu that refers to this as “Options.” The API, however, refers to this as “settings.”
I was a bit surprised to find that user settings are stored in a circa 1990 INI file instead of a more modern XML file. Fortunately, there are gadget APIs to read and write settings, so where and how the settings are stored is of little concern to you or your application.
There are a few caveats when it comes to creating your options UI. The width of the user area of the dialog is limited to a maximum of 300 pixels. There is no height limit, but the Microsoft UX Guide for Windows Vista Gadgets recommends a maximum width of 278 pixels and a height of no more than 400 pixels. If you need more room, you should probably create a tabbed dialog. I won’t talk about how to implement a tabbed UI in this article, but there are plenty of resources on the Web to learn how you can do this.
You need to instruct the gadget to enable the options icon. This is done by setting System.Gadget.settingsUI to the name of the HTML file, generally in the gadget initialization area of your script. You also need to set up a callback function for when the options dialog closes (so your gadget can read the new user preferences). You do this by setting System.Gadget.onSettingsClosed to the name of your handler, as shown here:
System.Gadget.settingsUI = “settings.html”;
System.Gadget.onSettingsClosed = settingsClosed; 

function settingsClosed(p_event) {
    //OK clicked?
    if (p_event.closeAction == p_event.Action.commit) {
        //yes, read settings here
As you can see from this example, when the handler is called, it is passed an event object— specifically the System.Gadget.Settings.ClosingEvent event object. If the closeAction property of the ClosingEvent object contains a value of commit, this means the user selected OK and you will likely want to read the new settings. Otherwise, the options dialog was canceled and you can bypass reading of the preferences.

Reading and Writing Settings

Settings are written using System.Gadget.Settings.write or System.Gadget.Settings.writeString. Both are passed a key/value pair. Conversely, settings are read with System.Gadget.Settings.read or System.Gadget.Settings.readString. Both of these functions take a key and return a value. If the key does not exist (for instance if it has never been written) both will return a value of undefined.

JavaScript is not a strongly typed language and if you use write and read, Sidebar will attempt type conversion. If you want to be absolutely sure what is written and read, consider using writeString and readString as these will assume strings. Depending on the type of data in question, you will have to determine which methods will work best.


Sidebar gadgets support localization by way of “localized folders.” Whenever Sidebar tries to load an asset (a gadget manifest, style sheet, image file, JavaScript file), it searches for the file in folders in the following order:
  • Full locale (en-us, es-us, ja-jp)
  • Language portion of the locale (en, es, ja)
  • Gadget root folder
For example, if you are running a US version of Windows Vista and your preferences are set to Spanish, Sidebar will first look in the folder es-us. If the file is not found there, Sidebar will then search the es folder. And finally, if the file is still not found, Sidebar will search the gadget root folder.
Language is obviously important, but why is location important? Location is actually very important for certain gadgets. Consider the weather gadget. You may display the word sunny to users in both the United States and the United Kingdom, but the location will determine whether you should display the temperature in Fahrenheit (US) or Celsius (UK).
Many developers will likely support an English-only gadget, but if locale is important to you I recommend that you put all of your language-specific strings and location-specific variables in a single JavaScript file called local.js and place this file in the gadget root folder. Then create a folder for each locale that you are going to support and copy the translated versions of local.js into their respective folders. Here is an example of a local.js file in the root folder, representing en-us:
var L_Hello = “Hello”;
var L_Degrees = 0;
The same file in the \es-es folder may look like this:
var L_Hello = “Hola”;
var L_Degrees = 1;
When you want to display Hello, you would use the variable L_Hello rather than the hardcoded string. And when querying the weather feed, you would use L_Degrees to request the proper format. This produces a greeting in the appropriate language and gives the temperature according to the user’s preferences. In your main JavaScript code, when you want to use a string or determine what to use for degrees, you would do something like this:
element.innerHTML = L_Hello;
if (L_Degrees === 0) {
    //load the Fahrenheit feed
} else {
    //load the Celsius feed
As you can see, your code will react differently depending on which local.js file is loaded by Sidebar. Cool, huh?
Note that with the English local.js in the gadget root, the gadget will still function for non-supported locales, albeit in the fallback language (in this case English). It is very important to support a default language in your gadget’s root folder. If you don’t provide a default language and someone uses a language that isn’t supported by your gadget (meaning a language for which you have not created a subfolder), your gadget will display blank strings.

What Happened to Alert and Confirm?

We’ve all been on Web sites and received the “Invalid input, please try again” alert and the “Delete record. Are you sure?” confirmation dialog. Developers often want to pop up informational messages like these.
Sidebar, however, has disabled these JavaScript functions. Using popup dialogs goes against the Windows Vista UX guidelines for Sidebar gadgets. If you still feel compelled to use popups, you can emulate these functions.
To do this, first insert a simple one line tag into the head element of your HTML:
<script src=”alert.vbs” type=”text/vbscript”></script>
Then create a file that contains the code shown below and name it alert.vbs. Now you can continue to use alert and confirm as you wish.
‘simulate JavaScript alert() function
sub alert(prompt)
    MsgBox prompt, 48 , “Sidebar Gadget”
end sub

‘simulate JavaScript confirm() function
function confirm(prompt)
    dim res
    res = MsgBox (prompt, 33, “Sidebar Gadget”)
    if res=1 then
        confirm = true
        confirm = false
    end if
end function


Debugging JavaScript has always been tricky. Many developers have resorted to placing alerts in their code to display the values of certain variables. This, however, is not an elegant solution. A better method involves using Visual Studio® (or even the free Visual Web Developer™ 2005 Express Edition). 

Simply place debugger statements in your code, wherever you need to check the value of a variable, then run the gadget. When JavaScript executes the debugger statement, you should see a popup that asks if you want to debug the application (see Figure 8 ). Choosing Yes will allow you to browse the entire gadget environment, including the DOM, and view the value of any variable created. Your gadget is essentially frozen in time.
Figure 8 Do You Want to Debug Your Gadget? (Click the image for a larger view) 

Figure 9 shows a section of debugged code where the value of the variable refreshRate is 24. This form of debugging is very powerful. Once you try it, you’ll never go back to spattering your code with alert statements. Note that JavaScript debugging is vastly improved in the next version of Visual Studio code-named “Orcas.” You can read more about these new features at JScript Debugging in Visual Web Developer Orcas, and you can download “Orcas” Beta 1 at msdn2.microsoft.com/aa700831.

Figure 9Debugging a Gadget in Visual Studio (Click the image for a larger view)

Packaging Your Gadget

The simplest way to create a package is with Windows Explorer. Select the files that make up your gadget, right-click, and select Send To | Compressed (zipped) Folder.
You can also package your gadget as a CAB file, which is the Microsoft native compressed archive format. Just generate the CAB file and then rename it with a .gadget extension. (By the way, if you ever try renaming a .gadget file with a .zip extension and Windows Explorer complains when you try to open this ZIP file, try renaming the file with a .cab extension instead.)
There are a few different methods you can use if you want to programmatically generate a gadget. In my projects, I create the following batch file called make.bat:
@echo off

rem ** remove/create a test gadget folder
rd “%LOCALAPPDATA%\Microsoft\Windows Sidebar\
    Gadgets\MSDNSample.gadget\” /s /q
md “%LOCALAPPDATA%\Microsoft\Windows Sidebar\Gadgets\MSDNSample.gadget\”

rem ** copy all of the files into test area
xcopy . “%LOCALAPPDATA%\Microsoft\Windows Sidebar\
    Gadgets\MSDNSample.gadget\” /y /s /q /EXCLUDE:exclude.txt

cd “%LOCALAPPDATA%\Microsoft\Windows Sidebar\Gadgets\MSDNSample\”
cabarc -r -p n “%HOMEPATH%\Documents\MSDNSample.gadget” *
This uses the Cabarc.exe utility to generate a CAB file. (Cabarc.exe is a free Microsoft tool that is installed with Visual Studio. It’s also available separately as part of the Cabinet SDK, which you can download from support.microsoft.com/kb/310618.)
From within Visual Studio 2005, I run make.bat, which I have set up as an external tool. The batch file creates a folder under the user gadgets folder (which is where gadgets are created when installed) and copies all of the gadget files into the new folder. My batch file also generates a .gadget file that is ready for distribution and places it in the Documents folder. When you use this method, there is no need to double-click on the .gadget file to install the gadget on your development machine. I love the technique as it allows me to keep other source files in my Visual Studio project folder (such as Photoshop PSD files) that I don’t want to package with the gadget. If you do this, just be sure to place the names of the files you want to exclude in the exclude.txt file.

The MSDN Magazine Ticker

Now that I’ve covered all the basic components of a gadget, I’d like to present a sample gadget that pulls all the parts together. The MSDN Magazine Ticker gadget is available as a download so you can install it or simply explore its contents.
I wanted my sample gadget to use all of the major features of a Sidebar gadget (flyouts, docked versus floating states, options, localization, and so on). But I also wanted the sample gadget to be simple. And it had to be somewhat useful. Read complete here (Actual Source)



Download our free tools bar to get latest update without even visiting our website.


Download it from here



You have often used text to speech converters software or may be right now you are using it to read this article (if you have a good one!). But have you ever thanked about it, I mean how it works? You will probably say it is simple, there must be a file which contains already spoken up words and these files have certain numbers, when a particular text is meant to be spoken up a logic runs and trace out the file that may be a wav file and run it and this is how a T2S works.

Or may be you have not even think about it, but for those developers who wanna know how this happens I’ll describe you in this article, this document will give you a technical overview of text-to-speech so you can understand how it works, and better understand some of the capabilities and limitations of the technology.

Text-to-speech fundamentally functions as a pipeline that converts text into PCM digital audio. The elements of the pipeline are:

  • Text normalization
  • Homograph disambiguation
  • Word Pronunciation
  • Prosody
  • Concatenate wave segments

I’ll cover each of these steps individually

Text Normalization

Text Normalization it is that part of text-to-speech program that converts any input text into a series of spoken words. At basic level, text normalization converts a string like “My name is Ritesh” to a series of words, “My”, “name”, “is”, “Ritesh”, along with a marker indicating that a period occurred (a comma). However, this gets more complicated when strings like “John rode home at 23.5 mph”, where “23.5 mph” is converted to “twenty three point five miles per hour”. Here’s how text normalization works:

First, text normalization isolates words in the text. For the most part this is as minor as looking for a sequence of alphabetic characters, allowing for an occasional apostrophe, space and hyphen.

Text normalization then searches for numbers, times, dates, and other symbolic representations. These are analyzed and converted to words. (Example: “$54.32” is converted to “fifty four dollars and thirty two cents.”) Someone needs to code up the rules for the conversion of these symbols into words, since they differ depending upon the language and context.

Next, abbreviations are converted, such as “in.” for “inches”, and “St.” for “street” or “saint”. The normalizer will use a database of abbreviations and what they are expanded to. Some of the expansions depend upon the context of surrounding words, like “St. John” and “John St.”

The text normalizer might perform other text transformations such as internet addresses. “http://www.Microsoft.com&#8221; is usually spoken as “w w w dot Microsoft dot com”.

Whatever remains is punctuation. The normalizer will have rules dictating if the punctuation causes a word to be spoken or if it is silent. (Example: Periods at the end of sentences are not spoken, but a period in an Internet address is spoken as “dot.”)

The rules will vary in complexity depending upon the engine.

Homograph Disambiguation

So by reading till here you were wondering that all of the main task has happened but dude there are other things also whose care must be take otherwise your text to speech wont work efficiently. This stage mainly deals with pronunciation of words.

Actually it’s not a stage by itself, but is combined into the text normalization or pronunciation components. I’ve separated homograph disambiguation out since it doesn’t fit cleanly into either.

In English and many other languages, there are hundreds of words that have the same text, but different pronunciations. A common example in English is “read,” which can be pronounced “reed” or “red” depending upon its meaning. A “homograph” is a word with the same text as another word, but with a different pronunciation. The concept extends beyond just words, and into abbreviations and numbers. “Ft.” has different pronunciations in “Ft. Wayne” and “100 ft.”. Likewise, the digits “1997” might be spoken as “nineteen ninety seven” if the author is talking about the year, or “one thousand nine hundred and ninety seven” if the author is talking about the number of people at a concert.

So the above procedure is quite tough how a computer could knows that when to pronounce “read” as “reed” or as “red”. One way is by judging what out what the text is actually talking about and decides which meaning is most appropriate given the context. Once the right meaning is know, it’s usually easy to guess the right pronunciation.

Text-to-speech engines figure out the meaning of the text, and more specifically of the sentence, by parsing the sentence and figuring out the part-of-speech for the individual word (see how complicated it is, do you remember how many part of speech are there?). This is done by guessing the part-of-speech based on the word endings, or by looking the word up in a lexicon. Sometimes a part of speech will be ambiguous until more context is known, such as for “read.” Of course, disambiguation of the part-of-speech may require hand-written rules.

Once the homographs have been disambiguated, the words are sent to the next stage to be pronounced.

Word Pronunciation

The pronunciation module accepts the text, and outputs a sequence of phonemes, just like you see in a dictionary.

To get the pronunciation of a word, the text-to-speech engine first looks the word up in it’s own pronunciation lexicon. If the word is not in the lexicon then the engine reverts to “letter to sound” rules.

Now what is Letter-to-sound rules, it guess the pronunciation of a word from the text. They’re kind of the inverse of the spelling rules you were taught in school. There are a number of techniques for guessing the pronunciation, but the algorithm described here is one of the more easily implemented ones.

The letter-to-sound rules are “trained” on a lexicon of hand-entered pronunciations. The lexicon stores the word and it’s pronunciation, such as:

hello h eh l oe

An algorithm is used to segment the word and figure out which letter “produces” which sound. You can clearly see that “h” in “hello” produces the “h” phoneme, the “e” produces the “eh” phoneme, the first “l” produces the “l” phoneme, the second “l” nothing, and “o” produces the “oe” phoneme. Of course, in other words the individual letters produce different phonemes. The “e” in “he” will produce the “ee” phoneme.

Once the words are segmented by phoneme, another algorithm determines which letter or sequence of letters is likely to produce which phonemes. The first pass figures out the most likely phoneme generated by each letter. “H” almost always generates the “h” sound, while “o” almost always generates the “ow” sound. A secondary list is generated, showing exceptions to the previous rule given the context of the surrounding letters. Hence, an exception rule might specify that an “o” occurring at the end of the word and preceded by an “l” produces an “oe” sound. The list of exceptions can be extended to include even more surrounding characters.

When the letter-to-sound rules are asked to produce the pronunciation of a word they do the inverse of the training model. To pronounce “hello”, the letter-to-sound rules first try to figure out the sound of the “h” phoneme. It looks through the exception table for an “h” beginning the word followed by “e”; Since it can’t find one it uses the default sound for “h”, which is “h”. Next, it looks in the exceptions for how an “e” surrounded by “h” and “l” is pronounced, finding “eh”. The rest of the characters are handled in the same way.

This technique can pronounce any word, even if it wasn’t in the training set, and does a very reasonable guess of the pronunciation, sometimes better than humans. It doesn’t work too well for names because most names are not of English origin, and use different pronunciation rules. (Example: “Mejia” is pronounced as “meh-jee-uh” by anyone that doesn’t know it is Spanish.) Some letter-to-sound rules first guess what language the word came from, and then use different sets of rules to pronounce each different language.

Word pronunciation is further complicated by people’s laziness. People will change the pronunciation of a word based upon what words precede or follow it, just to make the word easier to speak. An obvious example is the way “the” can be pronounced as “thee” or “thuh”. Other effects including the dropping or changing of phonemes. A commonly used phrase such as “What you doing?” sounds like “Wacha doin?”

Once the pronunciations have been generated, these are passed onto the prosody stage.


Now you will be thinking its all over but “kahani abhi baki hai dost” Now since you are able to pronounce the word but by merely pronouncing the word is not sufficient you need to speak in a tone, in a speed and other factors are also involved in a speech. This section will deals with all these factors.

Prosody is the pitch, speed, and volume that syllables, words, phrases, and sentences are spoken with. Without prosody text-to-speech sounds very robotic, and with bad prosody text-to-speech sounds like it’s drunk.

The technique that engines use to synthesize prosody varies, but there are some general techniques.

First, the engine identifies the beginning and ending of sentences. In English, the pitch will tend to fall near the end of a statement, and rise for a question. Likewise, volume and speaking speed ramp up when the text-to-speech first starts talking, and fall off on the last word when it stops. Pauses are placed between sentences.

Engines also identify phrase boundaries, such as noun phrases and verb phrases. These will have similar characteristics to sentences, but will be less pronounced. The engine can determine the phrase boundaries by using the part-of-speech information generated during the homograph disambiguation. Pauses are placed between phrases or where commas occur.

Algorithms then try to determine which words in the sentence are important to the meaning, and these are emphasized. Emphasized words are louder, longer, and will have more pitch variation. Words that are unimportant, such as those used to make the sentence grammatically correct, are de-emphasized. In a sentence such as “John and Bill walked to the store”, the emphasis pattern might be “JOHN and BILL walked to the STORE.” The more the text-to-speech engine “understands” what’s being spoken, the better it’s emphasis will be.

Next, the prosody within a word is determined. Usually the pitch and volume rise on stressed syllables.

All of the pitch, timing, and volume information from the sentence level, phrase level, and word level are combined together to produce the final output. The output from the prosody module is just a list of phonemes with the pitch, duration, and volume for each phoneme.

Play Audio

The speech synthesis is almost done by this point. All the text-to-speech engine has to do is convert the list of phonemes and their duration, pitch, and volume, into digital audio.

Methods for generating the digital audio will vary, but many text-to-speech engines generate the audio by concatenating short recordings of phonemes. The recordings come from a real person. In a simplistic form, the engine receives the phoneme to speak, loads the digital audio from a database, does some pitch, time, and volume changes, and sends it out to the sound card.

It isn’t quite that simple for a number of reasons.

Most noticeable is that one recording of a phoneme won’t have the same volume, pitch, and sound quality at the end, as the beginning of the next phoneme. This causes a noticeable glitch in the audio. An engine can reduce the glitch by blending the edges of the two segments together so at their intersections they both have the same pitch and volume. Blending the sound quality, which is determined by the harmonics generated by the voice, is more difficult, and can be solved by the next step.

The sound that a person makes when he/she speaks a phoneme, changes depending upon the surrounding phonemes. If you record “cat” in sound recorder, and then reverse it, the reversed audio doesn’t sound like “tak”, which has the reversed phonemes of cat. Rather than using one recording per phoneme (about 50), the text-to-speech engine maintains thousands of recordings (usually 1000-5000). Ideally it would have all possible phoneme context combinations recorded, 50 * 50 * 50 = 125,000, but this would be too many. Since many of these combinations sound similar, one recording is used to represent the phoneme within several different contexts.

Even a database of 1000 phoneme recordings is too large, so the digital audio is compressed into a much smaller size, usually between 8:1 and 32:1 compression. The more compressed the digital audio, the more muted the voice sounds.

Once the digital audio segments have been concatenated they’re sent off to the sound card, making the computer talk.

Generating a Voice

You might be wondering, “How do you get thousands of recordings of phonemes?”

The first step is to select a voice talent. The voice talent then spends several hours in a recording studio reading a wide variety of text. The text is designed so that as many phonemes sequence combinations are recorded as possible. You at least want them to read enough text so there are several occurrences of each of the 1000 to 5000 recording slots.

After the recording session is finished, the recordings are sent to a speech recognizer which then determines where the phonemes begin and end. Since the tools also know the surrounding phonemes, it’s easy to pull out the right recordings from the speech. The only trick is to figure out which recording sounds best. Usually an algorithm makes a guess, but someone must listening to the phoneme recordings just to make sure they’re good.

The selected phoneme recordings are compressed and stored away in the database. The result is a new voice.

Wrapping up

This was a high level overview of how text-to-speech works. Most text-to-speech engines work in a similar manner, although not all of them work this way. The overview doesn’t give you enough detail to write your own text-to-speech engine, but now you know the basics. If you want more detail you should purchase one of the numerous technical books on text-to-speech.



Whole article is somewhat modified to make it more interesting and easier to read.

The article is taken from Microsoft’s text to speech SDK.

Partially compiled & edited by – Ritesh Kawadkar


Download our free tools bar to get latest update without even visiting our website.


Download it from here

C. My Computer

1. Remove Shared Documents and My Documents Folder

2. Prevent access to certain drive
3. Remove Shared Folder
4. Add Recycle Bin in My computer
5. Hide drives in my Computer
6. Remove properties option from my computer
7. Invisible Folder and Drive
8. Remove Compression Option In Disk Cleanup


1. Remove Shared Documents and My Documents Folder

Want to remove Shared Documents and My Documents folder from My Computer here is the way how you can get rid of it.
1. Open Regedit. (type Regedit in RUN dialog box)
2. Navigate to

3. And delete the subkey

Hate editing Registry so here’s a simple and clean way
1. Open Group Policy Editor. (Type gpedit.msc in RUN dialog box)
2. Navigate to User Configuration>Administrative Templates>Windows
Components> Windows Explorer.

3. On the right pane double click on option Remove Shared Documents folder
from My Computer and Enable it.

2. Prevent access to certain drive

This is an ultimate restriction if you want that no one access you’re hard drives accept you than it is what you are looking for. This tweak will disable access to your drives even their contents are not visible by using dir command or by using search.
Navigate to
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Polici es\Explorer
And to
Policies \Explorer

Here create a new DWORD named NoViewOnDrive and set its value to 4(in dec) if you want to restrict your C drive.

For restricting other drives set the value accordingly

A 1
B 2
C 4
D 8
E 16
F 32
G 64
H 128
I 256
J 512
K 1024
L 2048
M 4096
N 8192
0 16384
P 32768
Q 65536
R 131072
S 262144
T 524288
U 1048576
V 2097152
W 4194304
X 8388608
Y 16777216
Z 33554432
ALL DRIVES 67108863

FOR EG: To hide drive C and D, you would add 4(for C) and 8(for D) which would be 12 and then set the value of NoViewOnDrive to 12 in order to restrict drives C and D.


Go to
User Configuration> Administrative Template> Windows Component> WindowsExplorer

And double click on Prevent access to drives from My Computer and Enable it and select the drives you want to prevent

3. Remove Shared Folder

To remove the Shared Documents folder follow the given steps
1. Open Regedit. (Type Regedit in RUN dialog box)
2. Navigate to

3. On right pane create a Binary value named NoSharedDocuments and set its
value to 1, to revert back just delete the key

4. Add Recycle Bin in My computer

To add recycle bin in My Computer go to

Create a subkey named {645FF040-5081-101B-9F08-00AA002F954E} under NameSpace

Complete path would like this

Explorer\MyComputer\NameSpace\ {645FF040-5081-101B-9F08-

And you will have Recycle Bin in you’re my Computer

5. Hide drives in my Computer

To hide drives in My Computer navigate through


And create a DWORD and name it NoDrives and give it value 03ffffff (in hex)

To revert back, just delete the following DWORD created.

6. Remove properties option from my

This tweak hides the system properties screen and remove the properties option from my computer.
Navigate to

And to

Create a new DWORD value in both locations called NoPropertiesMyComputer.
Set its value to 1 to hide the properties option.

7. Invisible Folder and Drive

Yes, it is possible to create invisible drives that remain there only but nobody can see it.

The idea of creating this invisible drive struck my mind when I came to knew how to create an invisible folder. So I must first tell you how to create an invisible folder. To create invisible folders first create a folder say “Ritesh”. Now right click on the folder and select Rename.

Now while pressing ALT click 0160 (ALT+0+1+6+0) and hit enter. You will get a folder with no name. So our half process is done now you need to hide the folder to hide it right click the folder and click on

Properties > customize > change icon

Now look for an empty space in the change icon dialog box and click on it and then click ok.
Now you are done!

You will have an invisible folder.

So you have created an invisible folder. Now, after creating invisible folder the idea of making
invisible hard drive is quite simple
The only 2 problem are that
1. How to change drive icons.
2. How to remove drive letters.

First, rename the drive that you want to hide by the method given above for folders. Then follow
these steps
1. To change drive icons navigate to
HKLM > Software > Microsoft > Windows > CurrentVersion > Explorer
Create a new key DriveIcons

In this key again create a key named C (Drive letter of the drive which you want to hide)
In this key again create a key name it DefaultIcon

Now the path will be

HKLM > Software > Microsoft > Windows > CurrentVersion > Explorer> DriveIcons > C> DefaultIcon

On the right pane you will find a string named Default double click the string and enter the full path of the blank icon in it which is
This is the path of blank icon.

2. Now we have hided the drive icon now to hide drive letter from appearing navigate to

HKLM > Software > Microsoft > Windows > CurrentVersion > Explorer

Now on the right pane create a DWORD name it ShowDriveLettersFirst and give it the value 2

Now Logoff/Logon your system to see the changes you have made.

8. Remove Compression Option In Disk Cleanup

Go to-
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Compress old files

Delete the Default Value Key and the next time you start Disk Cleanup, it will skip
the compression analysis


Download our free tools bar to get latest update without even visiting our website.


Download it from here

B. Folders

1. Add Command Prompt Option to Every

2. Folder Pictures in Thunbnail View
3. Thumbnail size and Quality
4. Customize “New Folder” and “New Shortcut” Text
5. Locking every Folder
6. Disable the Folder Option menu
7. Windows forgets your Folder settings
8. Add copy to/Move to at right click
9. Disable Thumbnail caching
10. Locking a particular folder
11. Invisible Folder
12. ZIP files are not Folders
13. Applying Background to any folder
14. Remove shortcut arrow
15. WIN+E single pane
16. Add copy to/Move to at right click
17. Disable Thumbnail caching


1. Add Command Prompt Option to Every

To add Command Prompt Option to every folder right click menu do the following
1. Open Regedit. (type Regedit in RUN dialog box)
2. Navigate to HKEY_CLASSES_ROOT\Directory\shell
3. Create a key named Command under shell
4. So that the path would be
5. On the right pane double click on default and set its value to Command
6. Now create a key named command under Command
7. So that the path would be
8. On the right pane double click on default and set its value to cmd.exe /k cd%1
just copy paste the following code In notepad and save it as cmd.reg
Windows Registry Editor Version 5.00
“”=”Command Prompt”
“”=”cmd.exe /k cd %1”

2. Folder Pictures in Thunbnail View

We all know that images within a folder show up in Thumbnail view of the folder.
You can manually set only one picture to show up by going to
Properties>Customize>Choose Picture.
You can do this by another way also, let say you have a Folder having a lot of
picture to show a picture in thumbnail view just RENAME the PICTURE to
and you are Done!!!

3. Thumbnail size and Quality

To increase/decrease the thumbnail size and quality just open Regedit and
navigate to
Now create two DWORD value named
ThumbnailSize and ThumbnailQuality and give their value as you wants. I
recommend ThumbnailSize=225 (decimal) and ThumbnailQuality=100 (decimal)

4. Rename New Folder

Whenever you create a new folder or a new shortcut the default name of that folder is “New Folder” or a “New shortcut” in case you created a shortcut.
In this tutorial i will show that how you can change the name of these two entries permanently, so that whenever you create a new folder you will can see your desired text.

What you need?
1. For this tutorial we need a software called Resource hacker which is freely available. Just download the software from here
2. After tweaking your system file you need to replace your system file with your modded file for that download Replacer

How to do?
1. Open “%windir%\System32\Shell32.dll” file in Resource Hacker and go to:
String Table -> 1896


2. Now in the right-side pane, you will see default “New Folder” and “New Shortcut” strings.


3. All you need to do is to replace the default string with your desired string and click Compile script at the end.


4. Then save the file as Shell32.dxx on desktop

5. Now open replacer >

6. Drag the original shell32.dll on it and press enter

7. when it ask for replcement file drag the file Shell32.dxx which you saved and hit enter

8. you need to restart your system to see changes.

5. Locking every Folder

To lock every folder so that no one can navigate in any of your computer open
Regedit and go to
And rename the subkey Shell to Shell._

6. Disable the Folder Option menu

To disable Folder Options navigate to
And to
Here, create the DWORD named NoFolderOptions
And set its value to 1(decimal) to hide the Folder Options. Reset it to 0(decimal) to enable Folder Options.

7. Windows forgets your Folder settings

Windows sometimes forgets your folder customizations i.e. whether folders are in thumbnail view, list view or in any other view their positions etc. This happens because windows by default can remember settings of 400 (in some cases it is 5000) folders only and as the 400 mark is reached it forgets the older settings.

Here’s how you can increase folder no
Navigate to
And to
And edit the value of DWORD value named BagMRU Size to any no maximum is 8000 (in decimal)

8. Add copy to/Move to at right click

Navigate to
Create a new key here called Copy To
So the path would look like this
Copy To

and set its default value to
Similarly, Create a new key called Move To under ContextMenuHandlers
So the path would look like this
Move To

And set its value to

9. Disable Thumbnail caching

Navigate to
Set the DWORD value names DisableThumbnailCache to 1
ClassicViewState to 1

10. Locking a particular folder

Let suppose you have a folder named Secret to lock this folder renames this folder
to Secret. {645FF040-5081-101B-9F08-00AA002F954E} this will convert the folder
into Recycle bin now if someone tries to open this folder he will see the contents of
recycle bin.
Similarly you can convert any folder into the following special folder by just
renaming the folder
Media Clip {00022602-0000-0000-C000-000000000046}
Cabinet File {0CD7A5C0-9F37-11CE-AE65-08002B2E1262}
Taskbar and Start Menu {0DF44EAA-FF21-4412-828E-260A8728E7F1}
My Network Places {208D2C60-3AEA-1069-A2D7-08002B30309D}
My Computer {20D04FE0-3AEA-1069-A2D8-08002B30309D}
Recycle Bin {645FF040-5081-101B-9F08-00AA002F954E}
Folder Option {6DFD7C5C-2451-11d3-A299-00C04F8EF6AF}
Network Connection {7007ACC7-3202-11D1-AAD2-00805FC1270E}

To unlock
Open Notepad and type the following as it is and save the file as unlock.bat
Ren Secret. {645FF040-5081-101B-9F08-00AA002F954E} Secret
And that’s it your folder will be unlocked.

11. Invisible Folder

To hide a folder select the folder and press F2 now press SPACE BAR and type [ALT]
+ 0160 and then press Enter.
Now, Go to Folder Properties >Customize and click on change icon
In the change Icon dialog box scroll for a blank space, select it and click Ok.
You are done!

12. ZIP files are not Folders

When you search for folders using windows search Zip files also comes in it. To make windows not to treat zip files as folder
Open RUN
Type regsvr32 /u zipfldr.dll

13. Applying Background to any folder

1. You need to first make your folder a system folder for that open Command Prompt and set folder attribute to “system”. For e.g. there is a folder “Ritesh” in “D:” drive, in which you want to set a wallpaper as background image. To do that open Command Prompt and type:

attrib +s D:\Ritesh

It’ll change the attribute to “system”.

2. Now open Notepad and paste following code:

{BE098140-A513-11D0-A3A4-00C04FD706EC} = {BE098140-A513-11D0-A3A4-00C04FD706EC}


Now change “Actualpathof_the_wallpaper” to the exact path of the wallpaper which you want to set as background. Suppose the wallpaper is located in “E:\Images\Ganesh.jpg”, then the above code will be set to:

{BE098140-A513-11D0-A3A4-00C04FD706EC} = {BE098140-A513-11D0-A3A4-00C04FD706EC}


“IconArea_Text” is the text color, you can also change the text color for a particular folder (default is Black). You just need to place the code in “IconArea_Text” section. Some of the color codes are as follows:

Black – 0x00000000
White – 0x00FFFFFF
Green – 0x0000FF00
Blue – 0x00FF0000
Purple – 0x00C000C0
Red – 0x000000FF
Yellow – 0x0000FFFF
Indigo – 0x00FFFF00

3. Now save the file with name “Desktop.ini” (including quotes) in “D:\Ritesh” as in our e.g.

4. Now when you open your folder you will see backround in your folder

14. Remove shortcut arrow

For removing shortcut arrow from icons, folder and drives go to
In the right pane create a new string value named 29. Double click on 29 and set
its value to
Now, right click on the desktop & click Properties>Appearance>Advanced from
drop down menu choose icon. Set its size to 31 and press OK.
NOTE: If default size of icon is 31 then change it to 32

15. WIN+E single pane

What happens when you press WIN+E?
Yes explorer opens but it has a two pane layout
You can tweak registry to make explorer open in single pane layout for that
navigate to
Here modify the default key and change its value to [ViewFolder(“%l”, %I, %S)]
with brackets.
To revert back the setting change the value to [ExploreFolder(“%l”, %I, %S)]


Download our free tools bar to get latest update without even visiting our website.


Download it from here

Understanding Regedit

The Microsoft Registry Editor enables you to view, search for, and change settings in your system registry, which contains information about how your computer runs. Windows stores its configuration information in a database called the registry which can be accessed using Regedit.exe(Registry Editor). The registry contains profiles for each user of the computer and information about system hardware, installed programs, and property settings. Windows continually references this information during its operation. Although you can use Registry Editor to inspect and modify the registry, doing so is not recommended, as making incorrect changes can damage your system.

Registry Editor overview
Registry Editor is an advanced tool for viewing and changing settings in your system registry which contains information about how your computer runs. Windows stores its configuration information in a database (the registry) that is organized in a tree format.When you view the registry in the Microsoft Registry Editor its hierarchical nature becomes obvious. The editor presents an Explorer-like view of the registry, with a tree in the left pane and data in the right

Arcitecture of regedit

The registry tree is divided into six broad sections (five in NT). HKEY_CLASSES_ROOT HKEY_CURRENT_USER HKEY_LOCAL_MACHINE HKEY_USERS HKEY_CURRENT_CONFIG HKEY_DYN_DATA Folders represent keys in the registry and are shown in the navigation area on the left side of the Registry Editor window. On the left side below My Computer their are five keys HKEY_CLASSES_ROOT, HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE, HKEY_USERS, HKEY_CURRENT_CONFIG, HKEY_DYN_DATA. On expanding these Keys we’ll get the sub keys. In the right side area, the entries in a particular sub key are displayed, which are Name(Contains name of the value), Type(contains type of the value), and Data(Contains associated data of the value.)When you double-click a entry, it opens an editing dialog box. At the status bar of regedit path is shown.

navigating regedit

You should not edit your registry unless it is absolutely necessary. If there is an error in your registry, your computer may not function properly. If this happens, you can restore the registry to the same version you were using when you last successfully started your computer Regedit.exe is automatically installed during setup and is stored in same folder as is Windows. To start Regedit.exe

  1. Click Start, and then click Run.
  2. Type Regedit, and then click OK.

The navigation area of the Registry Editor displays folders, each of which represents a predefined key (a key that represents one of the main division of the registry for eg: HKEY_LOCAL_MACHINE ) on the local computer. When accessing the registry of a remote computer, only two predefined keys, HKEY_USERS and HKEY_LOCAL_MACHINE, appear.

Folder/predefined key Description
HKEY_CURRENT_USER Contains the root of the configuration information for the user who is currently logged on. The user’s folders, screen colors, and Control Panel settings are stored here. This information is referred to as a user’s profile.
HKEY_USERS Contains the root of all user profiles on the computer. HKEY_CURRENT_USER is a subkey of HKEY_USERS.
HKEY_LOCAL_MACHINE Contains configuration information particular to the computer (for any user).
HKEY_CLASSES_ROOT Is a subkey of HKEY_LOCAL_MACHINE\Software. The information stored here ensures that the correct program opens when you open a file by using Windows Explorer.
HKEY_CURRENT_CONFIG Contains information about the hardware profile used by the local computer at system startup.

The following table lists the data types currently defined and used by the system.

Data type Description
REG_BINARY Raw binary data. Most hardware component information is stored as binary data and is displayed in Registry Editor in hexadecimal format.
REG_DWORD Data represented by a number that is 4 bytes long. Many parameters for device drivers and services are this type and are displayed in Registry Editor in binary, hexadecimal, or decimal format.
REG_EXPAND_SZ A variable-length data string. This data type includes variables that are resolved when a program or service uses the data.
REG_MULTI_SZ A multiple string. Values that contain lists or multiple values in a form that people can read are usually this type. Entries are separated by spaces, commas, or other marks.
REG_SZ A fixed-length text string.
REG_FULL_RESOURCE_DESCRIPTOR A series of nested arrays designed to store a resource list for a hardware component or driver.

Add a key


  • Incorrectly editing the registry may severely damage your system. Before making changes to the registry, you should back up any valued data on your computer.
  • You must back up your registry before tweaking into it or it may lead you to reinstall your operating system.
  • You can search for lot of registry backup tool an use any one of them, like ERUNT or click here for alternate methods of backing up registry.



Blog Stats

  • 55,255 hits