Click here to Skip to main content
13,255,340 members (48,191 online)
Click here to Skip to main content
Add your own
alternative version


22 bookmarked
Posted 5 Feb 2007

What's That Tune? - Mashing up Three Web Services

, 12 Feb 2007
Rate this:
Please Sign up or sign in to vote.
What's That Tune? is a light-hearted mashup of three web services in C#. This proof-of-concept records audio from a microphone, saves it to Amazon S3, creates a task for workers to name the tune using Amazon Mechanical Turk, then polls Amazon ECS for related albums.

[See the notes in the "Running the Sample" section at the bottom of the article before trying out the sample application.]

This article provides some general information on how the What's That Tune? application works.

About the Sample

Imagine a time when you had a song stuck in your head, but couldn't quite figure out the name of the song. Perhaps you could only hum the tune, or maybe you weren't sure what the real lyrics were (the "singing in the shower" phenomenon), so searching for the song lyrics on the web didn't return any relevant results. This sample application shows a way to solve this problem using Amazon Web Services and Windows Forms with C#.

The sample uses three web services from Amazon Web Services:

  • Amazon Simple Storage Service (Amazon S3)
  • Amazon Mechanical Turk web service
  • Amazon E-Commerce Service (Amazon ECS)

Amazon S3

Amazon S3 provides a simple web-services interface that can be used to store and retrieve any amount of data, at any time, from anywhere on the web. It gives any developer access to the same highly scalable, reliable, fast, and inexpensive data storage infrastructure that Amazon uses to run its own global network of web sites.

Amazon Mechanical Turk Web Service

Amazon Mechanical Turk provides a web services API for computers to integrate human intelligence directly into their processing by making requests of humans. Developers use the Amazon Mechanical Turk web service to submit tasks to the Amazon Mechanical Turk web site, approve completed tasks, and incorporate the answers into their software applications. To the application, the transaction looks very much like any remote procedure call - the application sends the request, and the service returns the results. In reality, a network of humans fuels this Artificial Artificial Intelligence by coming to the web site, searching for and completing tasks, and receiving payment for their work.

Amazon ECS

Amazon E-Commerce Service (ECS) exposes Amazon's product data and e-commerce functionality. This allows developers, web site owners, and merchants to leverage the data and functionality that Amazon uses to power its own e-commerce business.

Application Lifecyle

Here's a diagram that shows the basic application lifecycle:

Let's go over each step in more detail.

1Record audio The sample records audio using the default audio input device (usually a microphone). To limit the complexity of the sample, the sound recorder implements the mciSendString interface into the operating system. This rudimentary approach to sound recording, although universal, limits the options for quality, size, and format. Other approaches for recording audio include Windows Media Encoder and the DirectSound portion of DirectX.
2Create task to name that tune

To create the task to "name that tune", the sample first uploads the audio file to Amazon S3. Next, it creates a Human Intelligence Task (HIT) using Amazon Mechanical Turk, which defines the work we want completed. In this case, we ask for three pieces of information:

  1. Artist
  2. Song title
  3. Additional notes

The sample does not employ any techniques for ensuring the quality of work performed by Amazon Mechanical Turk workers. Additional techniques to help ensure the quality of work include using multiple assignments for the same work, and using a second HIT to verify the first HIT results.

3Workers complete task on

Virtually anyone can complete tasks on the Amazon Mechanical Turk web site. The only requirements are having a computer connected to the Internet and being at least 18 years old.

Earning money through the Amazon Mechanical Turk web site is as easy as searching for HITs on the site, reserving those HITs, completing them, and collecting payment once the HIT is approved by the Requester.

Some of the tasks currently in the marketplace benefit Amazon's search subsidiary Amazon Mechanical Turk is being used to increase the quality of A9's BlockView pictures that show users street-level pictures of businesses. These HITs ask people to select from several photographs the one that best presents the front of a business.

4Collect results from Amazon Mechanical Turk The sample uses a timer that allows the application to poll the Amazon Mechanical Turk web service until the work is complete. The length of time it takes to complete the work varies, so an optional check box allows you also manually poll for the results.
5Look up album(s) using Amazon ECS Amazon ECS does not currently allow direct searches for song titles, so the sample uses Amazon ECS to search for albums related to the artist, then uses the results returned by the Tracks response group to search the results for the song title.
6Display the results Finally, display the results from both Amazon Mechanical Turk and Amazon ECS in the application.

Some of the application lifecycle steps are best processed in the background, so the user only goes through three distilled steps:

  1. Sing the tune
  2. Review and upload
  3. Song results

Running the Sample

The sample uses the following SOAP API versions for each web service:

  • 2006-06-20 for the Amazon Mechanical Turk web service
  • 2006-03-01 for Amazon S3
  • 2006-10-31 for Amazon ECS

Before you can run the sample, make sure you have these prerequisites fulfilled:

Now here are the steps for running the application:
  1. Download and extract the .zip file contents.
  2. Open WhatsThatTune.sln in Visual Studio.
  3. Update the code to use your access identifiers:
    1. Open Settings.settings.
    2. Update the m_awsAccessKeyId and m_awsSecretAccessKey properties.
  4. Compile and run the sample using Visual Studio.
  5. Use the sample application to record audio, create the task, and return the song results.

Finally, the results you get back should look similar to this example we ran by singing Weezer's Beverly Hills.

Additional Resources

Here are some general links you can use to learn more about the technologies in this article:


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Web Developer
United States United States
No Biography provided

You may also be interested in...

Comments and Discussions

GeneralMy vote of 5 Pin
Kanasz Robert27-Sep-12 9:31
mvpKanasz Robert27-Sep-12 9:31 
GeneralLyrics Pin
jsanjosem27-Nov-07 2:08
memberjsanjosem27-Nov-07 2:08 
Generalcompliments Pin
stefano piuri16-Feb-07 4:04
memberstefano piuri16-Feb-07 4:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.171114.1 | Last Updated 12 Feb 2007
Article Copyright 2007 by awseditor
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid