generated from lks/eframe_template_android
Fix audio_fft outputing phase instead of magnitude
This commit is contained in:
parent
162220aa72
commit
24d9fc7972
@ -54,7 +54,12 @@ impl AudioFFT {
|
|||||||
.send(("FFT Output", PlotData::Bode32(fft_out.clone())))
|
.send(("FFT Output", PlotData::Bode32(fft_out.clone())))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
fft_in.clear();
|
fft_in.clear();
|
||||||
let output: Vec<u8> = fft_out.iter().map(|c| (c.arg() * 255.0) as u8).collect();
|
let output: Vec<u8> = fft_out
|
||||||
|
.iter()
|
||||||
|
.map(|c| {
|
||||||
|
(((c.re * c.re) + (c.im * c.im)).sqrt() / size as f32 * 255.0) as u8
|
||||||
|
})
|
||||||
|
.collect();
|
||||||
assert_eq!(output_len, output.len());
|
assert_eq!(output_len, output.len());
|
||||||
plot_tx
|
plot_tx
|
||||||
.send(("FFT Processed Output", PlotData::U8(output.clone())))
|
.send(("FFT Processed Output", PlotData::U8(output.clone())))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user