Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
reshape?

Subject: reshape?

From: hadi motamedi

Date: 24 Dec, 2012 05:17:49

Message: 1 of 3

Dear All
To send a speech wave signal through a noisy channel , I tried as :
->[y,Fs]=wavread('speech.wav');
->x=(0.999/(max(y-min(y)))*(y-min(y));
->n=4;
->y1=floor(2^n*x);
->b1=de2bi(y1,'left-msb');
->b11=reshape(b1.',numel(b1),1);
To this end, I have the original data in binary form suitable to send through a noisy channel. The matrix [y1] contains the digits and the matrix [b11] contains the bits to be sent through the noisy channel. Please consider the matrix [b11p] to be the received noisy binary data . Can you please let me know how can I convert it back to the digits to be able to play the noisy wave sound?
Thank you

Subject: reshape?

From: Roger Stafford

Date: 25 Dec, 2012 05:18:08

Message: 2 of 3

hadi motamedi <motamedi24@gmail.com> wrote in message <ee1244b1-d379-41d6-81e4-2d7360332aa5@googlegroups.com>...
> Dear All
> To send a speech wave signal through a noisy channel , I tried as :
> ->[y,Fs]=wavread('speech.wav');
> ->x=(0.999/(max(y-min(y)))*(y-min(y));
> ->n=4;
> ->y1=floor(2^n*x);
> ->b1=de2bi(y1,'left-msb');
> ->b11=reshape(b1.',numel(b1),1);
> To this end, I have the original data in binary form suitable to send through a noisy channel. The matrix [y1] contains the digits and the matrix [b11] contains the bits to be sent through the noisy channel. Please consider the matrix [b11p] to be the received noisy binary data . Can you please let me know how can I convert it back to the digits to be able to play the noisy wave sound?
> Thank you
- - - - - - - - -
  I am a somewhat puzzled by your question. Being able to convert the noisy bits back to integers depends very much on b11p not having lost or gained bits along the way and thereby affecting the way the bits are clustered in groups of n bits each. If you haven't lost phasing in this manner, reversing your procedure by reshaping b11p to restore the n columns of bits and this time using bi2de, would get you back to a noisy version of y1 - that is, integers between 0 and 2^n-1. Note that altering bits toward the most significant end of a group would have a serious effect on these restored integers. However, there is clearly no way to restore the original x, much less the y, values unless you have more information than is possessed by b11p.

Roger Stafford

Subject: reshape?

From: hadi motamedi

Date: 29 Dec, 2012 08:30:08

Message: 3 of 3

On Tuesday, December 25, 2012 8:48:08 AM UTC+3:30, Roger Stafford wrote:
> hadi motamedi <motamedi24@gmail.com> wrote in message <ee1244b1-d379-41d6-81e4-2d7360332aa5@googlegroups.com>...
>
> > Dear All
>
> > To send a speech wave signal through a noisy channel , I tried as :
>
> > ->[y,Fs]=wavread('speech.wav');
>
> > ->x=(0.999/(max(y-min(y)))*(y-min(y));
>
> > ->n=4;
>
> > ->y1=floor(2^n*x);
>
> > ->b1=de2bi(y1,'left-msb');
>
> > ->b11=reshape(b1.',numel(b1),1);
>
> > To this end, I have the original data in binary form suitable to send through a noisy channel. The matrix [y1] contains the digits and the matrix [b11] contains the bits to be sent through the noisy channel. Please consider the matrix [b11p] to be the received noisy binary data . Can you please let me know how can I convert it back to the digits to be able to play the noisy wave sound?
>
> > Thank you
>
> - - - - - - - - -
>
> I am a somewhat puzzled by your question. Being able to convert the noisy bits back to integers depends very much on b11p not having lost or gained bits along the way and thereby affecting the way the bits are clustered in groups of n bits each. If you haven't lost phasing in this manner, reversing your procedure by reshaping b11p to restore the n columns of bits and this time using bi2de, would get you back to a noisy version of y1 - that is, integers between 0 and 2^n-1. Note that altering bits toward the most significant end of a group would have a serious effect on these restored integers. However, there is clearly no way to restore the original x, much less the y, values unless you have more information than is possessed by b11p.
>
>
>
> Roger Stafford

Thank you for your reply
I tried as :
->b11P=reshape(b11p.',4,100000);
->b1s=b11P.';
->y1t=bi2de(b1s,'left-msb');
->x1f=(2^(-n))*y1t;
->wavplay(x1f,Fs)
And it was successful. Thank you for your help

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us