Introducing The New Bing Developer Center and Services

Today at Build 2013 we announced a new set of developer services and the new Bing Developer Center.  This effort is part of our larger goal of empowering developers to take advantage of the enormous investments that we’ve made in search technologies.  Together, these comprise an ‘Intelligent Fabric’ that we use across Microsoft products to help people interact with the world’s knowledge and their surroundings in a more human way.  Starting today, you too can harness many of those same technologies to build more compelling and human experiences than ever before.
The new services will focus on three broad categories of capabilities your applications can take advantage: services to bring entities and the world’s knowledge to your applications, services to enable your applications to deliver more natural and intuitive user experiences, and services which bring an awareness of the physical world into your applications.  Our new streamlined Bing Developer Center puts all the content you need in one single location, with links to documentation, downloads, sample code, how-to’s, as well as links to partner blogs where you can find even more technical content.  Here’s an overview of all our new services, as well as the services we previewed for release later this year.
Bringing World’s Knowledge to Your Apps: Understanding the World
We think knowledge is more than just a collection of blue links pointing at pages around the web.  Knowledge requires combining the web’s deep sets of information with insights derived from understanding the relationships between the people, places, things, and actions in the real world. The Bing Entity API previewed at Build 2013 allows developers to create applications that are aware of the things that surround us every day and build scenarios that augment users’ abilities to discover and interact with their world faster and more easily than they can do today. The Bing Entity API will be offered to developers in coming months.
Natural and Intuitive User Experiences
Give Your Machine the Gift of Sight.
Adding the power of sight to your Windows Store app opens a host of new scenarios for developers, like enabling text pattern recognition.  For example, if you identified e-mails addresses and URLs, you could link to common actions such as sending an e-mail or visiting a web site. Similarly, if your user took a picture of a coupon, your app could extract the phone number, email, or website. That is just one example of many new scenarios you could integrate into your app.
To add the capability to capture characters you can adopt Microsoft’s robust cloud-based optical character recognition into your Windows 8 and 8.1 Store XAML C# apps with the Bing Optical Character Recognition (OCR) Control now in customer technical preview. The control is easy to use and straightforward: once embedded, it will handle all camera interactions, and even provide basic UX for the user to preview the camera, switch cameras, and 'take a picture'. After your user snaps a shot, the control sends it right to Bing for analysis, and returns the extracted text and its corresponding position on the image.  
Getting started is simple.  Download the OCR control in the new Bing Developer center, subscribe to it through the Windows Azure Marketplace and access up to 5,000 free transactions per month.  You can check out our documentation and samples to learn more.
Write Once, Read Anywhere
The world is shrinking and information is increasingly global.  The Bing Translator Control for Windows 8 and 8.1, now in customer technical preview, lets you detect text and delivers automatic machine translation into a specified language so people can stay informed wherever they are. With the Bing Translator control you get easy access to robust, cloud-based, automatic translation for more than 40 languages. Powered by the flexible Microsoft Translator API and based on a decade of natural language research from Microsoft Research, the Translator control puts the power of a world class machine translation system in your hands.  Designed to enable a variety of scenarios, it is available in a number of developer friendly protocols.
First, download and go through one-time authentication, then place the control in your app, feed it a string to translate, and receive the translation.  The Bing Translator control takes the text you pass in to the Bing Translator web service for translation, and then passes the translation of the input back to you. Your application will receive the text to translate by any method, and render it by any means you choose - using the Translator Control in the middle, in order to translate the input text to the target language.
To get started, download the control, subscribe in the Windows Azure Marketplace, and read our samples and documentation.
The Power of Voice
Being able to naturally converse with a device has long been a science fiction dream.  The Bing Speech Control for Windows 8.1 previewed today showcases how users can interact with apps using their voice.  While that control will be available in a few months, Bing’s Text-to-Speech (TTS) APIfor Windows 8.1 is available today.
The API gives devices and applications a voice by allowing them to speak out loud to make user interactions more natural and intuitive. This opens up a range scenarios, including:
  • Listening to content while not having to look at the device, for your busy end-user
  • Hearing words, sentences, or definitions, for educational apps for kids
  • Speaking out to your users, for apps that may have a ‘personality’
  • Offering auditory reinforcement of native-like pronunciation, for language learning scenarios
