Network Audio Streaming: Virtual Audio Device Integration with BASS Audio

Started by serkanp,

serkanp

Hi everyone,
I'm a C# developer working with .NET Core 9 and BASS Audio, and I'm planning to build a network audio streaming solution. I'd like to get your thoughts on the technical feasibility and best practices for this architecture.
Background:
We have an audio player app built with BASS that can play input devices or playlists to any sound card. There are several signage applications on the same network that need to send their audio output to our player, since these devices have no speakers connected - only our main PC has audio output capability.
The goal is to capture audio output from any application on source PCs and transmit it to our target PC, where it should appear as an input device that our BASS-based player can use.
Proposed Architecture:
Source PC (Sender):
  • Create a virtual audio device (virtual sound card)
  • Route any application's audio output to this virtual device
  • Capture audio from the virtual device using BASS Audio
  • Stream the captured audio over network to target PC
Target PC (Receiver):
  • Receive the network audio stream via BASS Audio
  • Route the received audio to a virtual input device (virtual microphone)
  • Use the virtual input device in our BASS player for playback
Audio Flow:
Source PC: [Signage App] → [Virtual Sound Card] → [BASS Capture] → [Network Stream]
Target PC: [Network Stream] → [BASS Audio] → [Virtual Input Device] → [Our Player] → [Speakers]
Questions:
  • What's the best approach for creating virtual audio devices on Windows and Linux that integrate well with BASS?
  • For network streaming, should I use BASS's built-in streaming server capabilities (like ICEcast/HTTP), or implement custom UDP/TCP streaming?
  • Are there specific BASS components or techniques you'd recommend for low-latency audio capture from virtual devices?
  • Any potential issues or limitations I should be aware of with this architecture?
  • Would BASS_WASAPI be suitable for loopback capture, or are there better alternatives?
I'm particularly interested in maintaining good audio quality while minimizing latency for real-time applications.
Thanks in advance for any insights or suggestions!
P.S.:
Suggestions can be in any programming language - I'm just trying to find the best approach for this use case.
also all approach must be headless-kind without any ui interface. they will work at the background.
source and target pcs can be linux or windows


Ian @ un4seen

Quote from: serkanpAudio Flow:
Source PC: [Signage App] → [Virtual Sound Card] → [BASS Capture] → [Network Stream]
Target PC: [Network Stream] → [BASS Audio] → [Virtual Input Device] → [Our Player] → [Speakers]

Are you creating the "Signage App" too? If so, you could have it play on BASS's "No Sound" device and capture the output via a STREAMPROC_DEVICE stream. Otherwise, you could indeed use a "Virtual Sound Card" to capture the output. I'm not sure you need the "Virtual Input Device" on the receiver end though - couldn't "Our Player" receive and play the "Network Stream" data directly?

Quote from: serkanp
  • What's the best approach for creating virtual audio devices on Windows and Linux that integrate well with BASS?

I've never really used virtual audio devices myself, so I'm afraid I can't suggest something in particular, but I guess any should work fine?

Quote from: serkanp
  • For network streaming, should I use BASS's built-in streaming server capabilities (like ICEcast/HTTP), or implement custom UDP/TCP streaming?

If the stream will have a single receiver then an Icecast/Shoutcast/BASSenc server seems unnecessarily heavy. A TCP (or UDP) socket should suffice, where the Source PC writes to the socket and the Target PC reads from it. One reason you might choose to use a BASSenc server (BASS_Encode_ServerInit) is for simplicity, as the receiver can then use BASS_StreamCreateURL (instead of BASS_StreamCreateFileUser and callbacks), or you could enable that by implementing basic HTTP support on your own Source PC socket.

Quote from: serkanp
  • Would BASS_WASAPI be suitable for loopback capture, or are there better alternatives?

BASS itself includes loopback support (see the BASS_DEVICE_LOOPBACK flag), so you won't need BASSWASAPI for that.