diff options
author | Wavy Harp <wavyharp@gmail.com> | 2023-05-07 23:04:53 -0600 |
---|---|---|
committer | Kyle McFarland <tfkyle@gmail.com> | 2023-05-07 23:04:53 -0600 |
commit | 991849b32acf83dd14a5096540bb053d2572502a (patch) | |
tree | 279b59d75d4ad6081f5242cf77d843ae6b37fc3d /src/bin/testrfft.rs | |
download | rustynotes-991849b32acf83dd14a5096540bb053d2572502a.zip rustynotes-991849b32acf83dd14a5096540bb053d2572502a.tar.gz rustynotes-991849b32acf83dd14a5096540bb053d2572502a.tar.bz2 |
currently everything is very tied to alsa and my system,
for the moment you'll need to manually change the device names
and maybe channels/period_size in src/main.rs, src/bin/smolguitar.rs
and src/bin/loopbacker.rs, i'll fix that and add runtime period
size/updater allocation soon, (and probably make a cpal backend as well
so it can work on other platforms), but doing this initial commit to play
around with stereo for now~
Diffstat (limited to 'src/bin/testrfft.rs')
-rw-r--r-- | src/bin/testrfft.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/bin/testrfft.rs b/src/bin/testrfft.rs new file mode 100644 index 0000000..ee8c72f --- /dev/null +++ b/src/bin/testrfft.rs @@ -0,0 +1,20 @@ +use realfft::{RealFftPlanner, FftNum, RealToComplex}; + +fn main() { + let mut planner: RealFftPlanner<f32> = RealFftPlanner::new(); + //let rfft = planner.plan_fft_forward(4); + let rfft = planner.plan_fft_forward(40); + let mut scratch = rfft.make_scratch_vec(); + let mut out_data = rfft.make_output_vec(); + //let mut in_data = [1., 0.4, 0.3, -1.]; + let mut in_data = [1.; 40]; + //let mut in_data = [ + rfft.process_with_scratch(&mut in_data, &mut out_data, &mut scratch).unwrap(); + println!("{:?}", &out_data); + let scale = 1./40.; + for elem in out_data { + println!("{}", elem.norm_sqr().sqrt() * scale); + println!("{}", elem.l1_norm() * scale); + //println!("{}", elem * scale); + } +} |