You can leverage TTS into your C++, C#, and HTML-based JavaScript Store apps using WinRT APIs with these core concepts:
  • The SpeechSynthesizer has a core functionality which is to take text input and output a stream. Synthesis is always local to the device and does not require a network connection.
  • You can handle the output stream just like you would for any audio or music stream, leveraging the transport control for longer readouts, or simply playing the readout directly off of the MediaElement object.
  • Windows 8.1 supports TTS for 16 languages; each language will have either a male voice, a female voice, or both voices, depending on the language. The voices that are available to the app are those that come with the users system language AND any voices the user has installed via a Language Pack.
To get started implementing TTS, you need to:
  1. Declare and initialize a SpeechSynthesizer object and a MediaElement object
  2. Optionally change the voice on the synthesizer
  3. Pass text into the Synthesizer object to be synthesized and obtain a resulting stream
  4. Set the stream onto the MediaElement object and play it
Here are some TTS tips that you should know about the underlying technology which might be helpful before you begin coding:
  • The voices that are available to the application are only the Microsoft voices that come with the specific OS language AND those voices that the end-user has chosen to install on her machine. So, if your app must rely on a voice language (e.g., Italian) that your users are not likely to have installed (e.g., an app targeted at English speakers learning Italian), then you will need to educate your users to install the appropriate language pack in order for your app to get to those voices.
  • Windows 8.1 supports 16 languages. So, if your TTS feature spans multiple markets, be aware that TTS may not be available for the content outside of those languages. Below are the locales and gender of voices that are supported in Windows 8.1, available for download via Language settings in control panel.
    • English US, Female
    • English US, Male
    • English GB, Female
    • English IN, Female
    • French Fr, Female
    • German DE, Female
    • Spanish ES, Female
    • Spanish MX, Female
    • Chinese PRC, Female
    • Chinese TW, Female
    • Chinese HK, Female
    • Japanese JP, Female
    • Korean KR, Female
    • Italian IT, Female
    • Russian RU, Female
    • Polish PL, Female
    • Portuguese BR, Female
  •  All synthesis happens on device; so there’s no network connection required to leverage the functionality.
  • Keep in mind that many of the non-English voices can read English phrases at an intelligible quality. Do some experimentation, but you might find it more fun or interesting to read out content in one language using a voice from another (e.g., try having the French voice readout English content).
  • If you anticipate reading out longer pieces of content, make sure to understand and implement proper event handling for when the user leaves your app and returns. Fortunately, handling TTS readout in the background is the same as you would implement for handling audio or music playback with the transport controls and related events – since the output from the Synthesizer is a stream.
 Ready to get started? Try this sample:
 “Hello World” via TTS
Part 1: A button that speaks
Let’s start off by creating a simple app using XAML and C#.
From an end-user perspective, the app will have a single button on a page. When tapped, the user will hear “Hello World” emitted through the device’s default speakers.  From a code perspective, the XAML page will have a single button control specifying a tapped event handler. The code behind will leverage two objects in order to take text and produce speech: the SpeechSynthesizer object which will synthesize the text into a stream and then a MediaElement object which will play out the stream.
And now for the code:
1. Create a new sample Store app by going into Visual Studio, selecting File > New > Project. And then from the left-side navigation pane, choose Visual C# > Windows Store.
2. From the toolbox, drag a button onto the MainPage.xaml. Add a tapped event handler onto the button and add basic styling, allowing the button to show in the middle of the user’s screen. The resulting XAML might look as follows, with the button being placed inside the page’s grid element.
<Button Content="This is my Hello World button" HorizontalAlignment="Center" Margin="0,0,0,0"VerticalAlignment="Center" Height="200" Width="600" FontSize="36" Tapped="MyButton_Tapped"/>
Here’s what the screen will look like (screen shot captured from the Simulator):
 The remaining steps are focused on the code behind.
3.   On the MainPage.xaml.CS, add thenamespace as well as thenamespace. In this way we can declare theobject (required for synthesizing text to a stream) and theobject (required for playing the stream).
using Windows.Media.SpeechSynthesis;
using Windows.Media;
Then declare two objects inside the MainPage class.
    publicsealedpartialclassMainPage : Page
        MediaElement media;
        SpeechSynthesizer synth;
  1. Let’s create a new method called InitializeTextToSpeech. Here’s where we can initialize both objects:
        privatevoid InitializeTextToSpeech()
   = newMediaElement();
            this.synth = newSpeechSynthesizer();
