Fourier Analysis of a sound signal using Mathematica

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:
Thread 'Need help understanding this figure on energy levels'
This figure is from "Introduction to Quantum Mechanics" by Griffiths (3rd edition). It is available to download. It is from page 142. I am hoping the usual people on this site will give me a hand understanding what is going on in the figure. After the equation (4.50) it says "It is customary to introduce the principal quantum number, ##n##, which simply orders the allowed energies, starting with 1 for the ground state. (see the figure)" I still don't understand the figure :( Here is...
Thread 'Understanding how to "tack on" the time wiggle factor'
The last problem I posted on QM made it into advanced homework help, that is why I am putting it here. I am sorry for any hassle imposed on the moderators by myself. Part (a) is quite easy. We get $$\sigma_1 = 2\lambda, \mathbf{v}_1 = \begin{pmatrix} 0 \\ 0 \\ 1 \end{pmatrix} \sigma_2 = \lambda, \mathbf{v}_2 = \begin{pmatrix} 1/\sqrt{2} \\ 1/\sqrt{2} \\ 0 \end{pmatrix} \sigma_3 = -\lambda, \mathbf{v}_3 = \begin{pmatrix} 1/\sqrt{2} \\ -1/\sqrt{2} \\ 0 \end{pmatrix} $$ There are two ways...

Similar threads

Replies
12
Views
2K
Replies
11
Views
4K
Replies
1
Views
3K
Replies
2
Views
4K
Back
Top