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 8867763
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T17:07:09+00:00 2026-06-14T17:07:09+00:00

I am using Goertzel algorithm to get the amplitude of a certain frequency. I

  • 0

I am using Goertzel algorithm to get the amplitude of a certain frequency.
I am trying now to get the phase from it, and I don’t know how.

Can some one explain, and show me how to get the phase of a certain-f from this code?

Also, I am using it to 16khz, with sample rate 44.1. What’s the smallest length of samples that I can run it on?

double AlgorithmGoertzel( int16_t *sample,int sampleRate, double Freq, int len )
{
    double realW = 2.0 * cos(2.0 * M_PI * Freq / sampleRate);
    double imagW = 2.0 * sin(2.0 * M_PI * Freq / sampleRate);
    double d1 = 0;
    double d2 = 0;
    double y;
    for (int i = 0; i < len; i++) {
        y=(double)(signed short)sample[i] +realW * d1 - d2;
        d2 = d1;
        d1 = y;
    }
    double rR = 0.5 * realW *d1-d2;
    double rI = 0.5 * imagW *d1-d2;

    return (sqrt(pow(rR, 2)+pow(rI,2)))/len;
}
  • 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-06-14T17:07:10+00:00Added an answer on June 14, 2026 at 5:07 pm

    I don’t think the algorithm consists of multiplying the sequence by a constant, but by the complex signal exp(n*i*2pi*freq/samplerate); 0<=n<=length, and getting the average magnitude (or power of the signal).

    As the complex output is R*exp(i theta), R gives the power at the given frequency and theta gives the phase. (theta == atan2 ( imag, real))

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using Location.getBearing(); I seem to get randomly changing bearings. Aka, I can turn the
Using jQuery, how do I get the value from a textbox and then load
Using the HTML5 File API I can get the Binary String representation of a
Using NSDateComponents I know how to get the day component, but this gives me
Using C# .NET 3.5 and WCF, I'm trying to write out some of the
Using rubular.com as a guide, I am trying to get this expression to work
Using Java, how can I extract all the links from a given web page?
Using the NSXMLParser i can retrieve the data from the local XML file, but
Using MonoTouch, I'm trying to make a custom view, so I can reuse this
Using a CSS image sprite, I'm creating an 'interactive' image where hovering over certain

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.