[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 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 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.
Here's a diagram that shows the basic application lifecycle:
Let's go over each step in more detail.
||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.
||Create 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:
- Song title
- 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.
||Workers complete task on mturk.com
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 A9.com. 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.
||Collect 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.
||Look 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.
||Display 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:
- Sing the tune
- Review and upload
- 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:
- Download and extract the .zip file contents.
- Open WhatsThatTune.sln in Visual Studio.
- Update the code to use your access identifiers:
- Open Settings.settings.
- Update the m_awsAccessKeyId and m_awsSecretAccessKey properties.
- Compile and run the sample using Visual Studio.
- 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.
Here are some general links you can use to learn more about the technologies in this article: