Weird output with FFT + doesn't completely work


hi, i'm trying record music data guitar using fft.

what i've done :
  • i use schematic provided on page : https://www.arduino.cc/en/tutorial/knock. replace piezzo jack cable plugged female jack.
  • i use code below record each byte of data. it's pure copy / paste of 2 different codes found  :-*


code: [select]

#define log_out 1 // use log output function
#define fft_n 256 // set 256 point fft

#include <fft.h> // include library

void setup() {
  serial.begin(115200); // use serial port
  timsk0 = 0; // turn off timer0 lower jitter - delay() , millis() killed
  adcsra = 0xe5; // set adc free running mode
  admux = 0x40; // use adc03
  didr0 = 0x01; // turn off digital input adc0
}

void loop() {
  serial.write("begin");
  while(1) { // reduces jitter
    cli();  // udre interrupt slows way down on arduino1.0
    (int = 0 ; < 512 ; += 2) { // save 256 samples
      while(!(adcsra & 0x10)); // wait adc ready
      adcsra = 0xf5; // restart adc
      byte m = adcl; // fetch adc data
      byte j = adch;
      int k = (j << 8) | m; // form int
      k -= 0x0200; // form signed int
      k <<= 6; // form 16b signed int
      fft_input[i] = k; // put real data bins
      fft_input[i+1] = 0; // set odd bins 0
    }
    // window data, reorder, run, take output
    fft_window(); // window data better frequency response
    fft_reorder(); // reorder data before doing fft
    fft_run(); // process data in fft
    fft_mag_log(); // take output of fft
    sei(); // turn interrupts on
    serial.write(255); // send start byte
    (int i=0; i<fft_n/2; i++) {
      serial.print(i);
      serial.print(" ");
      serial.print(fft_log_out[i]);
    }
    serial.println("");
  }
}


i encounter 2 issues :
  • first 1 : results when nothing recorded non-sence still identical : ÿ0 2241 2082 743 564 445 436 377 378 249 3010 3011 3012 3013 3014 3015 3516 817 2418 2419 2420 2421 2722 2423 3024 2425 2426 3027 2728 2729 3030 2731 3032 033 834 1935 1936 837 838 2439 2440 041 1942 1943 2744 845 1946 1947 2748 049 2450 2451 1952 853 054 2455 1956 1957 1958 1959 1960 061 1962 1963 1964 065 866 067 068 869 870 871 072 873 074 075 076 877 078 079 1980 081 1982 883 1984 085 086 887 088 889 890 091 1992 2493 894 895 096 897 098 099 0100 0101 0102 0103 0104 0105 8106 8107 8108 0109 0110 0111 19112 8113 0114 0115 8116 0117 8118 8119 8120 8121 8122 8123 8124 19125 8126 8127 0
  • second 1 : if plug jack on guitar , play something, results don't change (= no signal received). if tap on jack, receive something.


any idea ?
(sorry if it's not clear, don't hesitate ask more details...)

it working correctly. intended send data fft pc process further , display results.

quote
i use code below record each byte of data
no, reading 10-bit adc values , storing them in fft_input array. once array full, fft.

code: [select]
   serial.write(255); // send start byte
    for (int i=0; i<fft_n/2; i++) {
      serial.print(i);
      serial.print(" ");
      serial.print(fft_log_out[i]);
    }


the "start byte" why first character ÿ. else decimal representation of contents of each bin number.

with reasonable set of input values, unlikely log_bin values in thousands. guess haven't connected audio input correctly.
post circuit diagram of how connected guitar audio adc pin.

pete


Arduino Forum > Using Arduino > Audio > Weird output with FFT + doesn't completely work


arduino

Comments

Popular posts from this blog

Flip address is out of range arduino uno r3

Arduino Uno not uploading

Indesign and MathType fonts