Package com.talixa.specan.fft

Examples of com.talixa.specan.fft.Complex


      // fill the data array
      for (int offset = 0; offset < FFT_LEN; offset++) {
        int desiredSampleIndex = (baseAddress)+offset;         
        short signedSample = data[desiredSampleIndex];                 
        double sample = ((double) signedSample) / (Short.MAX_VALUE);
        amplitudeData[offset] = new Complex(sample,0);
      }                             

      // run fft
      frequencyData = FFT.fft(amplitudeData);
                 
      if (shift < 0) {
        // downshift
       
        // calculate new 0
        int newZero = SharedDSPFunctions.getSampleNumberByFrequency(FFT_LEN, shift*-1);
       
        // shift new zero to zero
        for(int i = 0; i < FFT_LEN/2; ++i) {
          Complex value;
          if (i + newZero < FFT_LEN/2) {
            value = frequencyData[i+newZero];
          } else {
            value = new Complex(0,0);
          }
       
          frequencyData[i] = value;
          frequencyData[FFT_LEN-i-1] = value;
       
      } else {
        // calculate where to put the old 0
        int oldZero = SharedDSPFunctions.getSampleNumberByFrequency(FFT_LEN, shift);
       
        // upshift
        for(int i = FFT_LEN/2-1; i > 0 ; --i) {
          Complex value;
          if (i - oldZero > 0) {
            value = frequencyData[i-oldZero];
          } else {
            value = new Complex(0,0);
          }
       
          frequencyData[i] = value;
          frequencyData[FFT_LEN-i-1] = value;
       
View Full Code Here


    int numberSamples = samples.length;
    for(int baseAddress = 0; (baseAddress)+FFT_LEN <= numberSamples; baseAddress+=shiftValue) {     
      for (int offset = 0; offset < FFT_LEN; offset++) {       
        short signedSample = samples[baseAddress+offset];               
        double sample = ((double) signedSample) / Short.MAX_VALUE;
        amplitudeData[offset] = new Complex(sample,0);
      }
                       
      while (!playing) {         
        Thread.sleep(100);         
      }
View Full Code Here

      // fill the data array
      for (int offset = 0; offset < FFT_LEN; offset++) {
        int desiredSampleIndex = (baseAddress)+offset;         
        short signedSample = data[desiredSampleIndex];                 
        double sample = ((double) signedSample) / (Short.MAX_VALUE);
        amplitudeData[offset] = new Complex(sample,0);
      }                             

      // run fft
      frequencyData = FFT.fft(amplitudeData);
     
      // remove below low freq
      int removeBelow = SharedDSPFunctions.getSampleNumberByFrequency(FFT_LEN, filterBelowFreq);
      for(int i = 0; i < removeBelow; ++i) {
        frequencyData[i] = new Complex(0,0);
        frequencyData[FFT_LEN-i-1] = new Complex(0,0);
      }
     
      // remove above high freq     
      int removeAbove = SharedDSPFunctions.getSampleNumberByFrequency(FFT_LEN, filterAboveFreq);
      for(int i = removeAbove; i < frequencyData.length/2; ++i) {
        frequencyData[i] = new Complex(0,0);
        frequencyData[FFT_LEN-i-1] = new Complex(0,0);
      }                 
     
      // undo fft
      Complex[] filterFft = FFT.ifft(frequencyData);
     
View Full Code Here

      // fill the data array
      for (int offset = 0; offset < FFT_LEN; offset++) {
        int desiredSampleIndex = (baseAddress)+offset;         
        short signedSample = data[desiredSampleIndex];                 
        double sample = ((double) signedSample) / (Short.MAX_VALUE);
        amplitudeData[offset] = new Complex(sample,0);
      }                             

      // run fft
      frequencyData = FFT.fft(amplitudeData)
     
View Full Code Here

TOP

Related Classes of com.talixa.specan.fft.Complex

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.