Click here to Skip to main content
16,012,223 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have found a source code in Code project that can read a stream byte by byte and extract metadata and record it into an mp3 file ! here is the link : SHOUTcast Stream Ripper[^]
How can i play a stream while recording using the same source code
thanks so much for your help !!
Posted
Updated 12-May-14 4:44am
v3
Comments
CHill60 12-May-14 10:46am    
Note to other viewers: OP has already posted a comment against the article in question. But author has not responded to posts since June 2007
Nelek 12-May-14 11:19am    
against?

You mean the OP posted a message in the article board, don't you?
CHill60 12-May-14 11:22am    
D'oh ... I meant "against" as in "next to". Having re-read this I can see how it sounds!
Nelek 12-May-14 11:33am    
Don't worry, I just had one even worst. Someone helping another OP said in a comment "if solved please accept the answer as a solution, it will help others" and me: "How? this is a comment not a solution" :doh: :doh: :doh:
I think is time to go home and have a beer.
CHill60 12-May-14 11:38am    
Fantastic idea!

1 solution

Look at lines 130-138 of the single code file:
C#
if (count++ < metaInt) // write bytes to filestream
{
  if (byteOut != null) // as long as we don't have a songtitle, we don't open a new file and don't write any bytes
  {
    byteOut.Write(buffer, i, 1);
    if (count%100 == 0)
      byteOut.Flush();
  }
}

In my impression, this looks like the position where you get the mp3 data (in byte[] buffer). Now de-compress the buffer with the codec, and send the resulting data to the sound card.
 
Share this answer
 
Comments
brenntengel@yahoo.fr 13-May-14 13:58pm    
Thanks so much for your comment !
i understood how this code works ! and i know that the buffer contain the MP3 Data !
My Problem is that i don't know how to decompress and send this data to the sound card !
Thanks again for your help !!
Bernhard Hiller 14-May-14 2:31am    
See e.g. NAudio http://naudio.codeplex.com/. It contains code for decompressing mp3 (and it is opensource!).
brenntengel@yahoo.fr 14-May-14 2:47am    
I tried for a while now to convert MP3 bytes to wav bytes using NAUDIO but the problem is the Metadata is retrived only for the first song !
brenntengel@yahoo.fr 16-May-14 4:33am    
I have found a solution using irrKlang but the problem is the use of the buffer ! when i remove the content played from the buffer the sound is cut ! and then restard again ! i tried using Thread but the same problem ! how can i solve this ! PS : normally we can not use irrKlang with a stream

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900