h57555 s 00001/00001/00136 d D 1.9 23/09/21 12:51:07 bevans 9 8 c Updated e s 00005/00001/00132 d D 1.8 23/09/20 07:52:42 bevans 8 7 c Updated e s 00003/00000/00130 d D 1.7 23/09/19 15:52:49 bevans 7 6 c Updated e s 00001/00001/00129 d D 1.6 23/09/15 22:55:40 bevans 6 5 c y e s 00080/00054/00050 d D 1.5 23/09/15 21:18:55 bevans 5 4 c Updated e s 00032/00045/00072 d D 1.4 23/09/12 02:16:26 bevans 4 3 c y e s 00018/00000/00099 d D 1.3 21/09/17 17:37:24 bevans 3 2 c Updated e s 00014/00010/00085 d D 1.2 21/09/17 17:17:39 bevans 2 1 c Updated e s 00095/00000/00000 d D 1.1 21/09/16 21:42:31 bevans 1 0 c date and time created 21/09/16 21:42:31 by bevans e u U f i f e 0 t T I 1
E 8 D 4
D 4 In this problem, you'll estimate the pitch period of the recorded voice. The pitch period is the fundamental period T0. We can invert the pitch period to obtain the pitch frequency which is also the D 2 fundamental frequency f0. You'll be able to validate the estimate for by using the frequency-domain analysis in section 2.4. E 2 I 2 fundamental frequency f0 = 1 / T0. You'll be able to validate the estimate of the pitch frequency from section 2.3 with the frequency-domain analysis in section 2.4. E 2 Typically, the first peak in the plot of the magnitude of the Fourier series coefficients for positive frequencies is f0.
The spectrogram is showing the values in a matrix that has time along the horizontal dimension and frequency along the vertical dimension. D 4 So, you could automate finding the maximum value in the spectrogram after executing UTAudioFreqDomainAnalysis.m: E 4 I 4 Here is code to find the maximum value in a spectrogram: E 5 I 5 The Fourier series assumes the violin sound is periodic with periodicity N Ts seconds. Hence, the fundamental period is T0 = N Ts seconds and the fundamental frequency is
The FFT takes the vector of N samples for the recorded signal, and returns the N exponential Fourier series coefficients. E 5 E 4
D 5 spectValues = spectrogram(myRecording, blockSize, overlap, blockSize, fs, 'yaxis'); [maxValue, maxIndex] = max(abs(spectValues), [], 'all', 'linear'); [row,col] = ind2sub(size(spectValues), maxIndex); E 5 I 5 fourierSeriesCoeffs = fft(instrumentSound); E 5D 5 The maximum value (maxValue) occurs at (row, col) in matrix abs(spectValues). E 5 I 5 In the discrete-time case, we have a finite number of exponential Fourier series coefficients unlike the continuous-time Fourier series which has infinite terms. E 5
E 3 D 5 When computing the Fourier series coefficients for a continuous-time signal, we assume that the observed signal is the fundamental period of a periodic signal, whether it really is or not. This is also the case when working with a discrete-time signal, as we're doing with the recorded audio signal.
D 4 To compute the exponential Fourier series coefficients for our discrete-time signal, we'll use the Fast Fourier Transform (FFT). The FFT takes the vector of N samples for the recorded signal, and returns the N exponential Fourier series coefficients. In the discrete-time case, we have a finite number of Fourier series coefficients unlike the continuous-time Fourier series which has infinite terms. E 4 I 4 To compute the exponential Fourier series coefficients for our discrete-time signal, we'll use the Fast Fourier Transform (FFT). The FFT takes the vector of N samples for the recorded signal, and returns the N exponential Fourier series coefficients. In the discrete-time case, we have a finite number of Fourier series coefficients unlike the continuous-time Fourier series which has infinite terms. E 4
D 2 Here's the use of the fft function in MATLAB in line 11 of UTAudioFreqDomainAnalysis.m E 2 I 2 D 4 Here's the use of the fft function in MATLAB in line 11 of UTAudioFreqDomainAnalysis.m: E 2
E 4 fourierSeriesCoeffs = fft(myRecording);E 5 D 4 The first half of the
fourierSeriesCoeffs vector contains the Fourier series coefficients for non-negative frequencies, and the second half of the vector contains the Fourier series coefficients for negative frequencies.
E 4
I 4
The first half of the fourierSeriesCoeffs vector contains the Fourier
series coefficients for non-negative frequencies, and the second half of the vector
contains the Fourier series coefficients for negative frequencies.
E 4
D 5
D 4
Here are the first three elements of the fourierSeriesCoeffs vector. Recall that MATLAB starts indexing its vectors at index 1 instead of index 0:
E 4
I 4
Here are the first three elements of the fourierSeriesCoeffs vector.
Recall that MATLAB starts indexing its vectors at index 1 instead of index 0:
E 5
I 5
In Matlab, the first element is at index 1.
In fourierSeriesCoeffs,
E 5
E 4
I 5 The kth harmonic frequency is fk = k f0 where f0 = fs / N.
If the frequency is non-negative, then we can convert nonNegativeFrequency
to an FFT vector index into by
N = length(instrumentSound); f0 = fs / N; fftIndex = round(nonNegativeFrequency / f0) + 1;and compute
fftCoeffGain = abs(fourierSeriesCoeffs(fftIndex)); fftCoeffPhase = angle(fourierSeriesCoeffs(fftIndex));Please see Appendix A in the mini-project #1 assignment for more information about using the FFT to compute the Fourier series.
fourierSeriesCoeffs vector.
E 4
I 4
FFT shift command fftshift to swap the halves of the fourierSeriesCoeffs vector
so negative, zero, and positive frequencies are plotted.
E 4
D 4
fourierSeriesCoeffs vecor using the information in the section above
"Finding a harmonic frequency in the Fourier series coefficient vector".
E 5
I 5 In part (d), you're asked to find "for what range of time is the principal frequency present". The principal frequency is 261.63 Hz. You can zoom into the spectrogram to see over what time the principal frequency is present.
E 5
fourierSeriesCoeffs.
E 5
I 5
In part (a), you'll manually select the frequencies at the strongest peaks and
use the section "Finding a harmonic frequency in the Fourier series coefficient vector"
to find the Fourier series coefficient corresponding to that frequency.
E 5
D 2 When using the FFT, the gains for Ak will need to be multiplied by 1/T0 where T0 is the fundamental period (a.k.a. pitch period).
E 2
D 4
A common approach to parts (a) and (b) is to identify frequencies of the 10 peaks
in the plot of the magnitude of the Fourier series coefficients where the frequencies are
close to being harmonically related.
E 4
I 4
D 5
A common approach to part (a) is to identify frequencies of the peaks
in the plot of the magnitude of the Fourier series coefficients.
E 4
For each frequency, one can look up the Fourier series coefficient in the vector
fourierSeriesCoeffs and here's how.
D 4
First, we've recorded 1s of speech at a sampling rate of 8000 samples/s, which gives
a total of 8000 samples.
E 4
I 4
First, we have 38500 samples taken at a sampling rate of 11025 samples/s, which is about
3.5s in duration.
E 4
Because of this, the element at index n+1 in fourierSeriesCoeffs corresponds to a
D 4
frequency of n Hz for n in [0, 3999].
Once we have the Fourier coefficient, we can compute its magnitude Ak using the abs
command and its phase Phik using the angle command.
For part (b), after computing the magnitude and phase of the Fourier series coefficient,
each frequency would be changed to be a harmonic of an estimated value of the
fundamental frequency f0.
E 4
I 4
frequency of n (fs/N) in Hz or 0.2864n in Hz for n in [0, 19250).
Once we have the Fourier coefficient, we can compute its magnitude
Ak using the abs command and its phase Phik using the angle command.
E 5
I 5
In part (c), you'll need to determine the range of FFT indices that corresponds to a range
D 6
of frequencies from -7 Hz to 7 Hz.
E 6
I 6
of frequencies from -7.5 Hz to 7.5 Hz.
E 6
E 5
E 4
I 2
During playback of the synthesized signal, please use the soundsc command
instead of the sound command.
I 7
D 8
bevans@ece.utexas.edu
E 1