this is the code Problem 1110ptsl Using the provided program record sound.m reco
ID: 2268620 • Letter: T
Question
this is the code
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
I am explaining You the clear answer .So i did a project on this clear all; close all; clc; %assigmnet 1 % import a voice sample [y,Fs,nbit]=wavread('e.wav'); % divide left and right channel left=y(:,1); right=y(:,2); % calculate the time scale Ts=1/Fs; [nsamples,c]=size(y); tscale=0:Ts:(nsamples-1)*Ts; %plot left and right channel in time domain h1=figure(1) subplot(2,1,1) plot(tscale,left,'r'); xlabel('Time (sec)'); ylabel('Amplitude'); subplot(2,1,2) plot(tscale,right,'r'); xlabel('Time (sec)'); ylabel('Amplitude'); saveas(h1,'1.fig') % the left and right channel are equal h2=figure(2) plot(left-right); saveas(h1,'1.fig') %compute the FFT with the proper sampling frequency fmax=Fs; %how many points the FFT must be computed on? N=nsamples; tscale=0:Ts:(N-1)*Ts; %N=number of FFT points: % change it and test the different resolution fscale=linspace(0,fmax/2,floor(N/2)); spectrum=fft(left,N); %plot the spectrum of the signal using the appropriate % frequency scale and module of the coefficients plotSpectrum(fscale,spectrum); inf=200; % 200 Hz inf limit sup=5000; % 5000 Hz superior limit factor=[2,5,10]% amplification factors newcoeff=loudness2(fscale,spectrum,inf,sup,factor(1)); h=figure subplot(2,1,1) %plot the spectrum of the modified spectrum plotSpectrum(fscale,newcoeff); subplot(2,1,2) %plot the new signal in the time domain plotTime(tscale,ifft(newcoeff)); %listen to the result playFile(ifft(newcoeff),Fs,'loudenss1.wav') saveas(h,'loudness1.fig') %same procedure for the 2 factor newcoeff=loudness2(fscale,spectrum,inf,sup,factor(2)); h=figure subplot(2,1,1) plotSpectrum(fscale,newcoeff); subplot(2,1,2) plotTime(tscale,ifft(newcoeff)); playFile(ifft(newcoeff),Fs,'loudenss2.wav') saveas(h,'loudness2.fig') %same procedure for the last factor newcoeff=loudness2(fscale,spectrum,inf,sup,factor(3)); h=figure subplot(2,1,1) plotSpectrum(fscale,newcoeff); subplot(2,1,2) plotTime(tscale,ifft(newcoeff)); playFile(ifft(newcoeff),Fs,'loudenss3.wav') saveas(h,'loudness3.fig')
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.