and this is the code you need to use thanks Problem 1110ptsl Using the provided
ID: 2268627 • Letter: A
Question
and this is the code you need to use
thanks
Problem 1110ptsl Using the provided program record sound.m record two different sounds (each eight seconds long). One of them ought to contain at least 5 words of your choosing (a sentence). The other one should be a music of your choosing. You may rename the my_sound.wav file generated e program after recording the first time around in order to avoid re-writing it (so that you have two separate wave files that you can manipulate) Create a script file called run_sound processing.m and start by reading in those two wave files into two different variables. Note that the sampling frequency should be the same (8K samples/sec) for both recording since you made use of the same program to generate the wave files. You are to replace the quite instances (instances between words of first recording) with segments of the second recording. As you play the end-result, you should hear a word followed by music, another word followed by music and so on. Note that you don't want to crop long segments of music as you need to ensure that there are enough segments to be inserted for all 5 words Additionally, do provide a plot where the end-result is plotted against sample indices into e subplot and another one where the end-result is plotted against time in seconds. Use different colors to show the two recordings (e.g., red for the ones corresponding to words and blue for the ones corresponding to music segment). Make sure to label your plots and assign a legend. Do make sure to include all your files when submitting your work (including the.wav files)Explanation / Answer
clear all; close all; clc;
% Sampling frequency
fs = 8000;
% Set up recording object
my_sound = audiorecorder(fs,16,1);
% pause for user input
disp('Press Any Key to Start Recording ....')
pause
tic % start time
% Record for 8 seconds
recordblocking(my_sound, 8);
toc % end time
% Output the acquired data into workspace as double precision array, x
my_sound = getaudiodata(my_sound, 'double');
% play recorded sound
soundsc(my_sound,fs);
% you can save it as a wave file using the syntax below
audiowrite('my_sound.wav',my_sound,fs);
my code
rec1 = audiorecorder;
recordblocking(rec1, 15);
play(rec1);
and the second one is
AI = analoginput('winsound');
>> addchannel(AI, 1);
>>fs=11000
>> set (AI, 'SampleRate', fs)
>> t=10
>> set(AI, 'SamplesPerTrigger', t*fs);
>> start(AI);
>> data = getdata(AI);
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.