Google Answers Logo
View Question
 
Q: Live Streaming Audio Data (w/ a Twist!) ( Answered 5 out of 5 stars,   0 Comments )
Question  
Subject: Live Streaming Audio Data (w/ a Twist!)
Category: Computers
Asked by: russelh-ga
List Price: $30.00
Posted: 30 Jul 2004 14:15 PDT
Expires: 29 Aug 2004 14:15 PDT
Question ID: 381466
I am currently trying to set up a system using RealProducer and
HelixServer to deliver live streaming audio data (however, I am
willing to change to something else). The audio data that I am trying
to stream is coming across a network, and into the server's NIC in
packet format. I want to deliver it through RealPlayer any time
someone connects to the site that the media is to be hosted on.  The
idea is for someone to navigate to the site, and click on a "sensor"
where they will then be able to hear acoustic data that is being
transmitted across a network.

My problem arises because the audio data needs to be streaming LIVE,
but it is not coming through a sound card.  It is data coming across a
network, and not through a microphone, or the like.  I have conferred
with my colleagues about how to do this and we have come up with some
ideas, but no solutions.  First, we thought to write our own WAV file
which would then be handed to RealProducer to be encoded, and then off
to Helix Server to be delivered.  This would of course have to be a
FIFO file, since the data never really stops being written to the
file.  However, in the WAV file structure (as I am sure you know) when
you get to the data chunk, you must specify a size.  This is where I
am stumped because there is no size... it is live streaming data. 
Second, we thought to try and direct the data through the sound
card... this seemed infeasible because the amount of data coming
across is ridiculous, and directing it through the sound card seems
like too many levels of indirection.  However, we are willing to hear
arguments for why this is a good option, if you have any. :)  Finally,
we thought of writing our own little virtual device (not sure if
that?s been done) and writing the correct IOCTL calls for RealProducer
to think that it is talking with a real device.  Again, we hit trouble
because we don?t have a clue how RealProducer interacts with live
devices.  We would definitely need some help, if that were to be our
only option.

My question to you is, how can we get the audio data coming to us from
across a network into the correct format for RealProducer to encode
and hand to Helix Server?  I am certainly willing to change up the
configuration of RealProducer and Helix Server, and I am open to any
suggestions that you could offer regarding this matter.  We would
greatly appreciate any help.

Thank you!

Request for Question Clarification by efn-ga on 31 Jul 2004 16:08 PDT
What is the format of the input stream you want to distribute?  I
think it has to be something more specific than "packet format."

I believe all you need is the right software.  Running the stream
through a file will decrease performance, and running it through the
sound card will probably decrease both quality and performance.  You
just need something that will convert the input stream into the kind
of output stream you want.

--efn

Request for Question Clarification by maniac-ga on 31 Jul 2004 19:53 PDT
Hello Russelh,

It sounds like you want to set up an audio relay server - perhaps
something similar to what is described at:
  http://forums.whirlpool.net.au/forum-replies.cfm?t=117203
or
  http://www.hosting4less.com/shoutcasthosting.html
which stream MP3 data from one or more sources to other clients. I can
certainly look up alternatives that would be more compatible to Real
if you want to stick with the realplayer software.

Is your audio data encoded in some standard way (on the network) and
if so - what format?

Thanks.
  --Maniac

Clarification of Question by russelh-ga on 01 Aug 2004 09:51 PDT
Thanks for the quick reply... and sorry for not clarifying the data
coming in from across the network.  :)  It is a little bit tricky, so
bear with me because I am new at this audio streaming thing!

What is happening is that I am receiving raw audio data from across
the network in the form of TCP packets.  This data comes from an
acoustic sensor which gets transmitted from analog to digital via a
A/D card (obviously).  This data is then sent in the form of UDP
packets to a set of nodes which transform it into TCP packet format. 
All the while the audio data is uncompressed and raw.  This is not
previously recorded audio data, it is live acoustic data.  I hope that
helps some.

I did look into Shoutcast and it seemed like a viable option until I
found that it was set up to stream MP3, which I thought was compressed
audio data.  I could be really wrong there, so please feel free to let
me know if I am.  Maybe there is a way to get the audio data into MP3
format.

I also agree that running it through any kind of alternative path
other than directly through the encoder or server would decrease
performance.  I just can't figure out how to get any of the software
out there to work.

I really appreciate the help and expertise.  You guys are quick and
very knowledgeable!

Request for Question Clarification by maniac-ga on 01 Aug 2004 13:50 PDT
Hello Russelh,

Well, MP3 can be adjusted for a varying range of bit rates. A nice summary is at
  http://www.mp3-tech.org/programmer/frame_header.html
which has a nice table showing several options. For your application,
I assume it is "single channel", so you may have to divide by 2 for
bit rates when looking at data describing stereo audio data. You can
certainly use higher bit rates if you need better quality.

The encoding method used in MP3 is "lossy" in that you don't get the
original signal back at the destination but it is one that sounds like
the original to a person listening. If you need a lossless algorithm,
there are certainly options available but may require a special audio
player application.

Also - since you don't seem to have a standard audio feed, it is
likely you will need to build your own application. I can certainly
suggest source code to use if you describe:
 - the sampling rate of the original data
 - the number of bits per sample (e.g., 16, 12)
 - the operating system you want to use (e.g., Linux, Windows 2000)
 - if you can accept a lossy algorithm
