<jupyter_start><jupyter_text>** Dolby.io Developer Days Media APIs 101 - Getting Started ** ** Notebook 1: Getting Started**  Starting with a Raw Audio FileWe can run code blocks like this in Binder by pressing "Control+Enter". Try it now after clicking the below code block!<jupyter_code>import IPython # Helper library to play audio files in Python natively.

# Set this link to any publically accessible media file you would like!
original_audio_file = "https://dolbyio.s3-us-west-1.amazonaws.com/public/shelby/airplane.original.mp4"

IPython.display.Audio(original_audio_file) # Display the audio embedded within python<jupyter_output><empty_output><jupyter_text>This installed IPython to our workspace, to let us play media files natively within Python, and set a variable to this public media file we will use for the rest of this notebook.  **Step 1:** Gathering Credentials- Go to http://dashboard.dolby.io/signup/ to sign up for a Dolby.io account.- At the bottom of the "Applications" widget on the dashboard, click "_my first app_"- Scroll down to the box labeled **'Media APIs'**.- Copy the key text under "API Key:" and replace the string below, then run the cell.- Also enter in your name to customize the output URL later.- _Press Control+Enter to run the cell._  ![applications](./images/applications.png)<jupyter_code># Enter your Dolby.io Media API Key here.
api_key = "<YOUR_API_KEY_HERE>"
# Enter your name here to customize the output URL later.
name = "<YOUR_NAME_HERE>"

print("API Key and Name set!")<jupyter_output><empty_output><jupyter_text>Now we have two key variables set:1. The link to the original media file we want to process.2. Our API key so we can properly call the REST API endpoints.As well as your name, just so we can differentiate output later on.  **Step 2:** Calling the Enhance Job> Note: all of the following code is adapted from the Enhance quickstart found here: https://docs.dolby.io/media-apis/docs/quick-start-to-enhancing-media- Run the cell below to start the enhance job, this should output a JSON response with only a `job_id` in the body if no errors occur.<jupyter_code>import requests # Python library to make HTTP requests

output_url = f"dlb://out/workshop-{name}.mp4" # Setting the output URL to have a different location based on your name!

# Building the body of the request
body = {
  "input" : original_audio_file,
  "output" : output_url,
}

# Building the headers and url of the request
url = "https://api.dolby.com/media/enhance"
headers = {
  "x-api-key": api_key,
  "Content-Type": "application/json",
  "Accept": "application/json"
}

# Call the API request!
response = requests.post(url, json=body, headers=headers)
response.raise_for_status()
print(response.json()) # Prints out the output of the request<jupyter_output><empty_output><jupyter_text>**Step 3:** Checking Job Status- Now that we have created a job, we should check its status.- Run the cell below to check the status, this file is small so it should take only a couple of seconds.<jupyter_code>url = "https://api.dolby.com/media/enhance"
headers = {
  "x-api-key": api_key,
  "Content-Type": "application/json",
  "Accept": "application/json"
}

params = {
  "job_id": response.json()["job_id"]
}

response = requests.get(url, params=params, headers=headers)
response.raise_for_status()
print(response.json())<jupyter_output><empty_output><jupyter_text>This should look like the following when done:```json{'path': '/media/enhance', 'status': 'Success', 'progress': 100, 'api_version': 'v1.1.2', 'result': {}}```  **Step 4:** Download the Processed File- Now we want to download the file!- We can do this with another request.<jupyter_code>import shutil

# The name of the file that will be downloaded locally!
output_path = f"workshop-{name}.mp4"

url = "https://api.dolby.com/media/output"
headers = {
    "x-api-key": api_key,
    "Content-Type": "application/json",
    "Accept": "application/json",
}

args = {
    "url": output_url
}

# Take the response and download it locally
with requests.get(url, params=args, headers=headers, stream=True) as response:
    response.raise_for_status()
    response.raw.decode_content = True
    print("Downloading from {0} into {1}".format(response.url, output_path))
    with open(output_path, "wb") as output_file:
        shutil.copyfileobj(response.raw, output_file)<jupyter_output><empty_output><jupyter_text>When it is done downloading, you'll see it pop up on the left side bar.Now that the file is downloaded lets give it a listen. Does it sound better?<jupyter_code>IPython.display.Audio(output_path)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.10755247781865397, 'fraction_numerical': 0.00497727764553127, 'mean_word_length': 4.910485933503836, 'pattern_counts': {'":': 11, '<': 27, '<?xml version=': 0, '>': 28, 'https://': 5, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '3668', 'license': 'CC0-1.0', 'n_tokens_mistral': 1439, 'n_tokens_neox': 1400, 'n_words': 525, 'path': 'Workshop_Part_1.ipynb', 'repo_name': 'dolbyio-samples/Workshop-Media-APIs-Getting-Started', 'size': '4621'}