Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6671391
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:22:59+00:00 2026-05-26T03:22:59+00:00

I have recorded an array[1024] of data from my mic on my Android phone,

  • 0

I have recorded an array[1024] of data from my mic on my Android phone, passed it through a 1D forward DFT of the real data (setting a further 1024 bits to 0). I saved the array to a text file, and repeated this 8 times.

I got back 16384 results. I opened the text file in Excel and made a graph to see what it looked like(x=index of array, y=size of number returned). There are some massive spikes (both positive and negative) in magnitude around 110, 232, and small spikes continuing in that fashion until around 1817 and 1941 where the spikes get big again, then drop again.

My problem is that wherever I look for help on the topic it mentions gettng the real and imaginary numbers, I only have a 1D array, that I got back from the method I used from Piotr Wendykier’s class:

DoubleFFT_1D.realForwardFull(audioDataArray); // from the library JTransforms.

My question is: What do I need to do to this data to return a frequency?
The sound recorded was me playing an ‘A’ on the bottom string (5th fret) of my guitar (at roughly 440Hz) .

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T03:22:59+00:00Added an answer on May 26, 2026 at 3:22 am

    The complex data is interleaved, with real components at even indices and imaginary components at odd indices, i.e. the real components are at index 2*i, the imaginary components are at index 2*i+1.

    To get the magnitude of the spectrum at index i, you want:

    re = fft[2*i];
    im = fft[2*i+1];
    magnitude[i] = sqrt(re*re+im*im);
    

    Then you can plot magnitude[i] for i = 0 to N / 2 to get the power spectrum. Depending on the nature of your audio input you should see one or more peaks in the spectrum.

    To get the approximate frequency of any given peak you can convert the index of the peak as follows:

    freq = i * Fs / N;
    

    where:

    freq = frequency in Hz
    i = index of peak
    Fs = sample rate in Hz (e.g. 44100 Hz, or whatever you are using)
    N = size of FFT (e.g. 1024 in your case)
    

    Note: if you have not previously applied a suitable window function to the time-domain input data then you will get a certain amount of spectral leakage and the power spectrum will look rather "smeared".


    To expand on this further, here is pseudo-code for a complete example where we take audio data and identify the frequency of the largest peak:

    N = 1024          // size of FFT and sample window
    Fs = 44100        // sample rate = 44.1 kHz
    data[N]           // input PCM data buffer
    fft[N * 2]        // FFT complex buffer (interleaved real/imag)
    magnitude[N / 2]  // power spectrum
    
    // capture audio in data[] buffer
    // ...
    
    // apply window function to data[]
    // ...
    
    // copy real input data to complex FFT buffer
    for i = 0 to N - 1
      fft[2*i] = data[i]
      fft[2*i+1] = 0
    
    // perform in-place complex-to-complex FFT on fft[] buffer
    // ...
    
    // calculate power spectrum (magnitude) values from fft[]
    for i = 0 to N / 2 - 1
      re = fft[2*i]
      im = fft[2*i+1]
      magnitude[i] = sqrt(re*re+im*im)
    
    // find largest peak in power spectrum
    max_magnitude = -INF
    max_index = -1
    for i = 0 to N / 2 - 1
      if magnitude[i] > max_magnitude
        max_magnitude = magnitude[i]
        max_index = i
    
    // convert index of largest peak to frequency
    freq = max_index * Fs / N
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have made Iphone applicatio. In my application whatever data i have recorded; all
I have data being recorded every 15 minutes into the PowerStringHistorys and PowerCombinerHistorys tables.
I have an array of int samples ranging from 32766 to -32767. In part
I have the following code which pulls json data from an ASP.NET page and
I have recorded real-time stock quotes in an SQL database with fields Id ,
I have recorded a macro with me selecting a project and removing it from
I have a table which contains data recorded every minute, so I have a
I have app in which i have recorded sound files i want that i
I have a file with a bunch of lines. I have recorded a macro
I want to check my database for records that I already have recorded before

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.