// Blog

Python: Hello World

Originally published on the Clarify.io blog. View archived copy.

This quickstart demonstrates a simple way to get started using the Clarify API. Following these steps, it should take you no more than 5-10 minutes to have a fully functional search for your audio.

Configuring Your Environment

While you can use any programming language you choose, we provide helping libraries in a few to get you started. In Python, you simply include the Clarify file from the python_2 module, and initialize the environment with your API key:

Loading Audio

Once you’ve initialized the environment with your API key, you load a file like this:

Naming the bundle is optional.

Here are some audio files you can use for testing:

  • http://media.clarify.io/audio/samples/harvard-sentences-1.wav
  • http://media.clarify.io/audio/samples/harvard-sentences-2.wav
  • http://media.clarify.io/audio/books/dorothyandthewizardinoz_01_baum_64kb.mp3

Hint: You don’t have to download these files. Instead you can pass us these urls via the create_bundle() method shown above.

Searching Audio

To search, we’ll use the search() function. If you uploaded the “Wizard of Oz” audio clip, you can search for “dorothy”:

Then you can process and interact the results however you wish. The code below simply shows the resulting bundle id, bundle name, and the start/end offsets for each occurrence of the search terms. This assumes that the audio clip has been indexed by the time you search. If it hasn’t, wait and try again in a few minutes.

And here are the results using the *Wizard of Oz* clip we loaded.

	<div id="crayon-57fb40317603b820299523" class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouseover" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
	
		<div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;"><span class="crayon-title"></span>
		<div class="crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;"><div class="crayon-button crayon-nums-button" title="Toggle Line Numbers"><div class="crayon-button-icon"></div></div><div class="crayon-button crayon-plain-button" title="Toggle Plain Code"><div class="crayon-button-icon"></div></div><div class="crayon-button crayon-wrap-button" title="Toggle Line Wrap"><div class="crayon-button-icon"></div></div><div class="crayon-button crayon-expand-button" title="Expand Code"><div class="crayon-button-icon"></div></div><div class="crayon-button crayon-copy-button" title="Copy"><div class="crayon-button-icon"></div></div><div class="crayon-button crayon-popup-button" title="Open Code In New Window"><div class="crayon-button-icon"></div></div><span class="crayon-language">PHP</span></div></div>
		<div class="crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;"></div>
		<div class="crayon-plain-wrap"><textarea wrap="soft" class="crayon-plain print-no" data-settings="dblclick" readonly style="-moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4; font-size: 12px !important; line-height: 15px !important;">

dorothy and her friends 2.35 — 2.59 172.49 — 172.83 224.82 — 225.08 271.49 — 271.8 329.1 — 329.31 480.45 — 480.92

1
2
3
4
5
6
7
dorothy and her friends
2.35 2.59
172.49 172.83
224.82 225.08
271.49 271.8
329.1 329.31
480.45 480.92

Putting it all Together

From here, we can visualize our search results with the included audio player. The player should work with no additional configuration, but the bulk of the logic is here: