Crates.io | cepstrum-extractor |
lib.rs | cepstrum-extractor |
version | 0.1.4 |
source | src |
created_at | 2024-06-15 22:30:25.250065 |
updated_at | 2024-11-20 17:02:15.409769 |
description | An easy-to-use crate to compute the cepstrum of a signal. |
homepage | |
repository | https://github.com/Skilvingr/rust-cepstrum-extractor |
max_upload_size | |
id | 1273165 |
size | 8,581,668 |
An easy-to-use crate to compute the cepstrum of a signal.
For more info about the concept of cepstrum, here's the original paper.
Quite a simple crate: create a [CepstrumExtractor
] with a given length and
use it to compute real or complex cepstrum of a signal.
The extractor accepts a slice of Complex as input, [RealToComplex::to_complex_vec
]
creates a new vec of Complex starting from a slice of f32
or f64
.
Such slices also implement traits with windowing functions, at the moment only
one is available: [Hann
].
As for spectrums, only the first half of the result of a fft has meaningful values. Cepstrums are computed with a fft, so here it's the same.
Methods that return a vec already truncate the result to half the input slice,
but *_mut
methods, the ones which mutate the slice passed as input, clearly can't,
so pay attention to what you do when using these methods.
Given a CepstrumExtractor
with len equal to 128
, rceps_mut
mutates the
input slice (long 128 samples as well), but only the first 64
samples of
the mutated slice really represent the cepstrum.
This crate can also be used in a concurrent environment. Only one instance
of the extractor is needed, and that can be shared between the threads with
a simple Arc
; more info about this are available in the relative docs page.
An example can be found within example
folder, under the name concurrent
.
Miri test can be found within script
.
The following commands must be run starting from the root of the crate.
Tests can be run with:
cargo test
Concurrent example can be run with:
cargo run --example concurrent
Other examples can be run with:
RUSTFLAGS="--cfg examples" cargo run --example `example_name`