{"id":13822808,"url":"https://github.com/bytesnake/mfcc","last_synced_at":"2025-08-02T07:10:35.569Z","repository":{"id":57638368,"uuid":"188363911","full_name":"bytesnake/mfcc","owner":"bytesnake","description":"Calculate Mel Frequency Cepstral Coefficients from audio data in Rust","archived":false,"fork":false,"pushed_at":"2023-09-25T16:51:12.000Z","size":14,"stargazers_count":32,"open_issues_count":0,"forks_count":14,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-18T10:12:55.400Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bytesnake.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2019-05-24T06:19:54.000Z","updated_at":"2025-03-15T15:34:18.000Z","dependencies_parsed_at":"2023-09-26T04:41:51.279Z","dependency_job_id":null,"html_url":"https://github.com/bytesnake/mfcc","commit_stats":{"total_commits":10,"total_committers":1,"mean_commits":10.0,"dds":0.0,"last_synced_commit":"00f03ec4d9fb8311bbde58866cdce739ca4e0248"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bytesnake%2Fmfcc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bytesnake%2Fmfcc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bytesnake%2Fmfcc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bytesnake%2Fmfcc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bytesnake","download_url":"https://codeload.github.com/bytesnake/mfcc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244937751,"owners_count":20535124,"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":[],"created_at":"2024-08-04T08:02:18.575Z","updated_at":"2025-03-22T09:31:46.885Z","avatar_url":"https://github.com/bytesnake.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"# Mel Frequency Cepstral Coefficients\n\nA common pre-processing step in Machine Learning with audio signals is the application of a _Mel Frequency Cepstral Coefficients_ (MFCC) transformation. They compress the signal to a very small number of coefficients (around 16 for every 10ms) and decorrelates the signal to express only the transmission function (e.g. only the formants of an utterance not the pitch). This makes them very popular in Automatic Speech Recognition (ASR), Room Classification, Speaker Recognition etc. \n\n## Usage\nAdd this to your `Cargo.toml`\n``` toml\n[dependencies]\nmfcc = \"0.1\"\n```\n\nThe library can use two different FFT libraries. Either use `rustfft` (a pure rust FFT implementation) with the standard feature _fftrust_ or use `fftw` (a popular FFT library) with\n```toml\n[dependencies.mfcc]\nversion = \"0.1\"\ndefault-features = false\nfeatures = [\"fftextern\"]\n```\n\nA rough benchmark shows that their performance are comparable, for _FFTW_:\n```text\ntest tests::bench_mfcc ... bench:     123,959 ns/iter (+/- 22,979)\n```\nFor _rustfft_:\n```text\ntest tests::bench_mfcc ... bench:     162,603 ns/iter (+/- 35,914)\n```\n\n## How it works\n\nFirst you need to segment you audio data in chunks of around 10ms-20ms (max 1024 samples for 48kHz). From these you can calculate the MFCC coefficients with\n```rust\nuse mfcc::Transform;\nlet input = (0..1024).map(|x| ( 32000.0 * (x as f32 / 1024.0 * 20.0 * 3.1415).sin()) as i16).collect::\u003cVec\u003ci16\u003e\u003e();\nlet mut state = Transform::new(48000, 1024)\n    .nfilters(20, 40)\n    .normlength(10);\n\nlet mut output = vec![0.0; 20*3];\n\nstate.transform(\u0026input, \u0026mut output);\n```\n\nThis creates MFCCs for an input of 1024 samples of 48000kHz sample rate. They are converted with 40 Mel Filter banks into the cepstral domain and finally the first 20 of them are written to the output. Then first and second order derivatives are computed and they are normalized over a range of 10 sets (max for energy/mean for the rest).\n\n## License\n\nLicensed under either of\n\n- Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or \u003chttp://www.apache.org/licenses/LICENSE-2.0\u003e)\n- MIT license ([LICENSE-MIT](LICENSE-MIT) or \u003chttp://opensource.org/licenses/MIT\u003e)\n\nat your option.\n\n### Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally\nsubmitted for inclusion in the work by you, as defined in the Apache-2.0\nlicense, shall be dual licensed as above, without any additional terms or\nconditions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbytesnake%2Fmfcc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbytesnake%2Fmfcc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbytesnake%2Fmfcc/lists"}