Hacker News new | ask | show | jobs
by mikewhy 1384 days ago
I was playing Spider-Man with a dual sense and got wondering. That game puts out audio to your speakers, a separate audio stream to the speaker in the controller, and _another_ stream of audio for the haptics. Is this any bit possible with any Linux audio solution?
1 comments

I don't see why that wouldn't be possible with Pipewire. The system will provision your application with the default audio output but through the Pipewire API you can send any audio stream(s) you want to any device(s) you want.

I've played around with patchbay software to manage existing audio streams. I've sent audio to both my headset and streaming software, adding a block of effects inbetween through JACK audio software, and used a similar JACK audio interface to put audio from a voice chat app to the front left and then piped it into my headphones.

I don't know the API for creating audio streams directly but as long as you can introduce enough sources and expose every audio output as a separate sink (i.e. one for your controller) it's all relatively easy.

I doubt game developers will make use of this any time soon, though. Maybe if the success of the Steam Deck brings a new life to Steam Machines?

Hmm, I suppose that could work, didn't think about targeting the Pipewire api.

I didn't play around with it much, but the controller did appear as a 5.1 (or was it 7.1?) in Linux.

Oh, and I forgot, the controller itself also has a headphone jack. The controller itself can take 3 audio streams, two of which can be used for sound.

You can route an audio stream into any channel of any audio device so even if the controller shows 9 channels, you can use all of them if you provide enough sources.

I've added 8 (*2, stereo) channels to OBS at some point for shit and giggles and that worked fine without interrupting my normal headphones. Things can only work better without the compatibility layer.

Your biggest issue trying to get this done will probably be picking the right channels for the right controllers because you have no idea what controllers are what on other systems. An audio device dropdown after some auto detection should work, but if the controller has weird specialised channels that don't follow the normal system output (i.e. 5.1 but two channels are actually stereo headphones and not real 5.1) then configuration may be a pain.