Also call the above function for initialization
        public MainPage()
  1. Finally, let’s create the event handler for when the button is tapped.
        privateasyncvoid MyButton_Tapped(object sender, TappedRoutedEventArgs e)
             SpeechSynthesisStream stream = awaitthis.synth.SynthesizeTextToStreamAsync("Hello World");
  , stream.ContentType);
It’s in the button tapped event handler where the text to speech logic occurs (and you might imagine putting the logic in a range of places).
Simple! Now try running your basic TTS app.
Part 2: Selecting an installed TTS voice
What if you wanted to change the voice that will readout the text, or ensure that a particular language/voice is installed on the user’s system. How would you go about that?
Using the code from Part 1 above, we can modify the InitializeTextToSpeech method to enumerate the set of installed voices on the system, and/or select a particular voice.
        privatevoid InitializeTextToSpeech()
   = newMediaElement();
            this.synth = newSpeechSynthesizer(); 
            // From the set of installed voices, select the one that matches some
            // criteria; in this example, the criteria is to select the En-GB female             
            // voice. 
            // Secret tip! The female British voice is installed on En-US systems by default! 
            VoiceInformation uniqueVoice = SpeechSynthesizer.AllVoices.Where(v => v.Language == "en-GB" && v.Gender ==VoiceGender.Female).First();
             // Assign the voice being looked for if it’s installed 
            if (uniqueVoice != null)
                  this.synth.Voice = uniqueVoice;
            // Otherwise, use the default voice, or fallback to other criteria
As you can see from the sample above, you may be looking for certain criteria specific to language or gender. (Or you may want your user to be able to select/change the voice for the app as well)
Again, Windows 8.1 supports 16 language locales for speech synthesis. For some languages there are two voices; however, some languages only support one voice. En-US is an exception and comes with three voices (the extra voice is a British English voice).
An alternative approach to obtain the set of installed voices would be to use a LINQ query.  That code might look as follows:
            // Use LINQ to obtain the set of installed voices
            var voiceSet =
                from voice inSpeechSynthesizer.AllVoices
                where voice.Description.Contains("Hazel")
                select voice;
 In this way you could populate a list box or other data structure with only the set of installed/available languages.
Part 3: Fine tune the TTS readout using SSML
What if you want to customize the text that’s being read out? The Speech Synthesis Markup Language Specification is one of these standards and is designed to provide a rich, XML-based markup language for assisting the generation of synthetic speech in Web and other applications. The essential role of the markup language is to provide authors of synthesizable content a standard way to control aspects of speech such as pronunciation, volume, pitch, rate, etc. across different synthesis-capable platforms. Windows 8.1 WinRT TTS APIs support SSML.
There are a plethora of applications to using SSML a sample of which is shown in code below. Here’s how you can incorporate this into your app.
The code stays very similar to the “Hello World” Sample above with the following differences. Since SSML is mark-up added to text to be spoken it has to have the following structure
 <speak version="1.0"
    ... the body ...
Say for instance we wanted to say “Hello World” slower and at a higher pitch, the SSML will look like:
<speak version="1.0"
<prosody pitch ='x-high' rate ='slow'>Hello World</prosody>
Please refer the w3c documentation to learn more about SSML:
To incorporate this into your previous sample add the respective SSML mark up and call the corresponding SSML API.
string ssmlText = "<speak version='1.0' xmlns='' xml:lang='en-US'>"+
              "<prosody pitch ='x-high' rate ='slow'>Hello World</prosody> </speak>"
SpeechSynthesisStream stream = await 
Awareness of the Physical World
View from the Top
 So much of what we do depends on where we are and what is around us.  A new version of the Bing Maps SDK for Windows 8 and a beta-releaseof a functional equivalent for the Windows 8.1 Preview are available for download today.  These Bing Maps SDKs provide mapping, routing, and traffic capabilities for your Windows Store apps in both WinJS and WinRT controls.  The beta-release of the Bing Maps SDK for Windows Store apps for the Windows 8.1 Preview will support the upcoming version of Visual Studio.
