Tone Analysis

Understanding the emotion of the speaker by the tone of their voice

Overview

Tone Analysis suggests speaker emotion using only audio clues. Sometimes the speaker may show emotions in the tone of the response and this is important to capture to get the overall sentiment/mood of the conversation which cannot be extracted from conventional Lexical Emotion analysis.

Types of Tone

Marsview is capable of detecting the following tones in an audio file:

  • Calm

  • Happy

  • Sad

  • Angry

  • Fearful

  • Disgust

  • Surprised

Input Type Supported: Audio, Video

post
Compute Metadata

https://api.marsview.ai/v1/conversation/compute
This method is used to upload an audio or video file on which metadata has to be computed. Settings object can be used to enable/disable metadata from different models. Check the overview section for getting a list of models that are available
Request
Response
Request
Headers
appSecret
required
string
<sample-app-secret>
appId
required
string
<sample-app-Id>
Content-Type
optional
string
application/json
Body Parameters
sync_with_stt
optional
boolean
Tone analysis will be performed on the exact same chunks STT has created.
tone_analysis.enable
required
boolean
Audio based Tones will be computed when tone_analysis.enable key is set to true under the settings object
Response
200: OK
A Transaction ID is returned in the JSON body once the processing job is launched successfully. This Transaction ID can be used to check the status of the job or fetch the results of the job once the metadata is computed
{
"status":true,
"transaction_id":32dcef1a-5724-4df8-a4a5-fb43c047716b,
"message": " Compute job for file-id: 32dcef1a-5724-4df8-a4a5-fb43c047716b launched successfully"
}
400: Bad Request
This usually happens when the settings for computing the metadata are not configured correctly. Check the request object and also the dependencies required to compute certain metadata objects. ( For Example: Speech to Text has to be enabled for Action Items to be enabled)
{
"status":false,
"error":{
"code":"MCST07",
"message":"DependencyError: emotion_analysis depends on speech_to_text"
}
}

Example API Call

Request

CURL
CURL
curl --request POST 'https://api.marsview.ai/v1/conversation/compute' \
--header 'appSecret: 32dcef1a-5724-4df8-a4a5-fb43c047716b' \
--header 'appId: 1ZrKT0tTv7rVWX-qNAKLc' \
--header 'Content-Type: application/json' \
--data-raw '{
"settings":{
"speech_to_text":{
"enable":true,
"pii_detection":false,
"custom_vocabulary":["Marsview" , "Pikachu"]
},
"speaker_separation":{
"enable":true,
"num_speakers":4
},
"tone_analysis":{
"enable":true,
"sync_with_stt":true
}
}
}'

Response

Given below is a sample response JSON when the Status code is 200.

{
"status":true,
"transaction_id":32dcef1a-5724-4df8-a4a5-fb43c047716b,
"message": " Compute job for file-id: 32dcef1a-5724-4df8-a4a5-fb43c047716b launched successfully"
}

post
Request Metadata

https://api.marsview.ai/v1/conversation/fetch
This method is used to fetch specific Metadata for a particular file_id. It can also be used for long polling to track the progress of compute under the status object.
Request
Response
Request
Headers
Content-Type
optional
string
application/json
appId
optional
string
<sample-app-id>
appSecret
optional
string
<sample-app-secret>
Body Parameters
fileID
optional
string
fileId of the audio/video file
data.tone_analysis
optional
boolean
Returns tone data for file_id once computed
Response
200: OK
The output consists of two objects. The data object returns the requested metadata if it is computed. The status object shows the current state of the requested metadata. Status for each metadata field can take values "Queued"/"Processing"/"Completed". Shown below is a case where "sentiment analysis" Job is in "Queued" state and "Completed" state.
QUEUED STATE
COMPLETED STATE
QUEUED STATE
{
"status":{
"tone_analysis":"Queued",
}
"data":{
"tone_analysis":{}
}
}
COMPLETED STATE
{
"status":{
"tone_analysis":"Completed"
}
"data":{
"tone_analysis":{
"chunks":[
...
{
"start_time" : "174100.0"
"end_time" : "175100.0",
"sentiments" : [
{
"sentiment":"Calm",
"confidence":0.81
},
{
"sentiment":"Happy",
"confidence":0.17
},
]
},
{
"start_time" : "174100.0"
"end_time" : "175100.0",
"sentiments" : [
{
"sentiment":"Surprised",
"confidence":0.97
}
]
},
...
]
}
}
}

Response Object Fields

Fields

Description

start_time

Starting time of the chunk in millseconds

end_time

Ending time of the chunk in milliseconds

tones

List of tone objects for that particular chunk

tones.sentiment

Name Tag for the Type of tones detected.

tones.confidence

Confidence of the tones (ranges from 0 to 1). Higher the better

​