Fourier Analysis of a sound signal using Mathematica

Click For Summary

Homework Help Overview

The discussion revolves around using Mathematica to analyze a sound signal by importing a .wmv file and creating its frequency spectrum. The original poster is exploring methods to filter certain frequencies and utilize the Inverse Fourier transform to reconstruct the signal.

Discussion Character

  • Exploratory, Conceptual clarification, Mathematical reasoning

Approaches and Questions Raised

  • Participants discuss how to create a filter to remove specific frequencies from the Fourier transform of the sound data. There are suggestions about manipulating the Fourier transform and using convolution techniques. The original poster also mentions challenges with the Inverse Fourier transform resulting in distorted signals.

Discussion Status

Some participants have provided guidance on using envelope functions instead of loops for filtering, and there is an ongoing exploration of how to effectively implement these ideas in Mathematica. Multiple approaches to filtering and reconstruction are being considered, but no consensus has been reached.

Contextual Notes

The discussion includes considerations of the limitations of Mathematica's handling of functions versus loops, and the complexities involved with real data in the context of filtering and signal reconstruction.

neoromeo
Messages
2
Reaction score
0

Homework Statement



I am trying to construct a Mathematica notebook that will be able to import sound in the form of a .wmv file and then create the frequency spectrum for a given time interval.

Homework Equations



I managed to complete this part, though I am trying to figure out:
a) How could I make a filter to cut off certain frequencies and then,
b) using the Inverse Fourier transform to rebuild the signal.

The Attempt at a Solution



The following code does the import and frequency analysis job.

Clear All

file = "C:\\SOUND\\adriana.wav";

data = Flatten@Import[file, "Data"];

Import[file, "Options"]

snd = Import[file, "Sound"]

Length[data]

SetOptions[ListLinePlot, ImageSize -> {500, 150}, AspectRatio -> 0.25,
PlotRange -> All];

SetOptions[ListPlot, ImageSize -> {500, 150}, AspectRatio -> 0.25,
PlotRange -> All];

ListLinePlot[data[[1 ;; 4820100 ;; 100]]]

ListLinePlot[Abs[Fourier[data[[500000 ;; 500000 + 88200]]]]]

ListLinePlot[Abs[Fourier[data[[200000 ;; 600000]]]][[1 ;; 600]]]


Thanks in advance :)
 
Physics news on Phys.org
neoromeo said:
a) How could I make a filter to cut off certain frequencies and then,
You have the Fourier transform of the input data - how would you manipulate that to cut off certain frequencies? (If you don't know the Mathematica functions for it, at least conceptually: how could you do this?)
neoromeo said:
b) using the Inverse Fourier transform to rebuild the signal.
Look at the Mathematica documentation for Fourier and it should point you to the proper function.
 
a) I guess I 'll have to make a loop that will check for the certain intensities on the frequency region I want to cut off and make everything zero. Another way could be the convolution of the original data with some other function, but it's getting tricky when it comes to real data.

b) Actually I managed to do the Inverse Fourier, though it's really distorted compared to the original, even for small time fragments... I have to clear the spectrum first and then try again.
 
Mathematica is generally better at working with functions than loops (or arrays, lists, etc.). So you should investigate using an envelope function. How would you construct the function? (Simple example: suppose you wanted to cut off all frequencies above 1000 Hz, what function would you use?)

Note that convolutions have a special relationship with Fourier transforms that make them very easy to compute.
 
Last edited:

Similar threads

  • · Replies 12 ·
Replies
12
Views
2K
  • · Replies 11 ·
Replies
11
Views
4K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 3 ·
Replies
3
Views
7K
Replies
1
Views
3K