Re: how to create random noise, convert to xml and send to tcp/ip socket?
"Fengyuan" <thomaslee1982@gmail.com> wrote in message
news:1175236285.961231.30970@r56g2000hsd.googlegroups.com...
Hi, All
I am new to Java, and really need to your help in this moment.
I would like to create a random noise signal (at this point any signal
is ok, later on I would like to one with the distribution I defined),
and convert the signal into xml format and send to a TCP/IP socket.
I am reading help files to try to figure out how to do that. Is there
anyone can give me some ideas, or some information?
Audio as XML will be horribly inefficient. But I need to know...
What sample rate?
How many bits per sample?
PCM or perceptual coded?
You can make random noise from java.lang.Math.random, but probably not in
real time. There are other ways you can make random noise. I seem to recall
an algorithm, such as XOR with a randomly-generated integer (seed), and then
left shift, XOR with n-1, etc. I think this generates random numbers with a
rectangular probability density.
Here is some DSP assembly code with a pseudo-random dither generator:
http://www.w9gr.com/cw1ktms.html -- It isn't Java, but you should be able to
use the algorithm. Search for the word "dither" in the document.
Audio is basically unstructured, or perhaps I should say, all the same
structure. I am trying to figure out how you would organize the audio in the
XML document. What would the XML elements represent? Further, since XML is
basically text, you would probably have to base-64 encode the audio to
translate the intrinsically binary audio into legal XML characters - oh! The
humanity!