This library provides common speech features for ASR including MFCCs and filterbank energies for Android and iOS.

Overview

Kotlin Speech Features

GitHub forks GitHub issues GitHub Stars


Quick Links

 

πŸ“’ Introduction

This library is a complete port of python_speech_features in pure Kotlin available for Android and iOS projects.

It provides common speech features for Automated speech recognition (ASR) including MFCCs and filterbank energies.
To know more about MFCCs read more.

Features

πŸ™‹ How to use

We support multiple platforms using Kotlin multiplatform.

Android

Integration

Add jitpack.io to your project's repositories:

allProjects {
  repositories {
    google()
    maven { url 'https://jitpack.io' }
  }
}

Add the dependency:

dependencies {
    implementation "com.github.MerlynMind:kotlin_speech_features:${version}"
}

Example implementation

A sample app is included in this repo to help understand the implementation.

  1. Convert your audio signal in the form of a float array. (A demo provided in the sample app)
  2. Initialize speech features
    private val speechFeatures = SpeechFeatures()
  3. Perform any of the 4 operations:
    val result = speechFeatures.mfcc(MathUtils.normalize(wav), nFilt = 64)
    val result = speechFeatures.fbank(MathUtils.normalize(wav), nFilt = 64)
    val result = speechFeatures.logfbank(MathUtils.normalize(wav), nFilt = 64)
    val result = speechFeatures.ssc(MathUtils.normalize(wav), nFilt = 64)
  4. The result will contain metrices with the expected features. Pass in these features for further processes (e.g. classification, speech recognition).

iOS

Integration

  1. In XCode, go to File > Add Packages...
  2. Paste in the URL of this repo in the search box
  3. Select the package found
  4. Click Add Package button

Example implementation

A sample app is included in this repo to help understand the implementation.

  1. Convert your audio signal in the form of an KotlinIntArray and normalize it.
    import KotlinSpeechFeatures
    
    let signal = [Int](1...1000) // Example signal
    let normalized = MathUtils.Companion.init().normalize(sig: toKotlinIntArray(arr: signal))
    
    func toKotlinIntArray(arr: [Int]) -> KotlinIntArray {
        let result = KotlinIntArray(size: Int32(arr.capacity))
        for i in 0...(arr.count-1) {
            result.set(index: Int32(i), value: Int32(arr[i]))
        }
        return result
    }
  2. Initialize speech features
    let speechFeatures = SpeechFeatures()
  3. Perform any of the 4 operations:
    let result = speechFeatures.mfcc(signal: normalized, sampleRate: 16000, winLen: 0.025, winStep: 0.01, numCep: 13, nFilt: 64, nfft: 512, lowFreq: 0, highFreq: ni;, preemph: 0.97, ceplifter: 22, appendEnergy: true, winFunc: nil)
    let result = speechFeatures.fbank(signal: normalized, sampleRate: 16000, winLen: 0.025, winStep: 0.01, nFilt: 64, nfft: 512, lowFreq: 0, highFreq: nil, preemph: 0.97, winFunc: nil)
    let result = speechFeatures.logfbank(signal: normalized, sampleRate: 16000, winLen: 0.025, winStep: 0.01, nFilt: 64, nfft: 512, lowFreq: 0, highFreq: nil, preemph: 0.97, winFunc: nil)
    let result = speechFeatures.ssc(signal: normalized, sampleRate: 16000, winLen: 0.025, winStep: 0.01, nFilt: 64, nfft: 512, lowFreq: 0, highFreq: nil, preemph: 0.97, winFunc: nil)
  4. The result will contain metrices with the expected features. Pass in these features for further processes (e.g. classification, speech recognition).
JavaScript
Coming soon...

✍️ Contributing

Interested in contributing to the library? Thank you so much for your interest! We are always looking for improvements to the project and contributions from open-source developers are greatly appreciated.

  1. Clone repo and create a new branch:
git checkout https://github.com/merlynmind/kotlin_speech_features -b name_for_new_branch
  1. Make changes and test
  2. Submit Pull Request with comprehensive description of changes

🌟 Spread the word!

If you want to say thank you and/or support active development of this library:

  • Add a GitHub Star to the project!
  • Tweet about the project on your Twitter! Tag @MerlynMind and/or #heyMerlnyn

Thank you so much for your interest in growing the reach of our library!

🧑 Credits

  • Arjun Sunil - Original Author of kotlin speech features
  • Raquib-Ul Alam - For major refactoring and making the code presentable
  • Rob Smith - For Mentoring and helping us to navigate through the task

πŸ“ References

wget http://voyager.jpl.nasa.gov/spacecraft/audio/english.au
sox english.au -e signed-integer english.wav
You might also like...
Create an application with Kotlin/JVM and Kotlin/JS, and explore features around code sharing, serialization, server- and client
Create an application with Kotlin/JVM and Kotlin/JS, and explore features around code sharing, serialization, server- and client

Building a Full Stack Web App with Kotlin Multiplatform λ³Έ μ €μž₯μ†ŒλŠ” INFCON 2022μ—μ„œ μ½”ν‹€λ¦° λ©€ν‹°ν”Œλž«νΌ 기반 μ›Ή ν”„λ‘œκ·Έλž˜λ° ν•Έμ¦ˆμ˜¨λž©μ„ μœ„ν•΄ μž‘μ„±λœ ν…œν”Œλ¦Ώ ν”„λ‘œμ νŠΈκ°€ μžˆλŠ” κ³³μž…λ‹ˆλ‹€. ν•Έμ¦ˆμ˜¨ κ³Όμ •μ—μ„œ μ½”ν‹€λ¦° λ©€ν‹°ν”Œλž«νΌμ„

