Why while using sound function in matlab sound has noise in it?

I have modulated and demodulated a sound file and i have bit error rate of zero. Then why output sound is distorted?
clear; clc;
M=2;
freq_sep=100;
nsamp=6;
sampling_frequency=1000;
[data,Fs]=wavread('Pakistan','native');
b=uint8(data);
data_bin=de2bi(b);
fsk_mod=fskmod(data_bin,M,freq_sep,nsamp,sampling_frequency);
noise=awgn(fsk_mod,25);
fsk_demod=fskdemod(noise,M,freq_sep,nsamp,sampling_frequency);
[num,rate]=biterr(data_bin,fsk_demod)
z=bi2de(fsk_demod);
sound(z,Fs)

3 commentaires

Does "data" sound distorted? Is it possible you are clipping the sound? What is the max(abs(z(:)))?
it gives this error
??? Error using ==> sound at 55
Audio data must be real and double-precision.
max(abs(z)) is 255

Connectez-vous pour commenter.

 Réponse acceptée

Walter Roberson
Walter Roberson le 15 Mai 2012
Possibly the original data was more than 8 bit. What does class(data) show ?
Also, you did not force de2bi() to use 8 bit output per sample.
Is fsk_demod definitely an array and not a vector?

5 commentaires

If i use data of 8 bit same distotion is observed. Fsk_demod is an array of type double.
http://www.mathworks.com/help/techdoc/ref/sound.html
"The sound function assumes that y contains floating-point numbers between -1 and 1, and clips values outside that range."
demod_sound = (double(fsk_demod) - 128) ./ 256;
sound(demod_sound)
It still seems a little odd to me. If z is an array of integers between 0-255 then it should produce a click whenever it transitions to/from 0. That isn't what I would call "distorted" or having "noise in it".
I'm not sure why you say there should be a click? There is nothing special about 0 -- it doesn't mean "turn off the speaker" for example.
The soundcard will attempt to produce one voltage for every sample with a value of 0 and another for voltage (its maximum voltage) for every sample with a value greater than 1. I am assuming the number of samples with a value of 0 is small. Periods where the soundcard output is pinned to the maximum will be perceived as silence. The transition from the maximum voltage to the voltage corresponding to the 0-valued samples will be perceived as a click.
maximum voltage with brief periods of significantly smaller voltages. The transition gion

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Audio I/O and Waveform Generation dans Centre d'aide et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by