GithubHelp home page GithubHelp logo

doytsujin / android-vad Goto Github PK

View Code? Open in Web Editor NEW

This project forked from gkonovalov/android-vad

0.0 1.0 0.0 319 KB

This VAD library can process audio in real-time utilizing GMM which helps identify presence of human speech in an audio sample that contains a mixture of speech and noise.

License: MIT License

Java 4.66% Makefile 1.15% C 83.65% C++ 6.20% Assembly 2.48% Objective-C 1.86%

android-vad's Introduction

Android Voice Activity Detection (VAD)

This VAD library can process audio in real-time utilizing Gaussian Mixture Model (GMM) which helps identify presence of human speech in an audio sample that contains a mixture of speech and noise. VAD work offline and all processing done on device.

Library based on WebRTC VAD from Google which is reportedly one of the best available: it's fast, modern and free. This algorithm has found wide adoption and has recently become one of the gold-standards for delay-sensitive scenarios like web-based interaction.

If you are looking for a higher accuracy and faster processing time I recommend to use Deep Neural Networks(DNN). Please see for reference the following paper with DNN vs GMM comparison.

drawing

Parameters

VAD library only accepts 16-bit mono PCM audio.

Valid sample rates are 8000, 16000, 32000 and 48000 Hz.

Frame size can be 80, 160, 240, 320, 480, 640, 960 or 1440 bytes depending on the sample rate.

Classifier supports NORMAL, LOW_BITRATE, AGGRESSIVE and VERY_AGGRESSIVE modes.

Silence duration (ms) - this parameter used in Continuous Speech detector, the value of this parameter will define the necessary and sufficient duration of negative results to recognize it as silence.

Voice duration (ms) - this parameter used in Continuous Speech detector, the value of this parameter will define the necessary and sufficient duration of positive results to recognize result as speech.

Recommended parameters:

  • sample rate - 16KHz,
  • frame size - 480,
  • mode - VERY_AGGRESSIVE,
  • silence duration - 500ms,
  • voice duration - 500ms;

Usage

VAD supports 2 different ways of detecting speech:

  1. Continuous Speech detector was designed to detect long utterances without returning false positive results when user makes pauses between sentences.
 Vad vad = new Vad(VadConfig.newBuilder()
                .setSampleRate(VadConfig.SampleRate.SAMPLE_RATE_16K)
                .setFrameSize(VadConfig.FrameSize.FRAME_SIZE_480)
                .setMode(VadConfig.Mode.VERY_AGGRESSIVE)
                .setSilenceDurationMillis(500)
                .setVoiceDurationMillis(500)
                .build());

        vad.start();
        
        vad.isContinuousSpeech(short[] audioFrame, new VadListener() {
            @Override
            public void onSpeechDetected() {
                //speech detected!
            }

            @Override
            public void onNoiseDetected() {
                //noise detected!
            }
        });
        
        vad.stop();
  1. Speech detector was designed to detect speech/noise in small audio frames and return result for every frame. This method will not work for long utterances.
 Vad vad = new Vad(VadConfig.newBuilder()
                .setSampleRate(VadConfig.SampleRate.SAMPLE_RATE_16K)
                .setFrameSize(VadConfig.FrameSize.FRAME_SIZE_480)
                .setMode(VadConfig.Mode.VERY_AGGRESSIVE)
                .build());

        vad.start();
        
        boolean isSpeech = vad.isSpeech(short[] audioFrame);
        
        vad.stop();

Requirements

Android VAD supports Android 4.1 (Jelly Bean) and later.

Development

To open the project in Android Studio:

  1. Go to File menu or the Welcome Screen
  2. Click on Open...
  3. Navigate to VAD's root directory.
  4. Select setting.gradle

Download

Gradle is the only supported build configuration, so just add the dependency to your project build.gradle file:

  1. Add it in your root build.gradle at the end of repositories:
allprojects {
   repositories {
     maven { url 'https://jitpack.io' }
   }
}
  1. Add the dependency
dependencies {
    implementation 'com.github.gkonovalov:android-vad:1.0.0'
}

You also can download precompiled AAR library and APK files from GitHub's releases page.


Georgiy Konovalov 2019 (c) MIT License

android-vad's People

Contributors

gkonovalov avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.