Question

In: Electrical Engineering

Write a matlab code to do following steps; i) Record your voice by sampling frequency 22...

Write a matlab code to do following steps;

i) Record your voice by sampling frequency 22 kHz

ii) Down sample the voice by 2 listen to your voice

iii) Down sample the voice by 3 listen to your voice

Please explain the code clearly. Thank you.

Solutions

Expert Solution

The steps include:

  1. Creating an audiorecorder object.
  2. Recording the voice.

(arec = audiorecorder(Fs, nbits, channels, id), for recording audio , where channels are 1 for mono and 2 for stereo)

  1. Extracting the data from the audiorecorder object.
  2. Reproducing audio data.

Matlab code:

clc;

clear all;

close all;

% set the parameters

fs=22050; % sampling frequency

nbits=16; % no of bits used to represent each sample

device_id= getfield(getfield(audiodevinfo, 'input'), 'ID');

audiorec = audiorecorder(Fs, nbits, 1, dev_id); % Creating the audiorecorder object

record(audiorec); % Now, speak into microphone

stop(audiorec);

data = getaudiodata(audiorec);% extracting recorded data

sound(data, Fs); % reproducing audio data

%downsampling voice by 2

fs1=fs/2;

audiorec = audiorecorder(Fs1, nbits, 1, dev_id); % Creating the audiorecorder object

speechplayer = play(audiorec); % Now, listen to the recording

stop(speechplayer);

data = getaudiodata(audiorec);

sound(data, Fs1); % reproducing audio data

%downsampling voice by 3

fs2=fs/3;

audiorec = audiorecorder(Fs2, nbits, 1, dev_id); % Creating the audiorecorder object

speechplayer = play(audiorec); % Now, listen to the recording

stop(speechplayer);

data = getaudiodata(audiorec);

sound(data, Fs2); % reproducing audio data


Related Solutions

Record your voice signal in mp3  or .dat format. Write a Matlab program to produce an echo...
Record your voice signal in mp3  or .dat format. Write a Matlab program to produce an echo signal. Critically analyze the system and find out the value of delay in milli seconds required to get a good echo effect on the recorded voice. Demonstrate the results by playing the signal using sound command in Matlab. I need command in matlab from recorded signal to eco-signal and delay and play
I'm new in MATLAB and I have to write a code in MATLAB which converts a...
I'm new in MATLAB and I have to write a code in MATLAB which converts a number from one base to another without using base2base, etc
Write a MATLAB code to obtain the following. Keep your code commented whenever required. Copy your...
Write a MATLAB code to obtain the following. Keep your code commented whenever required. Copy your source code and command widow outcomes and screen shots of any plots in your solution. Develop three functions for temperature-conversion. Create a function called F_to_K that converts and return temperatures in Fahrenheit to Kelvin and store results in ‘F_to_K2.txt’. Create a function called C_to_R that converts and return temperatures in Celsius to Rankine and store results in ‘C_to_R2.txt’. Create a function called C_to_F that...
Write a MATLAB code to obtain the following. Keep your code commented whenever required. Copy your...
Write a MATLAB code to obtain the following. Keep your code commented whenever required. Copy your source code and command widow outcomes and screen shots of any plots in your solution. Write a user defined function ‘My_FunctionGen’. It accepts, the time vector ‘t’ with 8000 uniformly spaced values within the range of 0 to 8, Frequecy scalars ‘f1<100H’ and ‘f2<80Hz’ and Amplitude scalars ‘A1’, ‘A2’ and ‘A3’ as input arguments. It delivers x1, x2 and x3 and x4 as outputs...
Write a MATLAB code to obtain the following. Keep your code commented whenever required. Copy your...
Write a MATLAB code to obtain the following. Keep your code commented whenever required. Copy your source code and command widow outcomes and screen shots of any plots in your solution. Generate the following vectors and also implement the Table-1 operations-map by employing the switch statement and an appropriate loop. Generate a vector ‘DEC1’ as follow. DEC1 = 5     1     3     0     2    5     0     2 Concatenate vector ‘DEC1’ eight times in order to obtain a bigger row vector ‘DEC’...
Write a MATLAB code to obtain the following. Keep your code commented whenever required. Copy your...
Write a MATLAB code to obtain the following. Keep your code commented whenever required. Copy your source code and command widow outcomes and screen shots of any plots in your solution. Develop three functions for temperature-conversion. Create a function called F_to_K that converts and return temperatures in Fahrenheit to Kelvin and store results in ‘F_to_K2.txt’. Create a function called C_to_R that converts and return temperatures in Celsius to Rankine and store results in ‘C_to_R2.txt’. Create a function called C_to_F that...
Matlab code for resonant frequency of coaxial cable
Matlab code for resonant frequency of coaxial cable  
Deep leraning/LSTM/Matlab There is a Matlab code that is doing the following steps for deep learning...
Deep leraning/LSTM/Matlab There is a Matlab code that is doing the following steps for deep learning and applying LSTM, I need to change first three steps to use our dataset to train this model and you don't need to change other. I need to apply that for .ogg audio files so Create and Use some audio files with .ogg format as sample data and give me the code. The following steps is for your information: Three classes of audio signals...
Matlab code problems I have to write a code using functions to find out if a...
Matlab code problems I have to write a code using functions to find out if a year is a leap year. I'm on the write track i feel like but I keep getting an error message and matlab isnt helping to troubleshoot. The issue is on line 30. Here is my code: function project_7_mfp() %   PROJECT_7_ABC   project_7_abc() creates a function that prompts the user %   enter a year after 1582 It then determines if it is a leap year %...
My projects is to write or find Matlab code for 4FSK(frequency shift keying) with simulation pictures...
My projects is to write or find Matlab code for 4FSK(frequency shift keying) with simulation pictures and create the signal after that add noise to it and finally demodulate it .. Please help me to do this project.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT