NapoleonWils0n / cerberus

cerberus code library
218 stars 54 forks source link

Multiple Virtual Devices? (Pulse Audio Sinks) #14

Closed MayhemBill closed 2 years ago

MayhemBill commented 2 years ago

So I was linked a video of yours (and subsequently this GitHub) and I'm basically trying to create a setup on an Ubuntu Server where I have two devices, a Virtual Mic, and a Virtual Headphone, for use (in this specific case) Discord, I followed the steps twice (VirtualHP, and VirtualMic) however I get into a weird situation where I have HP and Mic as Inputs, but only Null Output as an output device, that is linked to both Mic and HP, commands I used to do this:

pactl load-module module-null-sink sink_name=HPSource pactl load-module module-virtual-source source_name=VirtualHP master=HPSource.monitor pactl load-module module-null-sink sink_name=MicSource pactl load-module module-virtual-source source_name=VirtualMic master=MicSource.monitor

any help to figure this out would be appreciated.

MayhemBill commented 2 years ago

alright, I figured it out, I updated the commands to the following:

pactl load-module module-null-sink sink_name=virtmic sink_properties=device.description=Virtual_Microphone pactl load-module module-remap-source master=virtmic.monitor source_name=virtmic source_properties=device.description=Virtual_Microphone pactl load-module module-null-sink sink_name=virthp sink_properties=device.description=Virtual_Headphones pactl load-module module-remap-source master=virthp.monitor source_name=virthp source_properties=device.description=Virtual_headphones

this allows you to have as many devices as you want.

MayhemBill commented 2 years ago

Slight update, trying to add this to the default.pa removes the dummy output, but doesn't actually create either of the 'devices', unsure why this is happening.

MayhemBill commented 2 years ago

ah, I missed the first line of the config, so it broke pulse entirely,

# include the default.pa pulseaudio config file
.include /etc/pulse/default.pa

# null sink
.ifexists module-null-sink.so
load-module module-null-sink sink_name=virtmic sink_properties=device.description=Virtual_Microphone
load-module module-null-sink sink_name=virthp sink_properties=device.description=Virtual_Headphones
.endif

# virtual source
.ifexists module-virtual-source.so
load-module module-remap-source master=virtmic.monitor source_name=virtmic source_properties=device.description=Virtual_Microphone
load-module module-remap-source master=virthp.monitor source_name=virthp source_properties=device.description=Virtual_Headphones
.endif

so theoretically, you can add any number of devices to this and they'll work, you just ned to make the description tag for it to work properly.

NapoleonWils0n commented 2 years ago

Hi Mate, i missed the notification for this issue

you do need to make sure you include the default.pa otherwise it will break everything

`

include the default.pa pulseaudio config file

.include /etc/pulse/default.pa ` your spot on how you create the virtual souces

this will also work with pipewire

heres a video i made on installing pipewire which fixes an issue with mpv and webm files audio going out of sync

ubuntu pipewire install

MayhemBill commented 2 years ago

So I am only using this on an Ubuntu "server" for OBS streaming, I need virtual input/outputs so I can stream audio from my main PC, running windows 10 and vbaudio and then Ubuntu running vban for linux and outputting to these devices.

As far as I can tell, this is the only method of doing this given the devices I am using. Which is why I need multiple of them.

NapoleonWils0n commented 2 years ago

hi mate, i dont know of any other way to create virtual audio devices on linux

im not sure if you can use jack to create virtual audio devices, i never had much luck with jack