#bindings #fbank #github #fork #com #kaldi-native-fbank #accept-waveform

kaldi-fbank-rust-kautism

Kautism's fork of https://github.com/Okabintaro/kaldi-fbank-rust

1 unstable release

new 0.1.0 Mar 17, 2025

#40 in #com


Used in sensevoice-rs

MIT license

205KB
5.5K SLoC

C++ 4K SLoC // 0.2% comments Rust 807 SLoC // 0.0% comments Python 529 SLoC // 0.1% comments Shell 95 SLoC // 0.3% comments C 20 SLoC // 0.2% comments Forge Config 1 SLoC

Kaldi Native FBank Rust Bindings

Minimal bindings for kaldi-native-fbank.

Still WIP. Only bound the things I needed.

Example:

let mut fbank = OnlineFbank::new(16_000f32);
fbank.accept_waveform(16_000f32, &[0.0; 16000 * 10]);
fbank.input_finished();
let frame = fbank.get_frame(0);
// Use frame/features

Notes

Generate bindings using bindgen like this:

bindgen kaldi-native-fbank/kaldi-native-fbank/c-api/c-api.h -o src/lib_sys.rs

Compile using cmake with compile commands for clangd.

cmake -S kaldi-native-fbank/ -B build -D BUILD_SHARED_LIBS=0 -D KALDI_NATIVE_FBANK_BUILD_PYTHON=0 -D KALDI_NATIVE_FBANK_BUILD_TESTS=0 -D CMAKE_EXPORT_COMPILE_COMMANDS=1
cmake --build build
ln -s build/compile_commands.json .

TODO:

  • Expose all the options needed

License

MIT or Apache 2

No runtime deps

~0–305KB