% SURAJ BASTOLA %%%%%%%%%%%%
%%% COMPRESSING THE RECORDED AUDIO USING Mu-LAW%%%%%%
% IN MATLAB, Fs takes default value of 8000
% ===================== Syntax: out = compand(in,Mu,v,'mu/compressor') =======================================================
clc;
close all;
[y,Fs] = audioread('C:\Users\suraj\OneDrive\Documents\MIT COLLEGE\Software Defined Radio Communication\MATLAB COding\audioRecorded.wav');
z = abs(fft(y));
disp(z);
figure(1)
subplot(2,2,1)
plot(y)
title('Recorded Audio')
subplot(2,2,2)
plot(z)
title('FFT of Recorded Audio')
% Mu = 255
compressed = compand(y,255,max(y),'mu/compressor'); % out = compand(in,Mu,v) implements a µ-law compressor for the input vector in. Mu specifies µ, and v is the input signal's maximum magnitude. out has the same dimensions and maximum magnitude as in.
x = abs(fft(compressed));
disp(x);
subplot(2,2,3)
plot(compressed)
title('Compressed Audio')
subplot(2,2,4)
plot(x)
title('FFT of Compressed Audio')
sgtitle('Compressing audio using Mu- law');
No comments:
Post a Comment