Compare commits

..

No commits in common. "6445949083d18e37c9615bb913da5bcafcb4cbaa" and "24d9fc797297c902033d27343efa29268decf317" have entirely different histories.

2 changed files with 5 additions and 12 deletions

View File

@ -57,8 +57,7 @@ impl AudioFFT {
let output: Vec<u8> = fft_out
.iter()
.map(|c| {
(((c.re * c.re) + (c.im * c.im)).sqrt() / output_len as f32 * 255.0)
as u8
(((c.re * c.re) + (c.im * c.im)).sqrt() / size as f32 * 255.0) as u8
})
.collect();
assert_eq!(output_len, output.len());

View File

@ -71,7 +71,7 @@ impl DebugPlots {
plot_ui.line(line);
plot_ui.set_plot_bounds(PlotBounds::from_min_max(
[-1.0, -1.0],
[(v.len() + 1) as f64, core::u8::MAX as f64 + 1.0],
[(v.len() + 1) as f64, 256.0],
));
});
}
@ -79,25 +79,19 @@ impl DebugPlots {
ui.heading("Bode Plot");
let mag_line =
Line::new(PlotPoints::from_iter(v.iter().enumerate().map(|(i, c)| {
[
i as f64,
((c.re * c.re) + (c.im * c.im)).sqrt() as f64 / v.len() as f64,
]
[i as f64, ((c.re * c.re) + (c.im * c.im)).sqrt() as f64]
})));
let phase_line = Line::new(PlotPoints::from_iter(
v.iter()
.enumerate()
.map(|(i, c)| [i as f64, c.arg() as f64 / core::f64::consts::PI]),
.map(|(i, c)| [i as f64, c.arg() as f64]),
));
let plot = Plot::new(title);
plot.show(ui, |plot_ui| {
plot_ui.line(mag_line);
plot_ui.line(phase_line);
plot_ui.set_plot_bounds(PlotBounds::from_min_max(
[0.0, -1.0],
[(v.len() + 1) as f64, 1.0],
));
});
ui.heading("TODO");
}
};
});