Sonde Health API Platform Documentation
Android Verification Module
Overview
The verification module is responsible for verifying the user’s audio against the voice used for enrollment, which was described in Sonde Edge Passive SDK Architecture. Additionally, before starting with the steps mentioned here, please review Android Sonde Edge Passive SDK Integration.
The following steps guide your app development. They provide detailed information for verifying the user’s voice, describe collecting the audio sample, and generate the score for Mental Fitness.
Â
Import the following classes in your Activity/Fragment
import com.sondeservices.common_passive.RecordingDataType
import com.sondeservices.passive.continuous.analysis.VoiceAnalysisCallback
import com.sondeservices.passive.continuous.analysis.VoiceSegmentData
import com.sondeservices.passive.models.Score
import sonde_passive.application_api.init.SondePassiveSdk
Before starting the verification, add the next check to make sure that the
RECORD_AUDIO
permission is enabled in your App :Declare the following code.
private val REQUEST_CODE_RECORD_AUDIO = 11111
Then add the following check,
if (ContextCompat.checkSelfPermission(
requireContext(),
android.Manifest.permission.RECORD_AUDIO
) != PackageManager.PERMISSION_GRANTED
) {
val permissions = arrayOf(android.Manifest.permission.RECORD_AUDIO)
ActivityCompat.requestPermissions(
requireActivity(),
permissions,
REQUEST_CODE_RECORD_AUDIO
)
}
Â
Also, verify that the app user grants record audio permission—the recording functionality will not function without permission. To do this, override theÂ
onRequestPermissionsResult
 method in your app and check the permission result.
override fun onRequestPermissionsResult(
requestCode: Int,
permissions: Array<String>,
grantResults: IntArray
) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
if (requestCode == REQUEST_CODE_RECORD_AUDIO && grantResults.isNotEmpty()
&& grantResults[0] != PackageManager.PERMISSION_GRANTED) {
throw RuntimeException("Record Audio permission is required to start recording.")
}
}
Initialize continuous analysis in your Activity/Fragment/Service
Call the
startContinuousVoiceAnalysis()
function to start verification.
Typecast the score to
VFFinalScore
to get the other voice feature's scores.
Display the score to the user
The score value generated in the above step varies between 0-100. Once you get the score, display it to the user. You should always show the user the interpretation message on the score screen. For some applications, scores may be uploaded and not shown to the users. However, the scores can be uploaded for an individual user or in bulk for further analysis through API function calls.
Refer to Vocal Biomarkers - Health Checks for the interpretation message.
Below is the screenshot for your reference.
Â
Â
Â
Sonde Health