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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T16:42:41+00:00 2026-06-02T16:42:41+00:00

I’ve been working with FFT, and I’m currently trying to get a sound waveform

  • 0

I’ve been working with FFT, and I’m currently trying to get a sound waveform from a file with FFT, (modify it eventually), but then output that modified waveform back to a file. I’ve gotten the FFT of the soundwave and then used an inverse FFT function on it, but the output file doesn’t sound right at all. I haven’t done any filtering on the waveform – I’m just testing out getting the frequency data and then putting it back into a file – it should sound the same, but it sounds wildly different.

I have since been working on this project a bit, but haven’t yet gotten desired results. The outputted sound file is noisy (both more loud, as well as extra noise that wasn’t present in the original file), and sound from one channel leaked into the other channel (which was previously silent). The input sound file is a stereo, 2-channel file with sound only coming from one channel. Here’s my code:

import scipy
import wave
import struct
import numpy
import pylab

from scipy.io import wavfile

rate, data = wavfile.read('./TriLeftChannel.wav')

filtereddata = numpy.fft.rfft(data, axis=0)
print(data)

filteredwrite = numpy.fft.irfft(filtereddata, axis=0)
print(filteredwrite)

wavfile.write('TestFiltered.wav', rate, filteredwrite)

I don’t quite see why this doesn’t work.

I’ve zipped up the problem .py file and audio file, if that can help solve the issue here.

  • 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-02T16:42:42+00:00Added an answer on June 2, 2026 at 4:42 pm
    >>> import numpy as np
    >>> a = np.vstack([np.ones(11), np.arange(11)])
    
    # We have two channels along axis 0, the signals are along axis 1
    >>> a
    array([[  1.,   1.,   1.,   1.,   1.,   1.,   1.,   1.,   1.,   1.,   1.],
           [  0.,   1.,   2.,   3.,   4.,   5.,   6.,   7.,   8.,   9.,  10.]])
    >>> np.fft.irfft(np.fft.rfft(a, axis=1), axis=1)
    array([[  1.1       ,   1.1       ,   1.1       ,   1.1       ,
              1.1       ,   1.1       ,   1.1       ,   1.1       ,
              1.1       ,   1.1       ],
           [  0.55      ,   1.01836542,   2.51904294,   3.57565618,
              4.86463721,   6.05      ,   7.23536279,   8.52434382,
              9.58095706,  11.08163458]])
    # irfft returns an even number along axis=1, even though a was (2, 11)
    
    # When a is even along axis 1, we get a back after the irfft.
    >>> a = np.vstack([np.ones(10), np.arange(10)])
    >>> np.fft.irfft(np.fft.rfft(a, axis=1), axis=1)
    array([[  1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
              1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
              1.00000000e+00,   1.00000000e+00,   1.00000000e+00,
              1.00000000e+00],
           [  7.10542736e-16,   1.00000000e+00,   2.00000000e+00,
              3.00000000e+00,   4.00000000e+00,   5.00000000e+00,
              6.00000000e+00,   7.00000000e+00,   8.00000000e+00,
              9.00000000e+00]])
    
    # It seems like you signals are along axis 0, here is an example where the signals are on axis 0
    >>> a = np.vstack([np.ones(10), np.arange(10)]).T
    >>> a
    array([[ 1.,  0.],
           [ 1.,  1.],
           [ 1.,  2.],
           [ 1.,  3.],
           [ 1.,  4.],
           [ 1.,  5.],
           [ 1.,  6.],
           [ 1.,  7.],
           [ 1.,  8.],
           [ 1.,  9.]])
    >>> np.fft.irfft(np.fft.rfft(a, axis=0), axis=0)
    array([[  1.00000000e+00,   7.10542736e-16],
           [  1.00000000e+00,   1.00000000e+00],
           [  1.00000000e+00,   2.00000000e+00],
           [  1.00000000e+00,   3.00000000e+00],
           [  1.00000000e+00,   4.00000000e+00],
           [  1.00000000e+00,   5.00000000e+00],
           [  1.00000000e+00,   6.00000000e+00],
           [  1.00000000e+00,   7.00000000e+00],
           [  1.00000000e+00,   8.00000000e+00],
           [  1.00000000e+00,   9.00000000e+00]])
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want use html5's new tag to play a wav file (currently only supported
I am trying to render a haml file in a javascript response like so:
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I am currently running into a problem where an element is coming back from
I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is

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.