GTCRN
https://github.com/Xiaobin-Rong/gtcrn
RubyGemにした: https://gitlab.com/KitaitiMakoto/gtcrn
gtcrn_simple.onnx
code:ruby
session = OnnxRuntime::InferenceSession.new("gtcrn_simple.onnx")
pp session
#<OnnxRuntime::InferenceSession:0x00000001221b2a38
@allocator=#<FFI::Pointer address=0x000000012785f990>,
@inputs=
[{name: "mix", type: "tensor(float)", shape: 1, 257, 1, 2},
{name: "conv_cache", type: "tensor(float)", shape: 2, 1, 16, 16, 33},
{name: "tra_cache", type: "tensor(float)", shape: 2, 3, 1, 1, 16},
{name: "inter_cache", type: "tensor(float)", shape: 2, 1, 33, 16}],
@outputs=
[{name: "enh", type: "tensor(float)", shape: 1, 257, 1, 2},
{name: "conv_cache_out", type: "tensor(float)", shape: 2, 1, 16, 16, 33},
{name: "tra_cache_out", type: "tensor(float)", shape: 2, 3, 1, 1, 16},
{name: "inter_cache_out", type: "tensor(float)", shape: 2, 1, 33, 16}],
@session=#<FFI::AutoPointer address=0x0000000bab62aa00>>
mixはWAVEファイルから読み込んだただのサンプルの配列でいいっぽい。
Melスペクトログラムとかにはしなくていい
ビット深度は調整する必要はあるかも
https://github.com/k2-fsa/sherpa-onnx/blob/408b96f08a0ab19e5041fd8ea69a30b928577c73/sherpa-onnx/csrc/offline-speech-denoiser.cc
を見ると、conv_cacheとかは用意すると言っても単に0で埋めればいいっぽい。
https://colab.research.google.com/github/Kazuhito00/GTCRN-ONNX-RealTime-Inference-Sample/blob/main/colab-wav-sample.ipynb#scrollTo=990utvx0CWBr
を見るとフーリエ変換しているな……
本家でもしていた(STFT):https://github.com/Xiaobin-Rong/gtcrn/blob/01b1f7e780811ebd47026859ae244041bc964486/stream/gtcrn_stream.py