1

I'm trying to stream audio (just a simple, uncompressed 8-bit mono wav stream at the moment) to an HTML5-capable browser from node.js - however, the browser seems to be adding several seconds of lag. Is there a way to make this more realtime?

I've been thinking about detecting silence and not sending the silent bytes, thereby forcing a buffer underrun, but this doesn't seem like a very clean solution to me...

thejh
  • 44,854
  • 16
  • 96
  • 107
  • What do you mean by adding lag? Is it buffering the audio? Something else? I don't have any lag in this simple example - http://jsfiddle.net/QPW27/2/ – mrtsherman Jan 14 '12 at 17:15
  • @mrtsherman: Yes, it's buffering the audio. When I open the same stream in the browser using an audio tag and in VLC, it's delayed by two seconds or so. – thejh Jan 14 '12 at 17:23
  • Maybe it's caused by using a wav stream? – thejh Jan 14 '12 at 17:25
  • yeah, that's what I was thinking. wav's are much larger than compressed audio. Although its 8 bit mono so it can't be that big, right? – mrtsherman Jan 14 '12 at 17:27
  • @mrtsherman: 8000 bytes per second... but I'm doing this over localhost, so bandwidth isn't an issue – thejh Jan 14 '12 at 17:33
  • @thejh not true. bitrate and sample-rate determine the amount of bytes per second. as sample-rate is not a given you cannot make this calculation. if the sample-rate is 44.100 hertz and the bit-rate is 8 (one byte) then we're talking about 44.100 bytes / sec (= appr. 43kB/s = one megabyte per appr. 24 sec). – Chris Beemster Jan 18 '14 at 09:00

0 Answers0