You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When trying to run the official resampling example - here, I'm getting some import errors.
Here the code:
// An example of using `sample` to efficiently perform decent quality sample rate conversion on a// WAV file entirely on the stack.use dasp::{interpolate::sinc::Sinc, ring_buffer, signal,Sample,Signal};use hound::{WavReader,WavWriter};fnmain(){// Find and load the wav.let assets = find_folder::Search::ParentsThenKids(5,5).for_folder("assets").unwrap();let reader = WavReader::open(assets.join("two_vowels.wav")).unwrap();// Get the wav spec and create a target with the new desired sample rate.let spec = reader.spec();letmut target = spec;
target.sample_rate = 10_000;// Read the interleaved samples and convert them to a signal.let samples = reader
.into_samples().filter_map(Result::ok).map(i16::to_sample::<f64>);let signal = signal::from_interleaved_samples_iter(samples);// Convert the signal's sample rate using `Sinc` interpolation.let ring_buffer = ring_buffer::Fixed::from([[0.0];100]);let sinc = Sinc::new(ring_buffer);let new_signal = signal.from_hz_to_hz(sinc, spec.sample_rateasf64, target.sample_rateasf64);// Write the result to a new file.letmut writer = WavWriter::create(assets.join("two_vowels_10k.wav"), target).unwrap();for frame in new_signal.until_exhausted(){
writer.write_sample(frame[0].to_sample::<i16>()).unwrap();}}
which gives:
error[E0433]: failed to resolve: could not find `interpolate` in `dasp`
--> src/main.rs:4:12
|
4 | use dasp::{interpolate::sinc::Sinc, ring_buffer, signal, Sample, Signal};
| ^^^^^^^^^^^ could not find `interpolate` in `dasp`
error[E0432]: unresolved imports `dasp::ring_buffer`, `dasp::signal`, `dasp::Signal`
--> src/main.rs:4:37
|
4 | use dasp::{interpolate::sinc::Sinc, ring_buffer, signal, Sample, Signal};
| ^^^^^^^^^^^ ^^^^^^ ^^^^^^ no `Signal` in the root
| | |
| | no `signal` in the root
| no `ring_buffer` in the root
error[E0433]: failed to resolve: use of undeclared crate or module `find_folder`
--> src/main.rs:9:18
|
9 | let assets = find_folder::Search::ParentsThenKids(5, 5)
| ^^^^^^^^^^^ use of undeclared crate or module `find_folder`
error[E0433]: failed to resolve: use of undeclared type `Sinc`
--> src/main.rs:28:16
|
28 | let sinc = Sinc::new(ring_buffer);
| ^^^^ use of undeclared type `Sinc`
When run in main.rs.
Do you know how to successfully fix it?
The text was updated successfully, but these errors were encountered:
Are you sure that you didn't forget the features attribute on dasp dependency in your cargo.toml.
To help debug, you can compare your cargo.toml with mine.
[package]
name = "dasp"version = "0.1.0"edition = "2018"# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
anyhow = "^1.0"cpal = "^0.13"dasp = {version = "^0.11", features= ["all"]}
hound = "^3.4"find_folder = "0.3"
Hey,
thanks a lot for the nice library!
When trying to run the official resampling example - here, I'm getting some import errors.
Here the code:
which gives:
When run in
main.rs
.Do you know how to successfully fix it?
The text was updated successfully, but these errors were encountered: