From: Earle Clubb Date: 2007-05-08T05:42:58+09:00 Subject: ulaw audio over network Does anyone know of a good way to stream ulaw audio (read from a file) over a UDP socket? I have something (mostly) working, but I can't seem to get the packet timing right. If I use a 10ms sleep, the packets end up being ~12ms apart. However, if I use a lower value (say 8ms), the packets are 8ms apart. The code I'm using is included below. Has anyone done this or something similar? Thanks, Earle Code: require 'socket' @audio_socket = UDPSocket.open @audio_socket.connect("239.1.1.3", 4098) def send_audio(filename) data = "" File.open(filename) do |file| while file.read(80, data) @audio_socket.send(data, 0) sleep 0.01 end end end send_audio(ARGV[0]) -- Posted via http://www.ruby-forum.com/.