Starting from:

$34.99

21AIE315 Lab 2 Solution


Name:…………………………
21AIE315 AI in Speech Processing

LABSHEET 2: Audio Processing with MatLab- An Introduction

Aim
➢ To understand the basic aspects of Digital Audio Signal Processing:


Continuous time and Discrete time Signals

A continuous-time signal takes on a value at every point in time, whereas a discrete-time signal is only defined at integer values of the “time” variable. However, while discrete-time signals can be easily stored and processed on a computer, it is impossible to store the values of a continuous-time signal for all points along a segment of the real line.

How then do we process continuous-time signals?









Nyquist Sampling Theorem

A continuous time signal can be represented in its samples and can be recovered back when sampling frequency fs is greater than or equal to the twice the highest frequency component of continuous time signal.

➢ Sampling frequency is the number of samples / second ➢ Sampling period 𝑇𝑠 = 𝑓 1𝑠

Plotting signals in MATLAB

The function plot (x, y) generates a 2-D plot of continuous time signal where the values of the vector x indicate points along the horizontal axis. The values in the vector y will be plotted on the vertical axis. Vectors x and y must have the same number of elements.

The function stem (x, y) plots discrete sequence data, X versus the columns of Y. X and Y are vectors or matrices of the same size. Additionally, X can be a row or a column vector and Y a matrix with length(X) rows.

Experiment1
I. Generate a 5 Hz sine wave, for a duration of 1 sec and plot it. (take t=[0:0.01:1])
II. Sample the signal at 1000 Hz sampling frequency and for a duration of 1 sec and plot the sampled signal.



Reading and Plotting Audio signals in MATLAB

The function audioread can be used to read audio files. The audioread function can support WAVE, OGG, FLAC, AU, MP3, and MPEG-4 AAC files. Specify the name of the file in filename, If the file is in the current folder. If the file is not in the current folder or in a folder on the MATLAB path, then specify the full or relative path name in filename.

Experiment2

I. Record a speech waveform. Read it using MATLAB. Plot the same waveform with x axis as time in seconds.

Play the Audio signals in MATLAB

To play an audio file in MatLab you use the sound() function. The following function plays the sound. If the Fs variable is not defined or included in the command, it will assume the default sample rate of 8192 Hz. sound(y,Fs);




Experiment3

I. Play the recorded speech waveform



Write the Audio signals to a file in MATLAB


To write an audio signal in Matlab you can use audiowrite(filename,y,Fs). It writes a matrix of audio data, y, with sample rate Fs to a file called filename. The filename input also specifies the output file format. The output data type depends on the output file format and the data type of the audio data

Experiment 4

I. Write the recorded speech waveform to a new file


Audio Scaling

To scale an audio file the soundsc() command is used. This allows for the modification of an audio signal’s amplitude or frequency. soundsc(y,Fs); To increase the volume of the audio track you can multiple the variable it is stored in by a scalar. To slow down or speed up the track played you can adjust the sampling rate. The command to reverse the order of the samples in a matrix is flipud(). Experiment with this command.

Experiment 5

I. Modify the parameters of your recorded speech waveform. Comment on your observations using different values.






More products