I can't for the life of me figure this out.. I'm trying to take data received on a network connection, and then pipe it to a subprocess, which will stream the data to my soundcard via aplay.
I've managed to do this, but it pauses briefly while it receives the data.
while True:
data = sock.recv(1024)
p1.stdin.write(data)
What is the best way to setup a pipe that will stream from a network connection indefinitely? Setting up multiprocessing or threading to do this?
Thanks!
Playing back sound is especially tricky - human ears are sensitive to any kind of break in sound playback and the perceived quality would be bad. Further, you can never predict the delays/jitter/latency in the network. Hence, the following model is the best:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.