pub fn new(fft:&dyn Fft<f32>, bufferlen:usize) -> WaveForm{
        let step = 2 as f64 * std::f64::consts::PI / bufferlen as f64;

        let mut buff = vec![Complex{re: 0f32, im: 0f32}; bufferlen]; // empty complex buffer
        for i in 0usize..bufferlen{
            //init as basic sine wave from 0->2pi in real component
            buff[i] = Complex{ re: ((i as f64) * step).sin() as f32, im: 0f32 };
        }
        let amp = buff.clone(); //save amplitude vals

        fft.process(&mut buff); //process in place
        let fseries = buff;
        return 
        WaveForm{
            fseries,
            amp,
        };
    }
//gen basic sin wave on construction
gen basic sin wave on construction
gen basic sin wave on construction
pub fn new(fft:&dyn Fft<f32>, bufferlen:usize) -> WaveForm{
        let step = 2 as f64 * std::f64::consts::PI / bufferlen as f64;
        let mut buff = vec![Complex{re: 0f32, im: 0f32}; bufferlen]; // empty complex buffer
        for i in 0usize..bufferlen{
            //init as basic sine wave from 0->2pi in real component
            buff[i] = Complex{ re: ((i as f64) * step).sin() as f32, im: 0f32 };
        }
        let amp = buff.clone(); //save amplitude vals
        fft.process(&mut buff); //process in place
        let fseries = buff;
        return 
        WaveForm{
            fseries,
            amp,
        };
    }
pub fn new ( fft : & dyn Fft < f32 > , bufferlen : usize ) -> WaveForm { let step = 2 as f64 * std :: f64 :: consts :: PI / bufferlen as f64 ; let mut buff = vec ! [ Complex { re 0f32 im 0f32 } bufferlen ] ; // empty complex buffer for i in 0usize .. bufferlen { //init as basic sine wave from 0->2pi in real component buff [ i ] = Complex { re : ( ( i as f64 ) * step ) . sin ( ) as f32 , im : 0f32 } ; } let amp = buff . clone ( ) ; //save amplitude vals fft . process ( & mut buff ) ; //process in place let fseries = buff ; return WaveForm { fseries , amp , } ; }
gen basic sin wave on construction
gen basic sin wave on construction
fft
&dyn Fft<f32>
bufferlen
usize