Hello. I am attempting to (in NodeJS):
- Connect to an Icecast internet audio stream. Ex: http://icecast3.977music.com/comedy
- Parse the response headers and extract the
icy-metaint
value. - Write out the raw audio data to a file, while extracting the metadata bytes from the audio stream in order to:
- Intercept and parse the metadata when it arrives.
- Not include the metadata bytes in the output file, so that there are no audio artifacts because of the injected metadata.
Following the "unofficial" Shoutcast Metadata Protocol page from SmackFu, I have been able to get this far:
https://gist.github.com/e7474421dcb25e011620
Basically, I am able to extract the metadata when it is expected (there's only 1 metadata event at the very beginning of the stream dump included in the gist). That part seems to work fine.
The problem is that the output MP3 file has noticeable audio artifacts throughout the file, presumably when the metadata bytes is arriving. However, I am definitely extracting those metadata bytes and NOT including them in the output file, so that's the weird part.
The protocol document in the link above doesn't say anything else needs to be done to the output file, but obviously I'm still doing something wrong. Does anybody know what else needs to be done to the audio stream? Thanks in advance!