Title: Laboratory 1
1Laboratory 1
2Objectives
- To lean how to interface analogue signals to
digital systems - To learn how to process audio signals in embedded
systems. - Aim
- To develop a pitch tuner using an embedded system.
3Signal processing steps
- Capture signal by microphone
- Amplify the signal
- Feed to ADC of AMR7 micro.
- Convert to digital , find autocorrelation coeff.
- Find pitch
4Hardware system
RS232
Mic amp
ADC input ARM7
PC for display result
Mic
5Amplifier
- What is the best bias voltage at pin3(non-invert.
input) ? - Condenser MIC output impedance is 75 Ohms, why
this circuit is not a good design. How to correct
it? - Hint Input1KHZ, find impedance of C1 and input
of the amp. - Solution C1gt1uF, R21K, V3 100K(VR), use ,
one VR to replace VR1,2. Discuss why?
6Software Algorithm to find period1/frequency
7Auto-correlation to find rj0, rj1, rj2,
- The signal is s0,s1,..,s511
- Example jtime lag
- Auto-correlation coefficients rj r0, r1,..,
rn8, are
8Matlab example 1
- a1 3 9 3 2 3 8 3 2 ,
- r(xcorr(a)) ,round (r)
- Rr(jtime lag)
- r 2 9 35 60 96 72 86 123
190 123 86 72 96 60 35 9 17 2 - Exercise
- Verify by hand the first 3 (r j ) elements
after the signal overlapped with itself.
9Matlab Example1a1 3 9 3 2 3 8 3 2
,r(xcorr(a)) figure(1),clf,subplot(2,1,1)plot(
a),subplot(2,1,2)plot(r)
Data (a)
Period4,
Pick 2 peaks and measure period
Auto Corr. Xcorr (r)
The middle is the peak
10Since correlation is mirrored at the lag time
(j0) when the signal overlapped with itself
- Only positive time lag is considered
- Fundamental Periodj2
Auto correlation R(j)
Rthe_max (j1) Rsecond_max (j2)
Lag Time j in samples
j2
j10
11Matlab Example2ysin wave of 440 Hz
- dt0.0001
- time0dt2
- freq440
- nu2.0pifreq
- ysin(nutime) angular freq. (sin wave of 440
Hz) - r(xcorr(y))
- figure(2) , clf, subplot(2,1,1), plot(time,y)
- axis (0 0.01 -1 1)
- subplot(2,1,2), plot(time(1100),r(1100))
-
12Matlab Example2In fact any two peaks will give
you the answersine wave of 440
Hz,period0.0091-0.0068 (by inspection between 2
peaks)freq1/period434.7Hz
input Data (y)
Auto Corr. (r)
0.0068 0.0091
13Conclusion
- Studied a method of measuring the pitch of an
audio sound.