Monday, October 5, 2020

COMPRESSING THE RECORDED AUDIO USING Mu-Law



 %  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

CHECKING WHETHER THE SYSTEM IS STABLE OR NOT

  % SURAJ BASTOLA % % ==========CHECKING WHETHER SYSTEM IS STABLE OR NOT ================== % H(z) = (2z+0.5)/(z^2+0.5z-1) b = [2 0.5]; a=[1...