From 991849b32acf83dd14a5096540bb053d2572502a Mon Sep 17 00:00:00 2001 From: Wavy Harp Date: Sun, 7 May 2023 23:04:53 -0600 Subject: initial import 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~ --- src/bin/testrfft.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 src/bin/testrfft.rs (limited to 'src/bin/testrfft.rs') 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 = 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); + } +} -- cgit v1.1