Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
226 views
in Technique[技术] by (71.8m points)

c++ - Software Mixing of Multiple Audio Streams From Network

TLDR: How do I mix network streams when streams might be unreliable?

I am working on a project which will allow musicians to practice/perform together over the internet with low latency. (Think JackTrip but more user friendly).

I am receiving raw PCM audio data via UDP over the network. As these come in, I identify who the sender is and pipe that stream into that particular person's buffer. I have a separate buffer for each person participating.

Periodically I then take one "chunk" at a time from each buffer, mix them together and output to the speakers of the device.

The issue I'm having is knowing when to take that "chunk". Some clients go offline and their buffers run empty. I cannot just wait for their buffer to refill as this will slow down the other clients.

Thoughts I had were to look at all the buffers at a particular point in time and only process a chunk when at least half of the buffers are populated.

Any ideas?

Other details:

  • My buffers are 128 samples big.
  • I am using a sample rate of 44100
  • I am using 16 bit signed integer pcm
  • Streams are MONO
  • I am using PortAudio and C++.
  • I am using ASIO audio drivers.
question from:https://stackoverflow.com/questions/65903637/software-mixing-of-multiple-audio-streams-from-network

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...