{"id":15640607,"url":"https://github.com/csukuangfj/kaldi-native-fbank","last_synced_at":"2025-04-12T19:49:20.825Z","repository":{"id":57887920,"uuid":"527990119","full_name":"csukuangfj/kaldi-native-fbank","owner":"csukuangfj","description":"Kaldi-compatible online fbank extractor without external dependencies","archived":false,"fork":false,"pushed_at":"2024-10-24T12:14:01.000Z","size":155,"stargazers_count":75,"open_issues_count":0,"forks_count":21,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-10-25T06:43:35.315Z","etag":null,"topics":["cpp","fbank","kaldi-compatible","online-fbank","python"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/csukuangfj.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-08-23T12:53:35.000Z","updated_at":"2024-10-24T12:10:39.000Z","dependencies_parsed_at":"2024-04-13T07:37:56.710Z","dependency_job_id":"a0148707-90cc-480f-9dd2-a601c63b4453","html_url":"https://github.com/csukuangfj/kaldi-native-fbank","commit_stats":{"total_commits":56,"total_committers":3,"mean_commits":"18.666666666666668","dds":0.0357142857142857,"last_synced_commit":"7be9151d8c7428457356e006eb8b5fe548a69a40"},"previous_names":[],"tags_count":31,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csukuangfj%2Fkaldi-native-fbank","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csukuangfj%2Fkaldi-native-fbank/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csukuangfj%2Fkaldi-native-fbank/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csukuangfj%2Fkaldi-native-fbank/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/csukuangfj","download_url":"https://codeload.github.com/csukuangfj/kaldi-native-fbank/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248625501,"owners_count":21135513,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cpp","fbank","kaldi-compatible","online-fbank","python"],"created_at":"2024-10-03T11:38:27.313Z","updated_at":"2025-04-12T19:49:20.795Z","avatar_url":"https://github.com/csukuangfj.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Introduction\n\nKaldi-compatible online fbank feature extractor without external dependencies.\n\nTested on the following architectures and operating systems:\n\n  - Linux\n  - macOS\n  - Windows\n  - Android\n  - x86\n  - arm\n  - aarch64\n\n# Usage\n\nSee the following CMake-based speech recognition (i.e., text-to-speech) projects\nfor its usage:\n\n- \u003chttps://github.com/k2-fsa/sherpa-ncnn\u003e\n  - Specifically, please have a look at \u003chttps://github.com/k2-fsa/sherpa-ncnn/blob/master/sherpa-ncnn/csrc/features.h\u003e\n- \u003chttps://github.com/k2-fsa/sherpa-onnx\u003e\n\nThey use `kaldi-native-fbank` to compute fbank features for **real-time**\nspeech recognition.\n\n# Python APIs\n\nFirst, please install `kaldi-native-fbank` by\n\n```bash\ngit clone https://github.com/csukuangfj/kaldi-native-fbank\ncd kaldi-native-fbank\npython3 setup.py install\n```\n\nor use\n\n```bash\npip install kaldi-native-fbank\n```\n\nTo check that you have installed `kaldi-native-fbank` successfully, please use\n\n```\npython3 -c \"import kaldi_native_fbank; print(kaldi_native_fbank.__version__)\"\n```\n\nwhich should print the version you have installed.\n\nPlease refer to\n\n  - \u003chttps://github.com/csukuangfj/kaldi-native-fbank/blob/master/kaldi-native-fbank/python/tests/test_online_fbank.py\u003e\n  - \u003chttps://github.com/csukuangfj/kaldi-native-fbank/blob/master/kaldi-native-fbank/python/tests/test_online_mfcc.py\u003e\n\nfor usages.\n\nFor easier reference, we post the above file below:\n\n```python3\n#!/usr/bin/env python3\n\nimport sys\n\ntry:\n    import kaldifeat\nexcept:\n    print(\"Please install kaldifeat first\")\n    sys.exit(0)\n\nimport kaldi_native_fbank as knf\nimport torch\n\n\ndef main():\n    sampling_rate = 16000\n    samples = torch.randn(16000 * 10)\n\n    opts = kaldifeat.FbankOptions()\n    opts.frame_opts.dither = 0\n    opts.mel_opts.num_bins = 80\n    opts.frame_opts.snip_edges = False\n    opts.mel_opts.debug_mel = False\n\n    online_fbank = kaldifeat.OnlineFbank(opts)\n\n    online_fbank.accept_waveform(sampling_rate, samples)\n\n    opts = knf.FbankOptions()\n    opts.frame_opts.dither = 0\n    opts.mel_opts.num_bins = 80\n    opts.frame_opts.snip_edges = False\n    opts.mel_opts.debug_mel = False\n\n    fbank = knf.OnlineFbank(opts)\n    fbank.accept_waveform(sampling_rate, samples.tolist())\n\n    assert online_fbank.num_frames_ready == fbank.num_frames_ready\n    for i in range(fbank.num_frames_ready):\n        f1 = online_fbank.get_frame(i)\n        f2 = torch.from_numpy(fbank.get_frame(i))\n        assert torch.allclose(f1, f2, atol=1e-3), (i, (f1 - f2).abs().max())\n\n\nif __name__ == \"__main__\":\n    torch.manual_seed(20220825)\n    main()\n    print(\"success\")\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcsukuangfj%2Fkaldi-native-fbank","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcsukuangfj%2Fkaldi-native-fbank","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcsukuangfj%2Fkaldi-native-fbank/lists"}