[Huawei Developers] Freemind R:
Overview

Recently, an AI model developed at MIT has proven capable of distinguishing COVID-19 infected individuals from non-infected individuals, based solely on cough recording analysis.

Indeed, AI technology can seem so remarkable at times, that it appears to have magical powers.

These same high-level AI sound detection capabilities have recently been applied to bolster security systems.

Let’s look at how Huawei’s sound detection service takes security to the next level.

Service Introduction

Huawei’s sound detection service detects sound events in an environment by recording online in real time, and uses the data from detected events to perform subsequent operations. For example, the service notifies users of ongoing events in mobile apps, and reminds them to respond in a timely manner.

Currently, the service can detect events corresponding to the following 13 sound types:

ü Laughter

ü Baby crying

ü Snoring

ü Sneezing

ü Yelling

ü Cat meowing

ü Dog barking

ü Sound of water (such as faucet water, streams, and waves)

ü Car horn honking

ü Doorbell ringing

ü Door knocks

ü Fire alarms (sound emitted by fire or smoke alarms)

ü Other alarm sounds (sound emitted by fire trucks, ambulances, police cars, and civil defense sirens)

Real-world Applications

Huawei’s sound detection service has a wide range of applications, including assisting the hearing impaired, collecting health-related data, and caring for infants, offering users newfound functionality and peace of mind.

For example, a hearing impaired user can use the service to learn more about their surroundings, and react appropriately in real time in response to emergencies, such as fires, alarms, screams, or floods.

Parents can keep close tabs on their babies by using the sound detection service. After receiving a notification of baby crying from a mobile app, parents can then care for their child immediately.

This service can also detect and record a user’s snores and sneezes in real time, and provide the user with high-level health data.

The sound detection service of Huawei includes APIs and SDK packages, which means that can simply call the APIs or integrate the SDK, to proceed with development.

Development Procedure

1 Configuring App Information in AppGallery Connect

Before you start developing an app, configure app information in AppGallery Connect.

For details, please visit the following link:

https://developer.huawei.com/consumer/en/doc/development/HMSCore-Guides-V5/config-agc-0000001050990353-V5

2 Configuring the Maven Repository Address of the HMS Core SDK and Integrating the Service SDK

2.1 Opening the build.gradle File in the root Directory of Your Android Studio Project

[IMG="https://communityfile-dre.op.hicloud.com/FileServer/getFile/cmtybbs/000/431/408/2640065000000431408.20201127093133.60518713024405652327085736674982:50511130071540:2800:9A5EED24FE81A1CDCA1C30D1523FCA3E619E981D0C5468E5F824F5B3C6E31DD5.png"]https://communityfile-dre.op.hicloud.com/FileServer/getFile/cmtybbs/000/431/408/2640065000000431408.20201127093133.60518713024405652327085736674982:50511130071540:2800:9A5EED24FE81A1CDCA1C30D1523FCA3E619E981D0C5468E5F824F5B3C6E31DD5.png[/IMG]

2.2 Adding the AppGallery Connect Plug-in and the Maven Repository

Go to allprojects > repositories and configure the Maven repository address for the HMS Core SDK.

Go to buildscript > repositories and configure the Maven repository address for the HMS Core SDK.

If the agconnect-services.json file has been added to the app, go to buildscript > dependencies and add the AppGallery Connect plug-in configuration.

buildscript {
repositories {
google()
jcenter()
maven {url 'https://developer.huawei.com/repo/'}
}
dependencies {
...
classpath 'com.huawei.agconnect:agcp:1.4.1.300'
}
}

allprojects {
repositories {
google()
jcenter()
maven {url 'https://developer.huawei.com/repo/'}
}
}

3 Creating a Sound Detection Instance

MLSoundDector soundDector = MLSoundDector.createSoundDector();

4 Creating a Sound Detection Result Callback to Obtain the Detection Result and Passing the Callback to the Sound Detection Instance

private MLSoundDectListener listener = new MLSoundDectListener() {
@Override
public void onSoundSuccessResult(Bundle result) {
// Processing logic after successful detection. The detection result may be an integer from 0 to 12 (corresponding to thirteen sound types whose names are started with SOUND_EVENT_TYPE in the MLSoundDectConstants.java file).
int soundType = result.getInt(MLSoundDector.RESULTS_RECOGNIZED);
}
@Override
public void onSoundFailResult(int errCode) {
// Detection failed. The cause may be that the microphone permission (Manifest.permission.RECORD_AUDIO) is not assigned.
}
};
soundDector.setSoundDectListener(listener);

5 Starting Sound Detection

boolean isStarted = soundDector.start(context);
// If the value of isStared is true, the detection is successfully started; if the value of isStared is false, the detection fails to be started. (The possible cause is that the microphone is occupied by the system or another app.)

6 Stopping Sound Detection

soundDector.stop();

7 Releasing Resources After Detection

soundDector.destroy();

Demo

[IMG="https://communityfile-dre.op.hicloud.com/FileServer/getFile/cmtybbs/000/431/408/2640065000000431408.20201127093905.57003718519367138439318468908116:50511130071540:2800:4B23DD1604076401EBBB80300704BC191C9F91C918DA36856633AD2CC72692CF.gif"]https://communityfile-dre.op.hicloud.com/FileServer/getFile/cmtybbs/000/431/408/2640065000000431408.20201127093905.57003718519367138439318468908116:50511130071540:2800:4B23DD1604076401EBBB80300704BC191C9F91C918DA36856633AD2CC72692CF.gif[/IMG]

GitHub Demo

Reference

Official website of Huawei Developers

Development Guide

HMS Core official community on Reddit

Demo and sample code

Discussions on Stack Overflow