Based on that, I can suggest a few products and/or source code to
adapt for your application.

  --Maniac

Clarification of Question by russelh-ga on 02 Aug 2004 09:17 PDT
Suggestions would be wonderful!  Here's some of the specs:

-- sampling rate: 44.1 kHz
-- number of bits per sample: 16
-- OS to be used: Linux 9
-- Accept lossy algorithm: prefer not, but would certainly accept it

Thanks for all the help! :)
Answer  
Subject: Re: Live Streaming Audio Data (w/ a Twist!)
Answered By: maniac-ga on 02 Aug 2004 18:04 PDT
Rated:5 out of 5 stars
 
Hello Russelh,

OK. 44100 samples per second at 16 bit; nice standard values. You
don't mention if its big or little endian (e.g., AIFF vs. WAV), but
most of the tools with either detect that automatically or can be
configured the right way.

I will also assume you can either:
 #1 take the network packets and output them to standard output. For
an example, see
  http://rawrec.sourceforge.net/
which can read / write audio data in this way. You could take the
source code of this and adapt it to your network packets if needed.
 #2 take the network packets and have them appear in a named pipe or
some other method to have it show up in your file system. For example:
  http://www.linuxjournal.com/article.php?sid=2156
describes how you can set up named pipes (and how they work) on Linux.

If one of these is NOT true, please let me know with a clarification
request so I can make some additional suggestions. I also assume you
do not want to encode speech audio - there are better tools such as
http://www.speex.org/ which handle that as well.

There are several different encoding methods available. For example:
  - MP3 - an extremely popular format, a good general description is at
  http://en.wikipedia.org/wiki/MP3
A long and detailed FAQ is at
  http://mail.phys-iasi.ro/Library/Computing/mpeg_layer_3.htm
Note that you may require a license to use for a commercial purpose. See
  http://www.mp3licensing.com/help/developer.html
for the FAQ on licensing terms. The per unit license fees are quite
small, but if you sell the streamed data for a fee, you may be subject
to a fee for that.
 - Ogg Vorbis - a completely free audio format described at
  http://www.vorbis.com/
 - FLAC (Free Lossless Audio Codec) - a completely free compression /
streaming format that is lossless (44100 in -> compressed data ->
44100 out at the far end). See
  http://flac.sourceforge.net/features.html
for more information.
 - AAC (Advanced Audio Coding) - information available at
  http://www.audiocoding.com/
is the format used by Apple for iTunes and the iPod. This site has
source code for encoding / decoding. You may also need licensing for
this format - see
  http://www.vialicensing.com/products/mpeg4aac/standard.html
for details.

Applications that support one or more of these formats include:
 - libsndfile (http://www.mega-nerd.com/libsndfile/) - a general audio
read / write package and able to convert between several popular
formats. Used by several of the other packages.
 - icecast (http://www.icecast.org/) - a streaming media server
supporting both MP3 and Ogg Vorbis data. Note that it can be
configured to take data from directories of "music files" or to read
from a live stream from an audio card or already encoded data (e.g.,
output from #1 above).
 - Gstreamer (http://gstreamer.freedesktop.org/features/) - a
multimedia framework that allows you to build applications that can
play audio, do editing, record audio, and so on.
 - LAME (http://lame.sourceforge.net/using.html) a very sparse web
site, but a capable encoder of MP3 streams. Note the guide to command
line options which describes how to specify the input data, can pipe
the results to other applications, etc.
 - BladeEnc (http://bladeenc.mp3.no/) an MP3 encoder, used by several
other products (see product list). Note it works OK but is not under
active development.
 - OpenMash (http://www.openmash.org/) is another audio framework. Was
actively under development due to an NSF grant, but the funding dried
up and is not very active now.

A pretty good set of audio server scripts in use at the DNA Lounge is at:
  http://www.dnalounge.com/backstage/src/icecast/
In particular, note the "ice-downcoder.pl" script which reads from an
active stream and resamples it to a lower rate for broadcast. This is
a good example of using LAME to convert data in pipes.

A simple illustration on how you put the tools together (assuming Icecast) at
  http://liveice.sourceforge.net/understanding.html

An extensive performance comparison (encode / decode) is at
  http://flac.sourceforge.net/comparison.html
primarily looking at lossless algorithms.

A "Dare to Compare" page with various samples of original audio and
the compressed files for comparison.
  http://www.xiph.org/ogg/vorbis/listen.html
Note it compares with a couple proprietary algorithms as well.

An interesting tutorial on Linux audio streaming at: 
  http://www.yolinux.com/TUTORIALS/LinuxTutorialAudioStreaming.html
Note the long list of links to further resources on Linux audio
streaming at the end.

For a low / no cost solution, I suggest using
 - a capture application to convert your network messages to something
your selected codec can use
 - Icecast (and plugins) for the basic streaming capability
 - a free format such as FLAC (lossless) or Ogg Vorbis
 - players with appropriate plugins for the receiving systems

Good luck with your work. Don't hesitate to make a clarification
request if some part of this is unclear or does not fully meet your
needs.
  --Maniac
russelh-ga rated this answer:5 out of 5 stars and gave an additional tip of: $5.00
Absolutely phenomenal researcher!  I have never used this service
before, but now I am hooked! :)  I was researching my problem for a
week, vigorously, and thought I had exhausted all of my options. 
Thanks to the knowledge and expertise of GA, I am well on my way to
success!  Thanks again!

Comments  
There are no comments at this time.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy