0% found this document useful (0 votes)
30 views

Program:: All All 'Audio48Khz - Wav'

This MATLAB program reads in an audio signal, normalizes it, then applies companding using mu-law compression. It calculates the signal-to-noise ratio (SNR) before and after companding, showing a significant increase from 7.42 to 321.07 dB with companding. The program then plots the original, normalized, companded, and expanded signals.

Uploaded by

sandesh2429
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views

Program:: All All 'Audio48Khz - Wav'

This MATLAB program reads in an audio signal, normalizes it, then applies companding using mu-law compression. It calculates the signal-to-noise ratio (SNR) before and after companding, showing a significant increase from 7.42 to 321.07 dB with companding. The program then plots the original, normalized, companded, and expanded signals.

Uploaded by

sandesh2429
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

PROGRAM:

clear all;
close all;
y=wavread('audio48kHz.wav');
y1=y./max(abs(y));
subplot(4,1,1);
plot(y);
title('Original Signal:');
subplot(4,1,2);
plot(y1);
title('Normalized Signal');
q=quant(y);
e=y-q;

var(q);
var(e);
SNR= 10*log10(var(q)/var(e))

%SNR WITH COMPANDING%

u=compand(y,255,1,'mu/compressor');
subplot(4,1,3);
plot(u);
title('Companded Signal:');

q1=quant(u);

e1=y-compand(u,255,1,'mu/expander');
f = compand(u,255,1,'mu/expander');

subplot(4,1,4);
plot(f);
title('Expanded Signal');

var(q1);
var(e1);
SNR1=10*log10(var(q1)/var(e1))

OUTPUT:
SNR without companding:

SNR =
7.4216
SNR with companding:

SNR1 =
321.0765
Original Signal:
1

-1
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5
5
x 10
Normalized Signal
1

-1
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5
5
x 10
Companded Signal:
1

-1
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5
5
x 10
Expanded Signal
1

-1
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5
5
x 10

You might also like