You can get started now by trying out some of these samples:
For the WinRT Control
Both versions (Windows 8 and Windows 8.1) support 3 new classes. Where before you would call the Bing Maps REST Services to find an address, get driving directions or show traffic incidents and handle the responses by parsing JSON-objects or implementing data contracts as described here, we have now wrapped this in .NET classes .
Example 1Find a location using the Bing.Maps.Search Namespace
publicasyncvoid FindLocation()
  // Set the address string to geocode
  Bing.Maps.Search.GeocodeRequestOptions requestOptions = 
    new Bing.Maps.Search.GeocodeRequestOptions("Moscone Center");
  // Make the geocode request
  Bing.Maps.Search.SearchManager searchManager = myMap.SearchManager;
  Bing.Maps.Search.LocationDataResponse response = 
    await searchManager.GeocodeAsync(requestOptions);
  // Add a Pushpin
  Bing.Maps.Pushpin pushpin = new Bing.Maps.Pushpin();
  Bing.Maps.MapLayer.SetPosition(pushpin, response.LocationData[0].Location);
Example 2: Calculate and Display a Route using the Bing.Maps.Directions namespace
publicasyncvoid GetDirections()
  // Set the start and end waypoints
  Bing.Maps.Directions.Waypoint startWaypoint = 
    new Bing.Maps.Directions.Waypoint("SFO");
  Bing.Maps.Directions.Waypoint endWaypoint = 
    new Bing.Maps.Directions.Waypoint("Moscone Center");
  Bing.Maps.Directions.WaypointCollection waypoints = 
    new Bing.Maps.Directions.WaypointCollection();
  Bing.Maps.Directions.DirectionsManager directionsManager = 
  directionsManager.Waypoints = waypoints;
  // Calculate route directions
  Bing.Maps.Directions.RouteResponse response = 
    await directionsManager.CalculateDirectionsAsync();
  // Display the route on the map
Example 3: Display Traffic Incidents using the Bing.Maps.Traffic namespace
publicasyncvoid DisplayTraffic()
  // Set the map view, then get the current bounds
  myMap.Center = new Bing.Maps.Location(37.708431, -122.415459);
  myMap.ZoomLevel = 12;
  Bing.Maps.LocationRect currentMapView = myMap.Bounds;
  // Request traffic incidents for the current view
  Bing.Maps.Traffic.TrafficIncidentRequestOptions requestOptions = 
    new Bing.Maps.Traffic.TrafficIncidentRequestOptions(currentMapView);
  Bing.Maps.Traffic.TrafficManager trafficManager = myMap.TrafficManager;
  Bing.Maps.Traffic.TrafficIncidentResponse response = 
    await trafficManager.GetTrafficIncidentsAsync(requestOptions);
  // Display the traffic on the map
With the WinJS Control
In the WinJS control we have now enabled the map styles that our friends in the UK love so much. The London Street Map:

As well as the Ordnance Survey Maps:

Example 1: To use these map styles in your app you need to provide the culture-parameter “en-GB” when you load the map and then set the appropriate MapTypeID.
    function initialize() {
        Microsoft.Maps.loadModule('Microsoft.Maps.Map', { 
          callback: initMap, culture: 'en-GB', homeRegion: 'GB' });
     function initMap() {
        try {
            var mapOptions =
                  credentials: "Your Bing Maps Key",
                  mapTypeId: Microsoft.Maps.MapTypeId.collinsBart,
                  enableClickableLogo: false,
                  enableSearchLogo: false,
                  center: new Microsoft.Maps.Location(51.509383, -0.128372),
                  zoom: 16
            map = new Microsoft.Maps.Map(document.getElementById("divMap"), mapOptions);
        catch (e) {
            var md = new Windows.UI.Popups.MessageDialog(e.message);
Sometimes you need more than directions, though.  Coming soon, you will be able to integrate immersive geospatial experiences as shown by the 3D mapping capabilities previewed today at Build.  These capabilities will deliver photorealistic and smooth mapping experiences that let developers build apps that put the user in the center of the action.
We hope you will explore all of our new developer services in the new Bing Developer Center and take advantage of the expansive ‘Intelligent Fabric’ built by our technology.  We look forward to see all of the innovative, powerful, and useful applications you develop! 
The Bing Developer Team