   Streaming Audio
  OK... i am trying to stream some audio over the net. I am using SHOUTcast to stream the audio, but i am trying to write an app in VB6 as the player.  I COULD use winamp, but i would like to add some live requests and maybe some other functionality that winamp doesn''t support.  So here da question:How do i send music to a port, or, where can i go to get more info?Any help would be appretiated.   ------------------------------------------
  I worked on a similar project in the past, where we needed an application to stream audio from shoutcast servers. One way to do it is with DirectShow. The problem is that directshow does NOT support shoutcast sources, so you will need to write your own ShoutCast source filter. My VB knowledge is quite limited, so i''m not sure how easily doable it would be in that language. But you can find some information on directshow and writting filter in the DirectX SDK docs.To receive the data, you''d use sockets, connect to the shoutcast server, and request a stream, and then when you start receiving mpeg data, you pass it along to the directshow mp3 decoder.Another possibility would be to skip directshow totally and use sockets to receive the MP3 data and use a 3rd party mp3 decoder (or write your own) and then use the wave data with directsound as the renderer.There''s not a whole lot of documentation on the shoutcast protocol, but this page gives a general overview: http://www.smackfu.com/stuff/programming/shoutcast.html. When analyzing any protocols, a packet sniffer will surely help you. Fortunatly, there is enough info on the MP3 format, which will help you seperate the MP3 frames, either for the directshow filter or 3rd party decoders.;  hanks for the reply! i would like to stream data TO the SHOUTcast server.  Would it be the same all the way around?  Would i just open a socket and send data at specified intervals?This is where i am getting confused... It seems pretty simple to open a TCP socket, send the data, then close it.  But a stream i think is different. Or is it?  maybei am think to much about this...BTW.. you gave me a hint of where to go... the seperation of MP3 frames was a good start..Thanks!   [edited by - MrBeaner on February 13, 2004 5:41:31 PM];  Oh! well in that case you can forget about the directshow filters and that stuff since the shoutcast stream broadcasts raw mp3 data (no need to encode/decode). You would only need to read the mp3 files off the HD and send the frames down using sockets.I'm not sure exactly how the protocol works for SENDING data to it because I only works with the protocol for receiving... hmm.. What I would do is grab a packet sniffer like ethereal (http://www.ethereal.com/), setup a shoutcast server, and winamp with the broadcasting tools. Start up the packet sniffer and start broadcasting mp3 data with winamp. That way you can look what data winamp send to the shoutcast server. I'm sure its something like a connection handshake, then it just spits mp3 frames at the server.To figure out the interval to send data, you can look at the mp3 frame header, which tells the bitrate and other parameters. You can then figure out at what speed the client needs the data before its done playing the current frame. Its not really critical because the mp3 players buffer the data it receives, but you want to make sure you send fast enough that it does run out. If I remember correctly, an mp3 frames lasts for aprox 26ms. And  with the bitrate, sample rate, and other info in the header, you can figure out the size of the frames.look at http://www.mpgedit.org/mpgedit/mpeg_format/mpeghdr.htm for info on mpeg audio. the formula for calculating frame sizes is mentioned there.I wish nullsoft would document their protocol... it would save us some trouble.  I wish i could give more concrete information, but you'll have to hack around and figure some stuff out since its mostly undocumented. There are open source projects that does this, and taking a peek a those might also help.   [edited by - superjosh on February 13, 2004 6:02:26 PM];  Wow.. Outstanding!  Thanks for the info!  That doesn''t sound very hard... but then again... THANK YOU VERY MUCH!!! 