ECE3340 Numerical Methods |
|
Fourier Tutorial Series - 2
time-dependent signals
ECE 3340 & generic Han Q. Le (c)
1. Fourier synthesis for time-dependent phenomena
1.1 Time-dependent signals
We have seen this previously
Both are made up of the same basis functions. Only the coefficients are different.
What if we make them to be time-signal instead of space-signal? Besides the “look,” what are other differences?
Numerical approach: coding a function using Block or Module to generate a time signal
Suppose we wish to generate a time-periodic signal,
what do we need to know:
1- the frequency: call it freq
2- the amplitude and phase: this is represented as the complex
amplitude of a phasor:
3- the sampling rate: how often do we sample the signal as output?
t is continuous, but there is no such a thing as a continuous
numerical array, we have to sample time with a finite set of
discrete sampling point. Let’s call it srate
4- duration: how long in time is the signal? The signal may be
forever, but numerically, there is a finite size of an array of
numbers to be generated.
So, below is an example of such a function, we call it signalgen for signal generator:
In[1]:=
Example how to use it: we will generate a random signal to test.
In[2]:=
Out[8]=
Now, we can apply to the two sets of coefficients:
In[9]:=
Out[16]=
1.2 Test signal difference as sound waves
In[18]:=
Out[18]=
Both have the same frequency, why do they sound difference?
1.3 Adding some more features
In[44]:=
In[45]:=
In[52]:=
Out[52]=
2. Review - the nature of sound
1.1 What is the nature of sound?
Sound in air
Sound in solid (on a solid surface)
See Tutorial 2.5
1.2 We made sound previously in Tutorial 2 (using computer)
Given:
Answer
In[5]:=
Out[12]=
In[2]:=
Out[2]=
The takeaways: How to get and look up reference info, data.
1.2.1 Use function Map.
We can define a function to generate a sound signal. Then use Map to play from a list.
Out[51]=
In[13]:=
In[14]:=
Out[15]=
In[3]:=
Out[3]=
3. Experimental sound analysis - harmonics
For this work, we need to import this app:
http://courses.egr.uh.edu/ECE/ECE3340/Apps/ECEgen_APP_PSD_analysis_M12_v0.nb
Notes about sound data analysis
import sound files from previous or elsewhere recordings
Example:
In[1]:=
entering data into the App
See instruction in class: Click “Direct data”, enter {dataname, samplerate} then, DO NOT HIT ENTER, just click elsewhere on side of the entry box of the app.
If analyzing sound data, make sure click this to select sound:
After toggling, the icon for sound should appear:
Follow instruction in class for analyzing the signal.
Do not open multiple windows of the same function, for example, do not open multiple linear scale spectrum windows. Mathematica computes dynamically (like games) and it would treat two windows sharing the same variables as a game between them.
The above applies to all cases in general , not just here.
3.1 Experiment 1: whistle
3.2 Experiment 2: a constant pitch vocal sound
Example
3.3 Experiment 3: same pitch, different vowels
from above, example 1:
another sound
different sound
and so on ...
4. Experimental sound analysis - musical instruments
4.1 Demo - spectrogram
HW: analyze instrument spectral difference.
In[31]:=
In[9]:=
In[10]:=
In[13]:=
In[12]:=
Out[12]=
In[15]:=
Out[15]=
4.2 Analysis of imported or pre-generated data (HW)
In[56]:=
Out[57]=
Use Spectral analysis app.
5. Experimental sound analysis - non-harmonic
5.1 Experiment 5.1: signal in noise
Search for needles in the haystack by doing this:
In[59]:=
Out[66]=
signal | noise | signal+noise |
Use the app to get the power spectral density of the final signal. On the linear scale, we see at least two definitive peaks above the noise floor.
Check their amplitude:
In[67]:=
Out[67]=
Compare them with noise:
In[73]:=
Out[74]=
In other words, the signal amplitudes are so small: {-0.033564,-0.093344,0.0016925} that they look just like zero compared to the noise. Yet, the spectrum function find them.
5.2 Experiment 5.2: random, ambience sounds
In[46]:=
Out[46]=
In[48]:=
Out[49]=
In[50]:=
Out[50]=
5.3 Experiment 5.3: the sound of silence
Get into system control of sound, set the microphone level to zero:
In[12]:=
Out[12]=
In[13]:=
Out[14]=
Why do we hear the sound of silence?
6. Experimental sound synthesis/analysis - random noise
In[11]:=
Out[12]=
Out[8]=
In[9]:=
Out[10]=
Use app to analyze spectrum
Wait, why there is no frequency? If there is no frequency, why is there a plot with ALL frequencies? what is the nature of the plot? where does the plot come from?
Lecture break - concept of spectrum