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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T21:30:50+00:00 2026-06-11T21:30:50+00:00

I am working on a project that requires me to take an input, perform

  • 0

I am working on a project that requires me to take an input, perform an DFT (Discrete fourier transform) and then take the number of zero-crossings from these values.

I have coded an algorithm, but, it uses complex numbers and I don’t know how to manipulate / perform calculations on them. Here is the code:

#include <iostream>
#include <complex>
#include <vector>

using namespace std;

const double PI = 3.14159265358979323846;

vector< complex<double> > DFT(vector< complex<double> >& theData)
{
    // Define the Size of the read in vector
    const int S = theData.size();

    // Initalise new vector with size of S
    vector< complex<double> > out(S, 0);
    for(unsigned i=0; (i < S); i++)
    {
        out[i] = complex<double>(0.0, 0.0);
        for(unsigned j=0; (j < S); j++)
        {
            out[i] += theData[j] * polar<double>(2, (-2 * PI * i * j / S));
        }
    }

    return out;
}

int main(int argc, char *argv[]) {
    vector< complex<double> > numbers;

    numbers.push_back(128);
    numbers.push_back(127);

    vector< complex<double> > testing = DFT(numbers);

    for(unsigned i=0; (i < testing.size()); i++)
    {
        cout << testing[i] << endl;
    }
}

Now if I wanted to perform for example:

if(testing[i] >= 0)
{
    // blah blah
}

Then it will return an error. Any ideas, or suggestions? Is it possible to create a DFT without using Complex Numbers?

  • 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-11T21:30:51+00:00Added an answer on June 11, 2026 at 9:30 pm

    Whoever gave you your instructions wasn’t telling you to count zero crossings on the results of the DFT/FFT. That would be meaningless. (If they were telling you to do that, they were clueless. You have my permission to laugh at them for giving you such ridiculous instructions). Rather they were telling you to count zero crossings on the original data, and also look at the FFT of your data.

    However,

    • Zero crossing rate is a pretty crappy starting point for speech recognition. Maybe you can get somewhere with it. With only slight hyperbole, I can say zero crossing is the least robust DSP analysis you can do. However, it is also simple, and speech recognition research has been going on a long time, so maybe there’s some research on it. UPDATE/CORRECTION: this is a bit of a hyperbole. Actually I believe a lot of speech recognition techniques DO use zero-crossing, but you should know what you are doing first, because it’s not very robust and sensitive to many kinds of errors like octave-errors. When you use zero-crossing, it’s a good idea to low-pass (maybe aggressively) first. Definitely consider other factors.

    • Understanding the output of an FFT is something that’s asked so often here that I wrote a blog entry. Usually people are trying to track pitch, and you should do that, too actually, but there’s other stuff you can get from the FFT like frequency centroid, and the relative strengths of different frequencies that are important in speech. Start here: http://blog.bjornroche.com/2012/07/frequency-detection-using-fft-aka-pitch.html

    • You might also want to consider simply filtering important speech frequencies (to find out what these are, start with wikipedia entry on “manner of articulation”. For example, by following the link to Sibilant, you’ll learn that “[s] has the most acoustic strength at around 8,000 Hz”. Neeto!) You can get that info from an FFT or by filtering. There are advantages and disadvantages to each. You may want to look into the speech recognition literature to see what they use.

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

Sidebar

Related Questions

I'm working on a project that will require me to take various .vbproj and
I'm working on a project that requires to convert html email into text. Below
I am working on a project that requires me to define a DSL. Since
I'm working on a project that requires a fair bit of inserting/updating rows in
I am working on a project that requires some image processing. The front end
Currently am working on a project that requires me to create some XML for
I'm working on a project that requires me to programmatically create MySQL users from
I'm working on a project that requires a Web-based workflow application. We're now evaluating
I am currently working on a project that requires me to display PDF documents
I am currently working on a project that requires the rackup command on ubuntu

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.