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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T19:27:07+00:00 2026-05-21T19:27:07+00:00

I’m currently working on this project that implies some DSP skills. I must extract

  • 0

I’m currently working on this project that implies some DSP skills.
I must extract the audio from a movie and then, by analyzing it, I must determine when someone speaks or not, more like an voice activity detector.

I’m writing the code in Java (yes, I know it’s not the best choice) and only use a library to extract the audio from the video and JLayer so I can process an MP3.

My class that extracts the audio samples gets the samples consecutively for each channel, in my case two: LEFT0, RIGHT0, LEFT1, RIGHT1, LEFT2, RIGHT2, etc.

So this is what I’ve done so far:

  • I put the samples for each channel in an array.
  • I apply a Hamming window [N = 8192]:

    double w = 0.54 - 0.46 * (Math.cos(2*Math.PI*buffer[i]/buffer.length-1));
    fftBuffer[i] = new Complex(w, 0);

  • I then perform a simple FFT on each channel and then compute the magnitude
    mag = re^2 + im^2; after that, I do a log scale (dB): mag_dB = 10 * log10(abs(mag));

Because I am “looking for voice” here, I need frequencies between 80 and 1000 (even tough the voice ranges between 80 Hz and 255 Hz). So, from the FFT I get a mirrored N = 8129 array from witch I need only the first N/2.

The frequency per bin (slot in the array resulted from the FFT) would be the sample rate (48.000 kHz)
/ N; that would be 48000 / 8192 = 5 Hz per bin. So I only look in the array at the values from FFT_Result[15] to FFT_Result[199] (16 * 5Hz = 80 Hz; 200 * 5 = 1000 Hz) right?!

I took a look on the frequency analyzer in Cool Edit Pro and all the amplitudes are negative. In my case, the first ones (the sound is in the background and isn’t loud) are negative, and after that, they are all positive. Aren’t they supposed to be negative? Am I missing out something over here?

So far, based on what I’ve remarked by looking at the frequency analyzer and phase analyzer in Cool Edit Pro, I need a threshold on this frequency range, some kind of algorithm to determine over a period of n milliseconds if the magnitude is constant over that frequency range and determine if the sound is centered. The last one must be done (I think) analyzing the phase angle, when someone speaks, the sound is always centered.

I didn’t manage to find a way to do that and I’m all confused with what I’ve done so far because I do not know if what I’ve done so far is right.

So, if you read all this, thank you for your patience and my questions are:
– have I done right what I’ve done so far?
– does the amplitude has to be negative?
– does anyone know how I can compute the phase for a number of samples?

  • 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-21T19:27:08+00:00Added an answer on May 21, 2026 at 7:27 pm

    In dB, the amplitude can be negative or positive, it doesn’t matter. What matters, is the value relative to some threshold. I would base the threshold on surrounding samples. Because the energy in spoken words goes up and down as syllables are spoken, a simple average (multiplied by some arbitrary factor you’ll have to play with to find what works well) would work fine as a threshold.

    For phase in the time domain, you can first take a Hilbert transform, and then use atan2 on the real and imaginary parts of each sample to estimate instantaneous phase.

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

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I am currently running into a problem where an element is coming back from
Does anyone know how can I replace this 2 symbol below from the string
I have some data like this: 1 2 3 4 5 9 2 6
I want use html5's new tag to play a wav file (currently only supported
link Im having trouble converting the html entites into html characters, (&# 8217;) i
this is what i have right now Drawing an RSS feed into the php,
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and

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.