No project description provided
Project description
Introduction
Kaldi-compatible online fbank feature extractor without external dependencies.
Tested on the following architectures and operating systems:
- Linux
- macOS
- Windows
- Android
- x86
- arm
- aarch64
Usage
See the following CMake-based speech recognition (i.e., text-to-speech) projects for its usage:
- https://github.com/k2-fsa/sherpa-ncnn
- Specifically, please have a look at https://github.com/k2-fsa/sherpa-ncnn/blob/master/sherpa-ncnn/csrc/features.h
- https://github.com/k2-fsa/sherpa-onnx
They use kaldi-native-fbank
to compute fbank features for real-time
speech recognition.
Python APIs
First, please install kaldi-native-fbank
by
git clone https://github.com/csukuangfj/kaldi-native-fbank
cd kaldi-native-fbank
python3 setup.py install
or use
pip install kaldi-native-fbank
To check that you have installed kaldi-native-fbank
successfully, please use
python3 -c "import kaldi_native_fbank; print(kaldi_native_fbank.__version__)"
which should print the version you have installed.
Please refer to https://github.com/csukuangfj/kaldi-native-fbank/blob/master/kaldi-native-fbank/python/tests/test_online_fbank.py for usages.
For easier reference, we post the above file below:
#!/usr/bin/env python3
import sys
try:
import kaldifeat
except:
print("Please install kaldifeat first")
sys.exit(0)
import kaldi_native_fbank as knf
import torch
def main():
sampling_rate = 16000
samples = torch.randn(16000 * 10)
opts = kaldifeat.FbankOptions()
opts.frame_opts.dither = 0
opts.mel_opts.num_bins = 80
opts.frame_opts.snip_edges = False
opts.mel_opts.debug_mel = False
online_fbank = kaldifeat.OnlineFbank(opts)
online_fbank.accept_waveform(sampling_rate, samples)
opts = knf.FbankOptions()
opts.frame_opts.dither = 0
opts.mel_opts.num_bins = 80
opts.frame_opts.snip_edges = False
opts.mel_opts.debug_mel = False
fbank = knf.OnlineFbank(opts)
fbank.accept_waveform(sampling_rate, samples.tolist())
assert online_fbank.num_frames_ready == fbank.num_frames_ready
for i in range(fbank.num_frames_ready):
f1 = online_fbank.get_frame(i)
f2 = torch.from_numpy(fbank.get_frame(i))
assert torch.allclose(f1, f2, atol=1e-3), (i, (f1 - f2).abs().max())
if __name__ == "__main__":
torch.manual_seed(20220825)
main()
print("success")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Hashes for kaldi_native_fbank-1.16-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a42f525567485c34e470e6cc23ac4d0180804c9ed2eccaca7453ed20bcbe63fe |
|
MD5 | c58b16c5b0f9511cc593f63e2aff4341 |
|
BLAKE2b-256 | 8cec9d8cd7f4c4bb0bf3e2338b7ca3d5a56fb86a58a4d8fbdf6a6133ebef4b34 |
Hashes for kaldi_native_fbank-1.16-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0fed6ddbaf4138d4c19571ab8831e6b2c53f348c2550521f4c776ce3363169f2 |
|
MD5 | 1304e4391e6dfa050ed7d272e7a6b8f0 |
|
BLAKE2b-256 | 8236cae449751f1f440e5631af1b643739b9e0c2095428c84314c85913bf86a1 |
Hashes for kaldi_native_fbank-1.16-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6e6394af9fe8a4aac88160089208a7c905f54f0d06771bd20413380072445bfb |
|
MD5 | e154b26b55457a0e1ce118d272e239e4 |
|
BLAKE2b-256 | 968cd4ac8c196811f5a1d0282a6aea49862910ba92af17590f7e4ab7bd7f308d |
Hashes for kaldi_native_fbank-1.16-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 044e4b26daa25a78e1ed10594afcc46c1c2c34ba6b38b13a8d28a2013e53f92a |
|
MD5 | 87683e22c607e39a5d52f5e41d13a1a0 |
|
BLAKE2b-256 | 3346ada1997088abc39868163d0397c04c006922cc063f43977609af4e9c5566 |
Hashes for kaldi_native_fbank-1.16-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cff821ab2c88fce0bd5b5498b7298322e7f8a69a7c38c37482fb9fcdc0f835f1 |
|
MD5 | 772353c140122e6d0ee69c7be8aa2c53 |
|
BLAKE2b-256 | 52fbc38826ada60c52b977c98fef9e4a8c671d6e89568f12c72a5fbdfc700abb |
Hashes for kaldi_native_fbank-1.16-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 64fc392d0e6df2858726c93d4f5821dccbe0e0013a85285eecb823641a7e4422 |
|
MD5 | 9e20afc75e22c6abbf042a61dc4bf96e |
|
BLAKE2b-256 | 5e7d7c76f3253af13a7541c5588d9f135394f60edeedd0fd74fc9effeed78583 |
Hashes for kaldi_native_fbank-1.16-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | eaed82455daa9fa91de3793e66917c2addb91a085bc141b252ef0a832d256347 |
|
MD5 | b567b4466ee9d0ae4cb1049c15b4f734 |
|
BLAKE2b-256 | 45570a66636079b7190c0d61c5125f7a475fcab6a1d617a4b1a2e7bf6ae2fab5 |
Hashes for kaldi_native_fbank-1.16-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4ded155e945dfcaae6a006521ecf961609d718eaf778e88af113d2f628316595 |
|
MD5 | b19150bc0a53b6d6b57fb29ffda3151d |
|
BLAKE2b-256 | 8134e5055075d9c6adc22cfd95775b038eb8f4ab425b4e16e22553690b548946 |
Hashes for kaldi_native_fbank-1.16-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 934986d0eae0ebebf2434eeba3b9331e2acae98c71edb3af6ff9905712751e90 |
|
MD5 | 0bb0dd4f0b990fc2acc11dafba856090 |
|
BLAKE2b-256 | 89ce062375fb85d74c790889ca34f261b185e57e9b8f8fdd77491bd0a6c6ba80 |
Hashes for kaldi_native_fbank-1.16-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e9dcf12fb30962928bc6ad4e471db96965046d197a110517c4cfda1c84e04aaa |
|
MD5 | 98c8f15107cfd72c998bb3fff6ebf2b6 |
|
BLAKE2b-256 | ca88ae0e20aa531fb7c29aa641de0f3afc0a52f44cae50c1544f98de2a9a90d6 |
Hashes for kaldi_native_fbank-1.16-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 794f4b6878f7517138c2f612715e1648b2d29ec42ccced45e407d419aed2cceb |
|
MD5 | 7183765b5cce203afbc4bbd3f352ed56 |
|
BLAKE2b-256 | 12b6bf5dbc773f3aa736e052adb3d3a408b859992570710ef870ab8c0ef1fa51 |
Hashes for kaldi_native_fbank-1.16-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | acc171d862c4f395a7ddc8aedc0043721d2d488f49526ad08082ea4ebe7189c3 |
|
MD5 | 46d3c9542308512c5642a98d68b319ed |
|
BLAKE2b-256 | 888a0f7c90392d8857baf826c574316bd865c772e438682a3e5f95985b6b42d3 |
Hashes for kaldi_native_fbank-1.16-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e8ea999765497f1a009f4074fb44d2195616a6230e0e04f84e589b548a620e19 |
|
MD5 | 41ede5d954c91d8d5344b5d689c497be |
|
BLAKE2b-256 | af65a1f76e3ff492f07c1bfbcb15bf9e93f7f5b82b0fec66588e5eb22a3412a2 |
Hashes for kaldi_native_fbank-1.16-cp37-cp37m-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8c685a7929a307b1e72c9ae466112202952cda9304cdaa022a130a8d0d24afc9 |
|
MD5 | 45dc0b70622002d6bd81526a9d3bee9c |
|
BLAKE2b-256 | 6240022ca0735ca2f0ad36265fe07f9822ed85c569089736c0247b3370210cfd |
Hashes for kaldi_native_fbank-1.16-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c09b9dbe1e101363f826468dc3c1f55c2b3aa7c96486777d60792ac999f50d33 |
|
MD5 | b93ba08d04c00166a41fe2fb18a81996 |
|
BLAKE2b-256 | e7ade13ca387dfe40de472894971a9a0be76108388bd13163c2fe9aea4825214 |
Hashes for kaldi_native_fbank-1.16-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a59e72fbd8c6cd2fa32c794cdce0a5aa575e7501dee7401f507527527ed6e1f9 |
|
MD5 | 655aaa20a09b3bb0b4c932f1715ced6a |
|
BLAKE2b-256 | 5bf1230dfec094343ec8b892cc88a90d6c2d183b1f97ce90a0c0c11cb14dc572 |
Hashes for kaldi_native_fbank-1.16-cp36-cp36m-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 569f6a5c0365ff2e30867f3bf06ffdf5ec8985216583225999d492f68fda3ba4 |
|
MD5 | 482222c4b5c66840d04add794d56ad79 |
|
BLAKE2b-256 | b4fe2acfd1bc7233f01f6245a374cbe022bba07fb5dbca55d8ab316e3de36353 |
Hashes for kaldi_native_fbank-1.16-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4353ef28758147a8b84e3838c1f20b5f39e771f416f5b909a9f8b44f2f2b2152 |
|
MD5 | a663d738a2e51b8abc03241fce93e7fb |
|
BLAKE2b-256 | 4a85c09f65519c4418f6e9d1294b7297be037e837be6609facc0438f3a81dab6 |