Re: Voice playback from a buffer using wavplay



"steven.bak" <steven.bak@xxxxxxxxx> wrote in message
<9a764d17-64f1-4a5e-b418-332133e3450a@xxxxxxxxxxxxxxxxxxxxxxxxxx>...
Hi,
I am trying to make an intercom type application where
Voice is
recorded on CompA, sent over UDP to CompB, and played back
on CompB in
real time with a slight delay.

I am recording my voice using wavrecord, then sending that
data to
another computer over a UDP object.
I am able to play the voice back on the other machine but
it is
choppy, not smooth.

Is it possible to "wavplay(A)" where A is some buffer that is
dynamically growing with new Voice Data as it is being
read from the
UDP object?

Is there a better way to go about what I am trying to do?


Thanks in Advance.


I have done similar before where a remote acquisition device
has been digitising acoustic data and making it available
over a network. The psuedocode was as follows:

fs = 96000;
bits_per_sample = 16;

socket = connectToServer(host, port)

while true

if (isClosed(socket)
break;
end

[data] = readData(socket); % blocks waiting for data

% Play the acoustic data in data through default soudncard
player = audioplayer(data, fs, bits_per_sample);
play(player);
end
%-----------------------------

I would recommend using short-ish buffers of data, ie 1
second. To avoid stuttering i would recommend buffering the
first few buffers either before sending server side or
playing receiver side. And possibly look at using the
matching audiorecorder server side.

Rod

--
http://iheartmatlab.blogspot.com
.