Click here to Skip to main content
15,867,568 members
Articles / Artificial Intelligence / ML.Net

VoiceNET Library

Rate me:
Please Sign up or sign in to vote.
5.00/5 (2 votes)
27 Jun 2022MIT3 min read 8K   158   10   4
Free Voice Command Control Library
This is a .NET library to easily create Voice Command Control feature.

Nuget NuGet

Table of Contents

Introduction

VoiceNET Library makes it easy and fast to create Voice Command Control functionality through Label Prediction. It helps develop voice control in real-time on software or the web. It free supports online and offline use. This is a community development project to help people access voice recognition technology more easily.

It's a research project from the FPT Edu Research Festival 2021 contest.

Image 3

VoiceNET Library

How It Works?

Using ML.NET and Spectrogram libraries, the VoiceNET library works by converting your voice into a spectrogram. From there, proceed to use the Image Classification function in the ML.NET library to mark the label.

Image 4

How the VoiceNET Library works

Features

  • Voice Command Control in real time
  • Voice Command Control based on recording

Advantages

  • Easily integrate the library into your program
  • Code is simple for everyone to use
  • Can be used both online and offline
  • Can be used for any communication language in the world
  • It's free

Disadvantages

  • It takes a long time to create a Model for the library.
  • The time it takes to load the model into the program can be slow.
  • There's still an error rate when labeling recognition.

Installation

Once you have an app, you can install the VoiceNET Library NuGet package from the .NET Core CLI using:

dotnet add package VoiceNET.Library

or from the NuGet Package Manager:

Install-Package VoiceNET.Library

Quickstart

WinForm Real-time

Example

Image 5

A real-time voice-controlled image gallery

How to Make a Demo in Real-Time?

Drag and drop into the Windows Forms interface:

  • Label: lbResult
  • Timer: tmGetResult (Interval=1)

In Form_Load:

C#
VBuilder.ModelPath("<your_model_path>");

if (VBuilder.loadModel())
    
{
	tmGetResult.Start();
	VBuilder.WFListener();            
}

In tmGetResult:

C#
lbResult.Text = VBuilder.WFGetResult;

Use the following code if you want to stop listening:

C#
VBuilder.WFStopListener();

WinForm Recording

Example

Image 6

Example of command label recognition by recording

How to Make a Demo in Recording?

Drag and drop into the Windows Forms interface:

  • Button: btnRecord, btnStop
  • Label: lbResult

Form_Load:

C#
VBuilder.ModelPath("<your_model_path>");

 if(VBuilder.loadModel())
 
    //do something after Load Model
	
 else
 
   //do something if fail

btnRecord_Click:

C#
VBuilder.StartRecord();

btnStop.Enabled = true;

btnRecord.Enabled = false;

btnStop:

C#
VBuilder.StopRecord();

lbResult.Text = VBuilder.Result(true);

btnRecord.Enabled = true;

btnStop.Enabled = false;

WPF Real-time - Support from v1.0.5

Drag and drop into the WPF Application interface:

  • Label: lbResult

Before MainWindow():

C#
public DispatcherTimer tmGetResult = new DispatcherTimer();

In MainWindow():

C#
tmGetResult.Interval = TimeSpan.FromSeconds(1);

tmGetResult.Tick += tmGetResult_Tick;

VBuilder.ModelPath("<your_model_path>");

    if (VBuilder.loadModel())
            
	{

        tmGetResult.Start();

        VBuilder.WPFListener();

    }

In void tmGetResult_Tick:

C#
lbResult.Content = VBuilder.WPFGetResult;

Use the following code if you want to stop listening:

C#
VBuilder.WPFStopListener();

WPF Recording - Support from v1.0.5

See the example in VoiceNET.Lib.WPF.Record for more how to use it.

ASP.NET MVC - Support from v1.0.2.4

See the example in VoiceNET.Lib.Web.AspNet for more how to use it.

ASP.NET Core Web API - Support from v1.0.6.8

See the example in SampleWebAPI for more how to use it.

It includes example ASP.NET Core Web API and WinForm App (WinForm Realtime) using Web API.

How to Create a Model?

Use the included MicBuilder program to build an MLModel.zip file for your Dataset.

Image 7

MicBuilder Model Builder

Setting

Microphone Volume Adjustment:

C#
VBuilder.setVolume(80);

Ambient noise reduction setting

  • Min Value: Adjust the minimum volume level to perform capturing. Input sound that is less than this portion will be considered noise. The default value is 10%.
C#
VBuilder.setMinVolume(10); 
  • Continuous: How long does the sound stay continuous when Sound Input > Min Volume. The default value is 250 milliseconds.
C#
VBuilder.setMicTime(250);

Resources

License

MIT LICENSE

  • Spectrogram - is a .NET library for creating spectrograms from pre-recorded signals or live audio from the sound card.
  • ML.NET - is a cross-platform open-source machine learning (ML) framework for .NET.
  • VoiceNET Library - is a .NET Library makes it easy and fast to create Voice Command Control functionality.
This article was originally posted at https://github.com/nhannt201/VoiceNET.Library

License

This article, along with any associated source code and files, is licensed under The MIT License


Written By
Software Developer
Vietnam Vietnam
Research Student at BTEC FPT British College

Comments and Discussions

 
QuestionTrain data Pin
khiyeuvn29-Jun-22 22:45
khiyeuvn29-Jun-22 22:45 
AnswerRe: Train data Pin
Nguyễn Trung Nhẫn29-Jun-22 22:57
Nguyễn Trung Nhẫn29-Jun-22 22:57 
QuestionVoice Recognition Learning Pin
Hyland Computer Systems29-Jun-22 7:42
Hyland Computer Systems29-Jun-22 7:42 
AnswerRe: Voice Recognition Learning Pin
Nguyễn Trung Nhẫn29-Jun-22 15:11
Nguyễn Trung Nhẫn29-Jun-22 15:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.