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

  • Home
  • SEARCH
  • 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 8895251
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T23:43:45+00:00 2026-06-14T23:43:45+00:00

I came across this snippet of code in a program that does real time

  • 0

I came across this snippet of code in a program that does real time FFT graph of audio data:

data=scipy.array(struct.unpack("%dB"%(bufferSize*2),data))
ffty=scipy.fftpack.fft(data)
ffty=abs(ffty[0:len(ffty)/2])/1000
ffty1=ffty[:len(ffty)/2]
ffty2=ffty[len(ffty)/2::]+2                
ffty2=ffty2[::-1]                
ffty=ffty1+ffty2                              
ffty=scipy.log(ffty)-2

I didn’t understand the math behind the part after the abs(). It does something like adding the first half of the magnitude array with the second half reversed, and 2 added.

Is this some kind of normalization?

This is the source:

http://www.swharden.com/blog/2010-03-05-realtime-fft-graph-of-audio-wav-file-or-microphone-input-with-python-scipy-and-wckgraph/

  • 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-14T23:43:46+00:00Added an answer on June 14, 2026 at 11:43 pm

    I don’t know Python but it looks like it’s just adding the magnitude of the two mirror image complex conjugate halves of the real-to-complex FFT output. You could just as easily take only the magnitude of the first half and multiply by 2.

    Finally it computes the log magnitude, presumably to get (scaled) dB values.

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

Sidebar

Related Questions

In the Pragmatic Core Data book, I came across this code snippet for an
I came across a jQuery snippet like this: selector.eventHandler(...some code...).eventHandler(...some code...); What does it
I came across this snippet of code on MSDN: entityBuilder.Metadata = @res://*/AdventureWorksModel.csdl| res://*/AdventureWorksModel.ssdl| res://*/AdventureWorksModel.msl;
I came across this strange code snippet which compiles fine: class Car { public:
I came across something peculiar today. Take a look at this code snippet: List
Im a newbie to python , and I came across this particular code snippet
I was looking at some PETSc example code, and I came across this snippet:
I came across this code snippet 1 int return_printChar1() { // code // oops!
I came across a code snippet like this: Timestamp expiryDate = Timestamp.valueOf(dateStr + +
in the book i'm learning from i came across this code snippit: while (i

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.