Getting Automatic Transcriptions


By Invite Only: This is not available by default. Please contact Support to enable it.
This quickstart demonstrates how to load an audio file and request a transcript in just a matter of minutes.

Configuring Your Environment

While you can use any programming language you choose, we provide a few helper libraries to get you started. In most cases, you can use your favorite package manager:

  • curl
Although we don't have a curl library, the command-line JSON parser 'jq' is super helpful. Download and install it to get started: http://stedolan.github.io/jq/

Loading Audio

First include the SDK and create your object using your API Key. Once you’ve created the object, you can use the object to load each of your audio files as shown:

  • curl
curl --data "media_url=http://media.clarify.io/audio/books/dorothyandthewizardinoz_01_baum_64kb.mp3" \
     --data "notify_url=http://example.org/sample-receiver" \
     --data "name=Dorothy and the Wizard of Oz" https://api.clarify.io/v1/bundles \
     --X POST --header "Authorization: Bearer myapikey" | jq '.'
# The jq portion is optional and just used to pretty print the resulting json

Naming the bundle and providing a notify_url are both optional. We have a number of audio and video files available for processing on our Media Page.

Note: You don't have to download these files. Instead you can pass the urls via the create/POST method shown above.
After creating a bundle, you'll receive a response which looks something like this:
{
    "id":"abcde12345",
    "_class":"Ref",
    "_links":{
        "self":{
            "href":"/v1/bundles/abcde12345"
        },
        "curies":[
            {
                "href":"/docs/rels/{rel}",
                "name":"clarify",
                "templated":true
            }
        ],
        "clarify:metadata":{
            "href":"/v1/bundles/abcde12345/metadata"
        },
        "clarify:tracks":{
            "href":"/v1/bundles/abcde12345/tracks"
        },
        "clarify:insights":{
            "href":"/v1/bundles/abcde12345/insights"
        }
    }
}

Getting your Transcript

The most important part of the bundle notification is the href of the clarify:insights key. By retrieving the contents of that URI, Clarify will give you a list of the Insights available.
  • curl
curl https://api.clarify.io/v1/bundles/abcde12345/insights \
     --header "Authorization: Bearer myapikey"  | jq '.'
# The jq portion is optional and just used to pretty print the resulting json
This will return with the list of available insights:
{
    "bundle_id": "abcde12345",
    "created": "2015-03-04T05:03:04.292Z",
    "updated": "2015-05-16T20:39:37.508Z",
    "_class": "Insights",
    "_links": {
        "curies": [
            {
                "href": "/docs/insights/{rel}",
                "name": "insight",
                "templated": true
            }
        ],
        "insight:spoken_keywords": {
            "href": "/v1/bundles/abcde12345/insights/54321edcba"
        },
        "insight:classification": {
            "href": "/v1/bundles/abcde12345/insights/edcba56789"
        },
        "insight:spoken_words": {
            "href": "/v1/bundles/abcde12345/insights/12345abcde"
        },
        "insight:spoken_topics": {
            "href": "/v1/bundles/abcde12345/insights/34567abcde"
        },
        "insight:transcript_r4": {
            "href": "/v1/bundles/abcde12345/insights/98765abcde"
        },
        "parent": {
            "href": "/v1/bundles/abcde12345"
        },
        "self": {
            "href": "/v1/bundles/abcde12345/insights"
        }
    }
}
The most important part of this payload is the href of the insight:transcript_r4 key. By retrieving the contents of that URI, Clarify will give you a complete list of the words recognized from the audio.
  • curl
curl https://api.clarify.io/v1/bundles/abcde12345/insights/98765abcde \
     --header "Authorization: Bearer myapikey"  | jq '.'
# The jq portion is optional and just used to pretty print the resulting json
The result of which will be a JSON representation of the transcript as shown below. Based on the number and duration of the audio, there will be anywhere from zero to many segments, each describing one portion of the dialog.
{
    "id": "98765abcde",
    "bundle_id": "abcde12345",
    "name": "transcript_r4",
    "status": "ready",
    "created": "2015-06-27T16:18:05.573Z",
    "updated": "2015-06-27T16:21:08.917Z",
    "track_data": [
    {
        "transcript":
        {
            "meta": {
                "format": "clarify_transcript",
                "version": 1.0
            },
            "segments": [
                {
                    "language": "en-US",
                    "start": 0.94,
                    "dur": 3.45,
                    "terms": [
                        {
                            "dur": 0.28,
                            "term": "Thanks",
                            "start": 0.94
                        }, {
                            "dur": 0.12,
                            "term": "for",
                            "start": 1.22
                        }, {
                            "dur": 0.32,
                            "term": "calling",
                            "start": 1.37
                        }, {
                            "dur": 0.14,
                            "term": "the",
                            "start": 1.77
                        }, {
                            "dur": 0.45,
                            "term": "clarify",
                            "start": 1.91
                        }, {
                            "dur": 0.95,
                            "term": "API",
                            "start": 2.36
                        }, {
                            "dur": 0.32,
                            "term": "example",
                            "start": 3.53
                        }, {
                            "dur": 0.36,
                            "term": "desk",
                            "start": 4.03
                        }, {
                            "start": 4.39,
                            "term": ".",
                            "dur": 0,
                            "type": "mark"
                        }
                    ]
                }, {
                    "language": "en-US",
                    "start": 6.31,
                    "dur": 2.42,
                    "terms": [
                        {
                            "dur": 0.22,
                            "term": "We",
                            "start": 6.31
                        }, {
                            "dur": 0.11,
                            "term": "are",
                            "start": 7.13
                        }, {
                            "dur": 0.19,
                            "term": "here",
                            "start": 7.52
                        }, {
                            "dur": 0.15,
                            "term": "to",
                            "start": 8.26
                        }, {
                            "dur": 0.09,
                            "term": "help",
                            "start": 8.41
                        }, {
                            "dur": 0.18,
                            "term": "you",
                            "start": 8.55
                        }, {
                            "start": 8.73,
                            "term": ".",
                            "dur": 0,
                            "type": "mark"
                        }
                    ]
                }
            ]
        }
    }
    "_class": "TranscriptR4Insight",
    "_links": {
        "self": {
            "href": "/v1/bundles/abcde12345/insights/98765abcde"
        },
        "curies": [
            {
                "href": "/docs/rels/{rel}",
                "name": "clarify",
                "templated": true
            }
        ],
        "parent": {
            "href": "/v1/bundles/abcde12345/insights"
        },
        "clarify:bundle": {
            "href": "/v1/bundles/abcde12345"
        }
    }
}
By Invite Only: This is not available by default. Please contact Support to enable it.
Fork me on GitHub