Professional Documents
Culture Documents
Lab #2
ECE140
%
Lab #2
clear
close all
Nsec = 3;
bits = 12;
The
number
of
quantization
levels
may
be
adjusted
by
changing
the
value
of
bits.
On
the
following
line
put
in
the
name
of
the
wav
file
that
you
want
to
manipulate,
salinas.wav
is
a
guitar
recording
I
posted
on
the
website.
This
is
a
good
recording
with
which
to
experiment
because
there
are
many
quiet
intervals
between
the
notes.
Also
experiment
with
your
recording
of
yourself
speaking.
Reduce
the
number
of
bits
by
1
or
2
bit
increments
all
the
way
down
to
1-bit.
For
both
recorded
speech
and
the
music
files
-
at
what
bit
resolution
do
the
quantization
effects
become
audible?
Describe
the
audible
effects
in
both
the
spoken
and
music
files
at
the
different
bit-resolution
levels.
Can
you
still
recognize
the
sound
at
4-bit
and
2-bit
(even
1-bit)
quantization?
Construct
a
table
of
the
Signal
to
Noise
Ratio
(in
decibels)
for
bit
resolutions
from
1
bit
to
16
bits.
(each
additional
bit
is
a
6
dB
increase
of
signal
to
quantization
noise
ratio)
Keeping
in
mind
that
a
perceived
loudness
increase
of
a
factor
of
two
corresponds
to
approximately
9
dB
increase,
comment
on
your
perception
of
the
signal
to
noise
ratio
at
the
various
bit
resolution
levels.
For
example,
referring
to
the
table,
how
many
bits
of
resolution
would
give
a
quantization
noise
that
is
"twice"
as
loud
as
it
is
at
12
bits?
Prepare
sound
files
to
check
your
perception
against
the
table
predictions.
Keep
in
mind
that
this
is
subjective.
4.
Maximum
compression
and
intelligibility
of
speech
In
the
final
part
of
this
lab
you
will
investigate
the
maximum
extent
that
you
can
compress
a
speech
sound
file
and
maintain
its
intelligibility.
Note
that
the
total
size
(number
of
bytes)
of
a
sound
file
is
determined
by
the
sampling
rate
AND
the
bit
resolution.
Determine
the
tradeoff
of
sampling
rate
and
bit
resolution
that
best
maintains
intelligibility,
i.e.,
is
it
better
to
use
a
high
sample
rate
and
small
number
of
bits
or
a
low
sample
rate
and
a
greater
number
of
bits.
What
is
the
greatest
data
compression
factor
compared
to
44,100
Hz
16-bit
sound
that
you
can
achieve?
Write-up
Your
write-up
should
answer
all
questions
in
bold
posed
above
and
well
as
to
furnish
qualitative
descriptions
of
what
you
heard
in
the
various
tests.
ECE140
Lab #2
clear
close all
Nsec = 3;
bits = 12;
% Print out the sample rate R and the number of quantization levels
x = x(1:Nsec*R)*2^(nbits-1);
normalize to integer levels
soundsc(x,R)
pause(Nsec + 0.5)
xq = round(x/2^(nbits-bits));
soundsc(xq,R)
start = 1;
stop = length(x);
len = stop-start;
subplot(211)
plot(x(start:stop), 'k.')
hold on
plot(x(start:stop),'r')
axis([0 len -2^(nbits-1) 2^(nbits-1)])
grid on
title('Original audio')
xlabel('Sample Number')
ylabel('Level')
subplot(212)
plot(xq(start:stop), 'k.')
hold on
plot(xq(start:stop))
axis([0 len -2^(bits-1) 2^(bits-1)])
grid on
title('Re-quantized audio')
xlabel('Sample Number')
ylabel('Level')