项目介绍

jagger2048/rnnoise-windows 是一个托管在 GitHub 上的开源项目,主要使用 C 编写,目前获得 138 个 Star、47 次 Fork。

仓库全名
jagger2048/rnnoise-windows
Star 数
138
Fork 数
47
未关闭 Issue
8

README 摘要

rnnoise-windows This is a RNNoise windows platform demo. It was modified and restructured so that it can be compiled with MSVC, VS2017, VS2019. Apart from this, this project also has the cmake support for other platforms. What is the changes Some codes in the files, ./src/celtlpc.c , ./src/pitch.c , have been modified so that rnnoise can run at the windows platform. These code s had been written in C99 standard and…

完整内容见 GitHub 原始 README 或本页 。

常见问题

rnnoise-windows 用什么语言开发?

主要使用 C 编写,目前有 138 个 Star。

如何获取 rnnoise-windows 的源码?

可以直接克隆仓库:git clone https://github.com/jagger2048/rnnoise-windows.git;安装与运行步骤见仓库 README。

rnnoise-windows 最近还在维护吗?

仓库最近一次更新为 2021年7月27日,当前有 8 个未关闭 Issue;Star 数为 138,可作为社区活跃度的参考。

关于

This is a RNNoise windows demo. It was modified and restructured so that it can be compiled with MSVC, VS2017, VS2019.

描述取自 GitHub 官方 API,中文内容由 GitRead 中文社区 编辑团队整理。

简要分析

热度分
370
价值分
110
活跃状态
活跃

README

rnnoise-windows

This is a RNNoise windows platform demo. It was modified and restructured so that it can be compiled with MSVC, VS2017, VS2019. Apart from this, this project also has the cmake support for other platforms.

What is the changes

Some codes in the files, ./src/celt_lpc.c , ./src/pitch.c , have been modified so that rnnoise can run at the windows platform. These code s had been written in C99 standard and MSVC can not support these language standard completely, e.g. VLA.

Some training python scripts have been changed for fixing the bugs and can easy to use.

Usage:

You can reference the rnnoise_demo() function in the vs project Rnnoise-windows for more details.

  1. Initialize the rnnoise module.

    DenoiseState* pRnnoise = rnnoise_create(NULL);
    
  2. rnnoise frame process and output

    for (size_t n = 0; n < totalFrameCnt / 480; n++) {
        get_frame_f32(pWavIn, frameIn, 480); // get f32 pcm data
    
        rnnoise_process(pRnnoise, frameOut, frameIn); // rnnoise frame process
    if (isOutput) {
            write_frames_f32(pWavOut, 480, frameOut); // output to wav file
        }
    }
    
    
3. destroy rnnoise object

```c++
   rnnoise_destroy(pRnnoise);

Performance

Rnnoise has a excellent performance for the steady noise. Meanwhile, it can also work with the music noise situation. It depends on the model you train.

Test 1: speech with pink noise

Test 2: car noise + music + speech

How to train your model

The model locates at the file ./src/rnn_data.c. If you want to use a new model, you can just replace the file with your trained model.

Training steps

You should install below tools before training:

Tensorflow, python, Keras

It is a good choice to use Anaconda to manage your training environment, especially for windows platform.

  1. Install the training environment

    • download and install anaconda from the link.

    • create a virtual training environment

      • open your command line and create python 3.7 virtual environment name tf.

        conda create -n tf python=3.7
        
      • activate the virtual environment

        activate tf // for linux the command is source activate tf 
        
      • install tensorflow in the virtual environment

        conda install tensorflow
        
      • install keras in the virtual environment

        conda install keras
        
      • finally, start training( not yet right now)

        python rnn_train.py ...
        
  2. Prepare the feature set for training

    Generate the feature set to train a new model needs two wav files, one is the clean speech and the other is the noise data.

    • Complier a tool to convert the two file into a feature set

      • For WSL/Linux user:
      cd src
      ./train_complie.sh
      

      It will generate a tool which can help you convert the two file into a feature set. For example

      # ./denoise_training
      	usage: ./denoise_training <speech> <noise> <loop_count> <output feature>
      	
      # ./denoise_training clean_speech.wav noise.wav 50000 feature.dat
      matrix size: 50000 x 87
      

      The file feature.dat contains the feature needed.

      • For windows user, you can use the vs project rnnoise-training to generate a .exe executable program and run as above mention. The default .exe file located at rnnoise-windows\x64\Debug\ directory.
    • Convert the feature into h5 format

      First copy the file generated last step into the my-training directory. Then run a python script convert the feature into h5 format. Open your command line reference as below commands.

      # cd training
      # mv ../src/feature.dat .
      # python bin2hdf5.py --bin_file feature.dat --matrix_shape 50000x87
      

      These commands will generate a .h5 file for the next step.

  3. Training

    python rnn_train.py xxx.h5
    
  4. Capture the new model

    # python dump_rnn.py
    

Finally, copy the file rnn_data.c into src directory and recompile the project . Then run and check the result of new model. Have fun.

PS:

The training script has a function called “resume from break point”. While the rnn_train.py script is running, it will generate and scan a middle weight mid_weights.hdf5. If exits this file at the same directory when the scripts is started at the first time, it will continue the training process follow the last epoch. The script midWeight2Final.py will help you convert the midweight to the final weight which can be dumped to a new model.

Update log

Version log
1.2.1 fix cmake support for Linux/wsl platform; fix output stream missing bug in denoise.c when training
1.2 update training steps and merge the code from official branch, cmake support fails at this version
1.1 remove some extra files and test for vs2019
1.0 add cmake support and test for vs2017

Reference:

评论

暂无评论