The KeenASR SDK produces two types of recognition output:
- Partial Result – a lightweight, streaming hypothesis while audio is still arriving
- Final Response – a completed recognition result plus rich metadata and associated artifacts
A partial result is intended for real-time UI updates and incremental feedback, while a final response provides detailed timing, phoneme information, diagnostics, additional metadata, and associated artifacts.
Partial Result
Partial result is provided via partialResult callback, which is invoked in real time as audio is processed.
Each callback delivers:
- A
Resultobject - The
Recognizerinstance that produced it
Partial result contains a lightweight snapshot of the most likely recognized text so far.
Characteristics:
- Text only (no word-level or phoneme-level timings)
- Designed for low-latency updates
- Hypothesis may change as additional audio arrives
Common uses:
- Showing interim result and/or performing app action based on it (e.g. highlighting text as a child reads it)
- Dynamically adjusting recognizer parameters (e.g., endpointing / VAD) based on partial result
Example:
onPartialResult(result, recognizer):
resultLabel.text = result.text
Final Response
When the recognizer stops listening (typically triggered by VAD thresholds), the SDK invokes a finalResponse callback with a Response object.
A Response contains:
- Response and configuration metadata
- A fully populated
Resultobject AudioQualityResultobject- Response artifacts (audio, JSON)
Response Metadata
Examples of metadata fields included in a response:
| Field | Description |
|---|---|
id |
Unique identifier of the response |
jsonVersion |
JSON version |
sdkVersion |
Version of KeenASR SDK used to produce this response |
appBundleId |
bundleName/packageId of the app using the SDK |
asrBundle |
ASR Bundle used to initialize the recognizer |
decodingGraph |
Name of the decoding graph used to create this response |
startTime |
Date/time (in GMT) when this response started |
duration |
Response duration (in seconds) |
echoCancellation |
True if echo cancellation was used, false otherwise |
audioFilename |
Name of the audio file ($id.wav); relevant when saving audio in the filesystem |
Result Object
The Result object represents the recognition output.
It includes:
- Utterance-level text and confidence
- An array of Word objects
- For each word, an array of Phone objects (with relevant Phone-level segmentation)
All timing values (startTime, duration) are expressed in seconds relative to the start of the utterance.
See Result JSON example
{
"text": "ONE PIG HOUSE WITH STICKS",
"cleanText": "ONE PIG HOUSE WITH STICKS",
"confidence": 1.0,
"words": [
{
"text": "ONE",
"startTime": 1.11,
"duration": 0.33,
"confidence": 1.0,
"phones": [
{"text": "W_B", "startTime": 1.11, "duration": 0.12, "pronunciationScore": 0.98},
{"text": "AH1_I", "startTime": 1.23, "duration": 0.06, "pronunciationScore": 0.98},
{"text": "N_E", "startTime": 1.29, "duration": 0.15, "pronunciationScore": 0.97}
]
},
{
"text": "PIG",
"startTime": 1.44,
"duration": 0.45,
"confidence": 1.0,
"phones": [
{"text": "P_B", "startTime": 1.44, "duration": 0.09, "pronunciationScore": 0.96},
{"text": "IH1_I", "startTime": 1.53, "duration": 0.18, "pronunciationScore": 0.91},
{"text": "G_E", "startTime": 1.71, "duration": 0.18, "pronunciationScore": 0.93}
]
},
{
"text": "HOUSE",
"startTime": 2.04,
"duration": 0.39,
"confidence": 1.0,
"phones": [
{"text": "HH_B", "startTime": 2.04, "duration": 0.09, "pronunciationScore": 1.0},
{"text": "AW1_I", "startTime": 2.13, "duration": 0.18, "pronunciationScore": 0.95},
{"text": "S_E", "startTime": 2.31, "duration": 0.12, "pronunciationScore": 0.96}
]
},
{
"text": "WITH",
"startTime": 2.46,
"duration": 0.21,
"confidence": 1.0,
"phones": [
{"text": "W_B", "startTime": 2.46, "duration": 0.09, "pronunciationScore": 1.0},
{"text": "IH0_I", "startTime": 2.55, "duration": 0.03, "pronunciationScore": 1.0},
{"text": "TH_E", "startTime": 2.58, "duration": 0.09, "pronunciationScore": 0.9}
]
},
{
"text": "STICKS",
"startTime": 2.67,
"duration": 0.63,
"confidence": 1.0,
"phones": [
{"text": "S_B", "startTime": 2.67, "duration": 0.12, "pronunciationScore": 1.0},
{"text": "T_I", "startTime": 2.79, "duration": 0.09, "pronunciationScore": 0.92},
{"text": "IH1_I", "startTime": 2.88, "duration": 0.12, "pronunciationScore": 0.95},
{"text": "K_I", "startTime": 3.0, "duration": 0.12, "pronunciationScore": 0.99},
{"text": "S_E", "startTime": 3.12, "duration": 0.18, "pronunciationScore": 0.98}
]
}
]
}
| Field | Description |
|---|---|
text |
Raw recognized text |
cleanText |
Text without special tokens (e.g. <SPOKEN_NOISE>) |
confidence |
Overall confidence (0–1) |
words[] |
Word-level segments |
words[].startTime |
Start time in seconds |
words[].duration |
Duration in seconds |
phones[] |
Phoneme-level segments |
phones[].pronunciationScore |
Goodness of Pronunciation (0–1) |
Phonemes are defined in the lang/phones.txt file in the ASR Bundle. For English, ARPAbet notation is used. The suffix (_B, _I, _E, _S) indicates word position (Begin, Inside, End, Singleton). See the Glossary for more terminology.
AudioQualityResult Object
AudioQualityResult contains objective metrics describing recording conditions.
Common uses:
- Detect low-volume or noisy recordings
- Identify clipping (typically due to microphone being too close to the mouth)
- Identify audio “leakage” from the speakers
- Provide user feedback on microphone placement
| Field | Description |
|---|---|
snrValue |
Estimated signal-to-noise ratio (dB) |
meanSpeechRmsValue |
Average speech energy (dB) |
peakSpeechRmsValue |
Peak speech energy (dB) |
meanNonSpeechRmsValue |
Average non-speech (noise) energy (dB) |
clippedSampleCount |
Number of clipped samples |
initialSegmentRmsWarning |
True if audio was detected at the very start of listening |
frameRmsValues |
Array of per-frame RMS energy values (dB); 25ms frames at 10ms frame-rate |
Example: Audio Quality Feedback
onFinalResponse(response):
aq = response.audioQualityResult
if aq.snrValue < 10:
showWarning("Noisy environment detected. Move to a quieter location.")
if aq.clippedSampleCount > 50:
showWarning("Audio clipping detected. Move microphone further away.")
if aq.peakSpeechRmsValue < -35:
showWarning("Low audio volume. Speak louder or move closer to microphone.")
if aq.initialSegment:
showDevWarning("Audio detected immediately after start listening. Either audio is playing from the speakers or startListening is called too late (UX issue).")
Response Artifacts
Each response includes:
- Processed audio segment (WAV)
- JSON representation of the response object
Artifacts can be saved in the local filesystem using Response methods.
response.saveAudioFile(dirname); // saves audio (as wav file) in the provided directory
response.saveJsonFile(dirname); // saves json in the provided directory
If Dashboard is configured and the app is setup to use it, a response may also be queued for upload to the KeenASR Dashboard using:
response.queueForUpload()
See Full Response JSON example
{
"id": "7e2ae5b4-3133-4e4d-994b-d772d7d5b7d3",
"jsonVersion": "0.3",
"sdkVersion": "5eb2b6781429838e00a2cea9f48feea314f3f6c1",
"appBundleId": "com.keenresearch.keenasr-ios-poc",
"asrBundle": "keenA1m-nnet3chain-en-us",
"decodingGraph": "reading",
"startTime": "2025-01-28 05:53:44 +0000",
"duration": 8.64,
"echoCancellation": false,
"deviceInfo": {
"deviceId": "bffeb9f1-58fa-4474-bfd6-94fa85ea7a0b",
"model": "iPhone",
"name": "iPhone",
"systemName": "iOS",
"systemVersion": "17.7.2"
},
"audioFilename": "7e2ae5b4-3133-4e4d-994b-d772d7d5b7d3.wav",
"asrResult": {
"text": "ONE PIG HOUSE WITH STICKS",
"cleanText": "ONE PIG HOUSE WITH STICKS",
"confidence": 1.0,
"words": [
{
"text": "ONE",
"startTime": 1.11,
"duration": 0.33,
"confidence": 1.0,
"phones": [
{"text": "W_B", "startTime": 1.11, "duration": 0.12, "pronunciationScore": 0.98},
{"text": "AH1_I", "startTime": 1.23, "duration": 0.06, "pronunciationScore": 0.98},
{"text": "N_E", "startTime": 1.29, "duration": 0.15, "pronunciationScore": 0.97}
]
},
{
"text": "PIG",
"startTime": 1.44,
"duration": 0.45,
"confidence": 1.0,
"phones": [
{"text": "P_B", "startTime": 1.44, "duration": 0.09, "pronunciationScore": 0.96},
{"text": "IH1_I", "startTime": 1.53, "duration": 0.18, "pronunciationScore": 0.91},
{"text": "G_E", "startTime": 1.71, "duration": 0.18, "pronunciationScore": 0.93}
]
},
{
"text": "HOUSE",
"startTime": 2.04,
"duration": 0.39,
"confidence": 1.0,
"phones": [
{"text": "HH_B", "startTime": 2.04, "duration": 0.09, "pronunciationScore": 1.0},
{"text": "AW1_I", "startTime": 2.13, "duration": 0.18, "pronunciationScore": 0.95},
{"text": "S_E", "startTime": 2.31, "duration": 0.12, "pronunciationScore": 0.96}
]
},
{
"text": "WITH",
"startTime": 2.46,
"duration": 0.21,
"confidence": 1.0,
"phones": [
{"text": "W_B", "startTime": 2.46, "duration": 0.09, "pronunciationScore": 1.0},
{"text": "IH0_I", "startTime": 2.55, "duration": 0.03, "pronunciationScore": 1.0},
{"text": "TH_E", "startTime": 2.58, "duration": 0.09, "pronunciationScore": 0.9}
]
},
{
"text": "STICKS",
"startTime": 2.67,
"duration": 0.63,
"confidence": 1.0,
"phones": [
{"text": "S_B", "startTime": 2.67, "duration": 0.12, "pronunciationScore": 1.0},
{"text": "T_I", "startTime": 2.79, "duration": 0.09, "pronunciationScore": 0.92},
{"text": "IH1_I", "startTime": 2.88, "duration": 0.12, "pronunciationScore": 0.95},
{"text": "K_I", "startTime": 3.0, "duration": 0.12, "pronunciationScore": 0.99},
{"text": "S_E", "startTime": 3.12, "duration": 0.18, "pronunciationScore": 0.98}
]
}
]
},
"audioQualityResult": {
"clippedSampleCount": 0,
"initialSegmentRmsWarning": false,
"meanNonSpeechRmsValue": -64.72,
"meanSpeechRmsValue": -41.75,
"peakSpeechRmsValue": -23.35,
"snrValue": 22.97,
"frameRmsValues": [
-61.44,
-60.97,
-61.63,
-63.27,
-65.37,
-66.11,
-65.93,
-65.31,
-64.46,
-64.57,
-65.07,
-66.15,
-66.31,
-65.8,
-65.18,
-65.06,
-65.95,
-67.21,
-67.13,
-65.33,
-64.94,
-64.04,
-65.42,
-64.49,
-63.95,
-62.89,
-63.67,
-64.88,
-65.9,
-65.78,
-65.99,
-65.72,
-66.22,
-65.92,
-65.85,
-65.39,
-66.47,
-59.89,
-57.07,
-57.22,
-64.71,
-65.73,
-65.15,
-65.7,
-65.26,
-65.31,
-65.96,
-65.12,
-64.66,
-64.91,
-65.44,
-65.2,
-65.24,
-65.96,
-68.67,
-67.52,
-66.99,
-66.38,
-68.11,
-67.66,
-67.47,
-66.22,
-66.22,
-66.66,
-67.66,
-67.03,
-66.27,
-65.53,
-63.72,
-64.16,
-65.9,
-64.2,
-64.24,
-66.01,
-67.55,
-67.65,
-68.11,
-67.32,
-67.4,
-66.52,
-65.51,
-65.11,
-66.52,
-66.08,
-66.04,
-66.28,
-66.44,
-65.47,
-65.73,
-67.58,
-67.57,
-66.79,
-64.61,
-64.34,
-65.71,
-65.1,
-65.04,
-65.78,
-65.66,
-64.24,
-63.79,
-62.85,
-62.92,
-64.77,
-64.39,
-61.87,
-59.26,
-58.43,
-55.29,
-55.06,
-50.29,
-42.47,
-34.39,
-32.21,
-30.75,
-29.31,
-27.93,
-26.72,
-25.4,
-24.05,
-23.53,
-23.35,
-23.09,
-22.83,
-22.88,
-23.1,
-23.61,
-24.82,
-26.17,
-27.13,
-27.83,
-28.44,
-28.83,
-29.48,
-30.23,
-31.02,
-31.94,
-33.71,
-36.28,
-41.03,
-43.38,
-44.67,
-45.96,
-47.9,
-48.87,
-50.73,
-51.0,
-49.69,
-46.33,
-45.29,
-46.73,
-48.68,
-44.73,
-37.1,
-33.46,
-32.66,
-32.72,
-32.54,
-33.2,
-33.42,
-33.1,
-32.19,
-32.58,
-32.09,
-32.27,
-32.36,
-32.51,
-32.17,
-33.29,
-33.67,
-35.29,
-37.28,
-38.95,
-39.09,
-39.85,
-41.01,
-43.63,
-47.79,
-46.06,
-44.93,
-45.01,
-45.69,
-45.5,
-49.26,
-51.93,
-55.5,
-57.73,
-57.19,
-57.99,
-56.71,
-56.1,
-56.21,
-58.58,
-59.02,
-58.84,
-59.12,
-59.58,
-63.48,
-63.65,
-60.54,
-57.24,
-54.41,
-53.65,
-54.02,
-55.9,
-55.27,
-53.42,
-51.65,
-48.0,
-39.78,
-33.43,
-33.31,
-36.31,
-31.73,
-29.46,
-28.24,
-27.16,
-26.4,
-26.16,
-26.07,
-25.84,
-25.96,
-26.11,
-27.11,
-27.23,
-27.9,
-28.05,
-29.06,
-30.1,
-31.47,
-33.44,
-37.88,
-42.78,
-47.23,
-48.39,
-47.79,
-47.47,
-47.21,
-47.35,
-47.69,
-49.15,
-51.42,
-42.91,
-39.07,
-37.72,
-38.1,
-39.03,
-37.99,
-35.1,
-33.55,
-32.69,
-31.82,
-31.4,
-32.82,
-34.42,
-38.49,
-42.41,
-47.47,
-51.43,
-52.53,
-51.61,
-51.96,
-52.92,
-53.86,
-52.17,
-50.75,
-49.09,
-48.81,
-48.83,
-49.0,
-49.79,
-50.83,
-51.17,
-51.27,
-53.05,
-54.18,
-60.57,
-63.59,
-65.07,
-60.03,
-59.88,
-59.5,
-59.02,
-50.91,
-49.85,
-34.24,
-30.03,
-28.17,
-27.85,
-28.54,
-29.21,
-30.51,
-31.6,
-32.09,
-32.9,
-34.09,
-34.48,
-35.82,
-38.51,
-40.71,
-48.34,
-48.79,
-48.4,
-49.84,
-52.96,
-50.29,
-50.34,
-52.66,
-51.61,
-51.47,
-52.05,
-51.73,
-51.75,
-51.88,
-51.87,
-51.48,
-51.31,
-51.75,
-52.23,
-53.15,
-52.6,
-52.92,
-52.77,
-52.26,
-52.87,
-54.55,
-55.32,
-55.62,
-60.45,
-64.08,
-63.8,
-62.02,
-62.89,
-62.96,
-65.38,
-65.39,
-65.49,
-64.23,
-64.77,
-64.69,
-65.86,
-66.16,
-65.85,
-65.94,
-65.64,
-66.28,
-66.37,
-66.54,
-64.98,
-64.51,
-63.9,
-63.7,
-62.65,
-63.8,
-65.18,
-65.23,
-64.08,
-65.35,
-66.39,
-65.96,
-65.19,
-64.46,
-64.75,
-65.0,
-66.71,
-66.03,
-65.8,
-65.61,
-66.24,
-65.65,
-66.58,
-66.1,
-66.36,
-66.56,
-66.35,
-66.51,
-67.89,
-66.5,
-66.16,
-66.45,
-66.8,
-65.95,
-65.4,
-64.94,
-65.77,
-64.96,
-62.57,
-62.72,
-63.89,
-63.74,
-62.07,
-62.78,
-64.14,
-67.95,
-68.26,
-66.11,
-65.14,
-65.63,
-67.1,
-67.64,
-66.56,
-65.01,
-64.65,
-64.08,
-64.75,
-64.9,
-62.21,
-62.25,
-63.75,
-64.22,
-65.34,
-66.93,
-66.04,
-65.53,
-65.49,
-65.32,
-63.39,
-64.31,
-65.89,
-66.61,
-63.56,
-59.93,
-59.21,
-61.67,
-64.05,
-64.35,
-65.2,
-63.27,
-63.02,
-62.33,
-61.84,
-61.99,
-65.48,
-64.19,
-64.79,
-64.66,
-64.47,
-63.88,
-63.86,
-65.3,
-65.83,
-64.38,
-63.11,
-62.15,
-63.59,
-65.23,
-65.65,
-65.87,
-65.53,
-64.53,
-64.43,
-63.25,
-64.31,
-65.04,
-65.32,
-64.04,
-63.86,
-63.16,
-62.72,
-62.83,
-62.52,
-65.8,
-67.21,
-66.16,
-66.13,
-65.12,
-63.62,
-62.31,
-62.59,
-65.26,
-62.47,
-61.68,
-61.63,
-62.28,
-62.47,
-62.6,
-62.07,
-62.75,
-61.07,
-61.28,
-61.6,
-61.73,
-61.77,
-62.88,
-62.75,
-61.89,
-63.09,
-64.27,
-62.28,
-62.23,
-63.68,
-62.28,
-61.35,
-60.16,
-61.9,
-61.47,
-62.93,
-62.54,
-63.01,
-63.48,
-64.45,
-64.84,
-64.43,
-63.34,
-62.97,
-64.92,
-61.8,
-61.98,
-62.05,
-64.97,
-64.99,
-65.72,
-65.91,
-66.36,
-65.48,
-64.43,
-61.9,
-63.0,
-65.48,
-67.14,
-64.77,
-64.13,
-64.73,
-66.45,
-66.17,
-66.79,
-67.74,
-67.59,
-64.71,
-64.62,
-65.55,
-65.52,
-66.77,
-65.36,
-63.11,
-63.27,
-64.54,
-64.26,
-65.04,
-66.22,
-66.94,
-66.52,
-65.44,
-65.29,
-65.52,
-66.47,
-67.55,
-66.37,
-66.54,
-68.52,
-66.01,
-65.76,
-66.42,
-66.78,
-64.53,
-63.33,
-64.46,
-65.63,
-64.67,
-63.11,
-63.22,
-64.67,
-66.72,
-65.34,
-66.04,
-66.8,
-66.95,
-65.59,
-64.21,
-63.78,
-65.17,
-66.41,
-66.43,
-66.14,
-66.28,
-66.0,
-65.52,
-65.0,
-66.99,
-64.69,
-64.76,
-65.1,
-65.69,
-66.61,
-67.75,
-67.21,
-67.07,
-67.03,
-65.22,
-64.54,
-65.83,
-67.25,
-66.09,
-66.5,
-65.57,
-64.07,
-64.15,
-66.36,
-67.19,
-65.82,
-63.24,
-63.67,
-62.67,
-63.83,
-64.64,
-66.14,
-66.46,
-67.14,
-66.38,
-64.81,
-64.92,
-66.64,
-68.48,
-67.97,
-66.14,
-65.72,
-65.81,
-65.31,
-64.67,
-64.41,
-64.33,
-64.23,
-63.72,
-63.89,
-65.03,
-65.07,
-65.23,
-65.36,
-64.74,
-64.98,
-65.12,
-65.9,
-65.82,
-65.15,
-64.45,
-64.69,
-65.63,
-66.04,
-65.82,
-66.0,
-66.24,
-66.6,
-65.46,
-63.99,
-64.31,
-64.9,
-65.46,
-65.22,
-65.52,
-65.73,
-67.4,
-65.99,
-65.88,
-66.69,
-65.98,
-67.61,
-66.83,
-65.81,
-66.04,
-65.84,
-65.31,
-66.39,
-65.86,
-65.83,
-66.83,
-66.48,
-67.03,
-67.53,
-67.56,
-67.08,
-66.35,
-65.24,
-65.55,
-66.19,
-66.06,
-66.55,
-65.34,
-64.95,
-65.57,
-65.57,
-65.92,
-67.39,
-65.59,
-64.52,
-64.93,
-67.11,
-65.83,
-64.64,
-64.5,
-64.91,
-64.54,
-64.32,
-64.35,
-65.94,
-65.14,
-64.2,
-64.41,
-66.36,
-66.78,
-66.79,
-66.07,
-66.7,
-67.91,
-66.5,
-66.01,
-66.4,
-66.82,
-66.42,
-66.7,
-67.07,
-66.3,
-64.1,
-64.46,
-64.8,
-65.07,
-63.69,
-64.82,
-64.12,
-64.58,
-63.87,
-65.22,
-66.21,
-66.62,
-65.63,
-65.68,
-65.8,
-66.0,
-65.03,
-57.65,
-57.12,
-56.94,
-64.58,
-66.3,
-67.23,
-67.19,
-66.98,
-66.67,
-66.17,
-66.19,
-66.35,
-66.33,
-66.03,
-64.8,
-62.91,
-62.58,
-63.99,
-65.04,
-66.99,
-66.79,
-65.23,
-65.15,
-66.42,
-67.35,
-67.07,
-67.97,
-65.91,
-63.37,
-63.97,
-65.1,
-65.08,
-64.24,
-64.85,
-64.57,
-64.21,
-64.34,
-63.84,
-62.7,
-62.55,
-65.56,
-66.45,
-65.82,
-63.66,
-63.44,
-66.78,
-67.12,
-67.41,
-66.99,
-64.69,
-65.05,
-65.71,
-64.87,
-63.92,
-64.0,
-67.01,
-67.23,
-67.43,
-67.09,
-65.64,
-65.21,
-64.27,
-65.24,
-63.5,
-64.2,
-63.54,
-65.23,
-66.73,
-67.32,
-67.37,
-66.42,
-65.29,
-65.46,
-65.37,
-66.05,
-65.92,
-66.4,
-67.33,
-65.04,
-65.36,
-65.71,
-64.03,
-62.15,
-62.47,
-64.0,
-63.02,
-63.77,
-66.37,
-66.89,
-64.65,
-63.92,
-64.4,
-65.09,
-66.5,
-66.46,
-65.91,
-66.73,
-65.65,
-66.43,
-65.89,
-65.25,
-66.12,
-67.3,
-66.49,
-65.29,
-62.46,
-62.74,
-64.75,
-66.47,
-66.11,
-66.31,
-63.77,
-63.31,
-64.77,
-64.7,
-64.35,
-64.25,
-64.43,
-64.45,
-65.79,
-64.69,
-63.97,
-63.91,
-64.71,
-65.23,
-66.32,
-66.35,
-65.72,
-65.94,
-64.42,
-63.87,
-64.4,
-63.85,
-63.89
]
}
}