Bego Chat is chat application in Kotlin and Firebase with the following features: last seen , user status like typing ,online and last seen with MVVM pattern and clean architecture

Compose ChatApp(Bego Chat) Bego Chat is Compose chat application in Kotlin and Firebase with the following features: sending all file types and abilit

LifecycleMvp 1.2 0.0 Kotlin  is MVP architecture implementation with Android Architecture Components and Kotlin language features
LifecycleMvp 1.2 0.0 Kotlin is MVP architecture implementation with Android Architecture Components and Kotlin language features

MinSDK 14+ Download Gradle Add to project level build.gradle allprojects { repositories { ... maven { url 'https://jitpack.io' }

Enable and customize hidden features on Android 12.
Enable and customize hidden features on Android 12.

Android 12 Extensions This is a Magisk + Xposed module that adds customization and enables hidden features on Android 12. It also includes a configura

Example Multi module architecture Android project using MVVM, Dynamic Features, Dagger-Hilt, Coroutines and Navigation Components
Example Multi module architecture Android project using MVVM, Dynamic Features, Dagger-Hilt, Coroutines and Navigation Components

ModularDynamicFeatureHilt An Android template project following a multi module approach with clean architecture. It has been built following Clean Arc

Easy Android camera integration, advanced features.

CameraViewEx This is an extended version of Google's cameraview library with better stability and many more features. CameraViewEx highly simplifies i

Basic Android app to use Jetpack WorkManager API features
Basic Android app to use Jetpack WorkManager API features

jetpack-work-manager-playground Basic Android app to use Jetpack WorkManager API features Jetpack WorkManager Playground Demo app Jetpack WorkManager

Reusable login template to learn Kotlin & Android additional features
Reusable login template to learn Kotlin & Android additional features

LogIn_Application reusable login template I started this project to learn Kotlin & Android additional features. This is LogIn Template App as part of

An amazing expense tracker app, with great features and beautiful UI. Check it out!
An amazing expense tracker app, with great features and beautiful UI. Check it out!

My Expense Tracker Expense tracker app to keep your finances in order. Built entirely in Kotlin using modern architecture components. Build πŸ—οΈ My Exp

Releases(v1.0.0)
Owner
Merlyn Mind
The digital assistant for teachers.
Merlyn Mind
JavaScript evaluation from kotlin common code for android & iOS

Mobile Kotlin javascript This is a Kotlin MultiPlatform library that allows you to run JavaScript code from common Kotlin code Table of Contents Featu

IceRock Development 14 Aug 29, 2022
Provides Kotlin libs and some features for building Kotlin plugins

Kotlin Plugin Provides Kotlin libs and some features for building awesome Kotlin plugins. Can be used instead of CreeperFace's KotlinLib (don't use to

null 3 Dec 24, 2021
Com.hhvvg.anytext - An application provides features to modify any TextView in any other applications

AnyText What's this This application provides features to modify any TextView in

null 6 Dec 2, 2022
A nice weather that helps you get all information including: current weather, hourly weather and also forecasts for 16 days

WeatherForecast This is an ongoing project where I fetch all the weather data using Retrofit and Kotlin Coroutines over two APIs containing both curre

null 2 Jul 26, 2022
πŸ‘‹ A common toolkit (utils) βš’οΈ built to help you further reduce Kotlin boilerplate code and improve development efficiency. Do you think 'kotlin-stdlib' or 'android-ktx' is not sweet enough? You need this! 🍭

Toolkit [ ?? Work in progress ⛏ ?? ??️ ?? ] Snapshot version: repositories { maven("https://s01.oss.sonatype.org/content/repositories/snapshots") }

凛 35 Jul 23, 2022
This lib implements the most common CoroutineScopes used in Android apps.

AndroidCoroutineScopes Starting from 0.26.0 release we should define a scope for new coroutines (docs). To avoid this boilerplate code I've created th

Adriel CafΓ© 15 Oct 3, 2022
Common Android/Kotlin extensions

Common Android/Kotlin extensions Gradle implementation "com.github.javokhirsavriev:common-extensions:1.0.1" License Copyright 2022 Javokhir Savriev L

Javokhir 0 Feb 15, 2022
Actions are things that run, with parameters. Serves as a common dependency for a variety of Cepi extensions.

Actions Actions that take in customizable paramaters, an optional target, and do things. Installation Download the jar from Releases OR compile it you

Cepi 1 Jan 9, 2022
A library with many useful and easy-to-use features

This library was made as a replacement for qLib and in the future cubed. These 2 plugins are hard to get you hands on and one of them has many outdated methods so this is a more modern version of those things

Max 1 May 6, 2022
Create an application with Kotlin/JVM and Kotlin/JS, and explore features around code sharing, serialization, server- and client

Practical Kotlin Multiplatform on the Web λ³Έ μ €μž₯μ†ŒλŠ” μ½”ν‹€λ¦° λ©€ν‹°ν”Œλž«νΌ 기반 μ›Ή ν”„λ‘œκ·Έλž˜λ° μ›Œν¬μˆ(κ°•μ’Œ)을 μœ„ν•΄ μž‘μ„±λœ ν…œν”Œλ¦Ώ ν”„λ‘œμ νŠΈκ°€ μžˆλŠ” κ³³μž…λ‹ˆλ‹€. μ›Œν¬μˆ κ³Όμ •μ—μ„œ μ½”ν‹€λ¦° λ©€ν‹°ν”Œλž«νΌμ„ 기반으둜 ν”„λ‘ νŠΈμ—”λ“œ(front-end)λŠ” Ko

SpringRunner 14 Nov 5, 2022