Re: [pulseaudio-discuss] How to combine microphone audio and music from application to pipe to video conference

2020-06-01 Thread Samir Parikh

Sean Greenslade wrote on 5/24/20 1:44 AM:

On Sat, May 23, 2020 at 11:49:54AM -0400, Samir Parikh wrote:

Ok, I'm back after researching and trying some things a bit more.

Sean Greenslade wrote on 5/16/20 1:23 AM:

This is definitely possible entirely within pulseaudio. I'll go over the
basic concepts here, then show an example.

...

Now you can begin playing music, and in the Playback tab of pavucontrol
move the music playback to the VirtualMixer.


I got this far in following your instructions but got stumped on that last
part about moving the music playback to the VirtualMixer.  This screenshot
shows my options for where to direct the Rhythmbox output:
https://imgur.com/a/PRCYV3B

If I select VirtualMixer, playback of the music continues but I can no
longer hear it.  Is there a way for me to also hear it through my own
speakers/headset?


This is possible, but adds some complexity to the setup. To hopefully
make this easier to follow, I've made a little flowchart of all the
components:

https://dumbpic.link/manu/2020-05-23_pulse_diagram_mic_mix_with_mon.png

Remember that pulseaudio draws a distinction between sources and sinks,
and normally doesn't allow you to route a source to sink or vice-versa.
So source components have a rounded face, and sink components have a
pointed face.

Certain endpoints are "exclusive," meaning that they can only have one
thing connected to or from it. These points have a grey shading to
indicate that property.

Modules with a thick border are real hardware. Modules with a thin
border are software. The dotted line around "auto monitor" refers to the
fact that it is auto-created when a virtual sink is created.

The thick lines connecting modules are the routings within Pulse. These
routings can all be modified in realtime within pavucontrol.

Hopefully this makes enough sense to help you to augment your script.
For comparison, here's the flowchart for my original suggestion that
does not let you monitor the music:

https://dumbpic.link/manu/2020-05-23_pulse_diagram_mic_mix.png

--Sean


Hi All,

I was finally able to get this work!  Thanks to the help of Sean as well 
as following some of the steps on this site[1], I was finally able to 
pipe BOTH my microphone AND the music from Rhythmbox to Jitsi while also 
being able to hear BOTH the music and the incoming video conference 
audio on my headphones!  That site also referenced a helpful Stack 
Exchange post[2] which also led me to this GitHug repository[3] which 
contained a sample script[4] which I modeled to create my own[5].


My pavucontrol settings can be found here[6].

Still lots to learn now about how to improve latency, etc. but feels 
good to have finally solved this.


Thanks again to Sean and everyone on this list who chimed in to help!

Samir

[1] https://endless.ersoft.org/pulseaudio-loopback
[2] 
https://askubuntu.com/questions/257992/how-can-i-use-pulseaudio-virtual-audio-streams-to-play-music-over-skype

[3] https://github.com/toadjaune/pulseaudio-config
[4] 
https://raw.githubusercontent.com/toadjaune/pulseaudio-config/master/pulse_setup.sh

[5] https://pastebin.com/raw/vLaYmhCe
[6] https://imgur.com/a/1wD0851
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] How to combine microphone audio and music from application to pipe to video conference

2020-06-01 Thread Sean Greenslade
On Sun, May 31, 2020 at 09:56:10PM -0400, Samir Parikh wrote:
> I've played with this a bit more to update my steps.  I corrected some
> errors and I think I was able to piece together some more steps but still
> have a few open issues.  Here's what I've got so far based on my revisions:
> https://imgur.com/NzteBvg
> 
> Step 1:  Create the music_mic_mix virtual mixer
> $ pacmd load-module module-null-sink sink_name=music_mic_mix
> $ pacmd update-sink-proplist music_mic_mix device.description=music_mic_mix

Looks good. To help out discovery later on, you can also run this
command to give the monitor source a better name:

$ pacmd update-source-proplist music_mic_mix.monitor 
device.description=music_mic_mix.monitor

> Step 2:  Create the mic_loop loopback module and specify the sink as the
> virtual mixer created in step 1 (music_mic_mix)
> $ pacmd load-module module-loopback sink=music_mic_mix

If you want to be more automated, feel free to specify a source= here
pointing to your microphone's source if you know it's name. You can
figure out the correct name with the "pacmd list-sources" command.

> Step 3:  Create the music_only virtual mixer
> $pacmd load-module module-null-sink sink_name=music_only
> $ pacmd update-sink-proplist music_only device.description=music_only
> 
> Step 4:  Create the music_loop_headphones loopback module and specify my
> headphones output as the "real sink".  (I found the name using the pacmd
> list-sinks command.)
> $ pacmd load-module module-loopback
> sink=alsa_output.usb-Plantronics_Plantronics_BT600.analog-stereo

The source here can be specified. Since we're using the auto-monitor
source from the music_only virtual sink, the format is
virt_sink_name.monitor. For example:

$ pacmd load-module module-loopback 
sink=alsa_output.usb-Plantronics_Plantronics_BT600.analog-stereo 
source=music_only.monitor

> Step 5:  Create the music_loop_videoconf loopback module and specify the
> music_mic_mix created in step 1 as the sink
> $ pacmd load-module module-loopback sink=music_mic_mix

Same deal. Add "source=music_only.monitor" to the command.
 
> Step 6:  Connect the headset microphone to the mic_loop loopback module via
> the "Recording" tab in pavucontrol.

It's possible to skip this if you did what I mentioned in reply to step
2.

> Step 7:  Direct the output of Rhythmbox to the music_only virtual mixer
> created in step 3 via the "Playback" tab in pavucontrol.

Yep.

> Step 8:  Direct the output of the music_mix_mix virtual mixer created in
> step 1 to the video conference application in the "Recording" tab of
> pavucontrol.

Yep. If you ran the extra command I mentioned in step 1, this should
have the name music_mic_mix.monitor.

Also, if the recording app doesn't try to muck with things, pulse will
remember and re-apply your selection whenever the recording app is
launched.

> My question is how do I direct the output of the music_only virtual mixer
> created in step 3 to the music_loop_headphones and music_loop_videoconf
> loopback modules created in steps 4 and 5 (indicated by the red boxes in my
> revised diagram)?

Hopefully the above helped. While verifying that this works, I created
the following shell script. You'd have to swap the hardware sink/source
names, but it does work:

#!/bin/bash

# Step 1: music_mic_mix virt sink
pacmd load-module module-null-sink sink_name=music_mic_mix
pacmd update-sink-proplist music_mic_mix device.description=music_mic_mix
pacmd update-source-proplist music_mic_mix.monitor 
device.description=music_mic_mix.monitor

# Step 2: mic_loopback
pacmd load-module module-loopback sink=music_mic_mix 
source=alsa_input.pci-_00_1b.0.analog-stereo

# Step 3: music_only virt sink
pacmd load-module module-null-sink sink_name=music_only
pacmd update-sink-proplist music_only device.description=music_only
pacmd update-source-proplist music_only.monitor 
device.description=music_only.monitor

# Step 4: loopback for headphones
pacmd load-module module-loopback 
sink=alsa_output.pci-_00_1b.0.analog-stereo source=music_only.monitor

# Step 5: music loopback for videoconference recording input
pacmd load-module module-loopback sink=music_mic_mix source=music_only.monitor

# Step 6: already done in step 2.

# Step 7: Play music to music_only virt sink

# Step 8: Record from music_mic_mix.monitor

___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] How to combine microphone audio and music from application to pipe to video conference

2020-05-31 Thread Samir Parikh

Sean Greenslade wrote on 5/24/20 1:44 AM:

On Sat, May 23, 2020 at 11:49:54AM -0400, Samir Parikh wrote:

Ok, I'm back after researching and trying some things a bit more.

Sean Greenslade wrote on 5/16/20 1:23 AM:

This is definitely possible entirely within pulseaudio. I'll go over the
basic concepts here, then show an example.

...

Now you can begin playing music, and in the Playback tab of pavucontrol
move the music playback to the VirtualMixer.


I got this far in following your instructions but got stumped on that last
part about moving the music playback to the VirtualMixer.  This screenshot
shows my options for where to direct the Rhythmbox output:
https://imgur.com/a/PRCYV3B

If I select VirtualMixer, playback of the music continues but I can no
longer hear it.  Is there a way for me to also hear it through my own
speakers/headset?


This is possible, but adds some complexity to the setup. To hopefully
make this easier to follow, I've made a little flowchart of all the
components:

https://dumbpic.link/manu/2020-05-23_pulse_diagram_mic_mix_with_mon.png

Remember that pulseaudio draws a distinction between sources and sinks,
and normally doesn't allow you to route a source to sink or vice-versa.
So source components have a rounded face, and sink components have a
pointed face.

Certain endpoints are "exclusive," meaning that they can only have one
thing connected to or from it. These points have a grey shading to
indicate that property.

Modules with a thick border are real hardware. Modules with a thin
border are software. The dotted line around "auto monitor" refers to the
fact that it is auto-created when a virtual sink is created.

The thick lines connecting modules are the routings within Pulse. These
routings can all be modified in realtime within pavucontrol.

Hopefully this makes enough sense to help you to augment your script.
For comparison, here's the flowchart for my original suggestion that
does not let you monitor the music:

https://dumbpic.link/manu/2020-05-23_pulse_diagram_mic_mix.png

--Sean

I've played with this a bit more to update my steps.  I corrected some 
errors and I think I was able to piece together some more steps but 
still have a few open issues.  Here's what I've got so far based on my 
revisions:

https://imgur.com/NzteBvg

Step 1:  Create the music_mic_mix virtual mixer
$ pacmd load-module module-null-sink sink_name=music_mic_mix
$ pacmd update-sink-proplist music_mic_mix device.description=music_mic_mix

Step 2:  Create the mic_loop loopback module and specify the sink as the 
virtual mixer created in step 1 (music_mic_mix)

$ pacmd load-module module-loopback sink=music_mic_mix

Step 3:  Create the music_only virtual mixer
$pacmd load-module module-null-sink sink_name=music_only
$ pacmd update-sink-proplist music_only device.description=music_only

Step 4:  Create the music_loop_headphones loopback module and specify my 
headphones output as the "real sink".  (I found the name using the pacmd 
list-sinks command.)
$ pacmd load-module module-loopback 
sink=alsa_output.usb-Plantronics_Plantronics_BT600.analog-stereo


Step 5:  Create the music_loop_videoconf loopback module and specify the 
music_mic_mix created in step 1 as the sink

$ pacmd load-module module-loopback sink=music_mic_mix

Step 6:  Connect the headset microphone to the mic_loop loopback module 
via the "Recording" tab in pavucontrol.


Step 7:  Direct the output of Rhythmbox to the music_only virtual mixer 
created in step 3 via the "Playback" tab in pavucontrol.


Step 8:  Direct the output of the music_mix_mix virtual mixer created in 
step 1 to the video conference application in the "Recording" tab of 
pavucontrol.


My question is how do I direct the output of the music_only virtual 
mixer created in step 3 to the music_loop_headphones and 
music_loop_videoconf loopback modules created in steps 4 and 5 
(indicated by the red boxes in my revised diagram)?


Thanks
Samir
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] How to combine microphone audio and music from application to pipe to video conference

2020-05-31 Thread Samir Parikh

Sean Greenslade wrote on 5/26/20 3:07 PM:

- In your original configuration, you had me create just one loopback
module.  In your more complicated setup, there appear to be 3 in total. Do I
just use the original
pacmd load-module module-loopback sink=virt_mix
command to create the other 2 but change the sink?


Yes, every time you call that command, you load another loopback module.
The sink= and source= options let you specify the initial state of the
connections.


Hi Sean,

I took the diagram you made for me[1] and updated it with the PulseAudio 
commands I think I need to implement it:

https://imgur.com/rTteO1n

Steps 1 and 2 were the ones you gave my in your very first reply[2]. 
I've just updated the sink_name and device.description to match the diagram.


Step 3 creates the other virtual sink.  Hopefully I got those commands 
correct.


I'm struggling, however, with the command syntax to create the other two 
loopback modules.  I'm not sure how to craft the sink= option for those 
or whether they are even required.


Any ideas or suggestions for those?

Thanks again.
Samir

[1] https://dumbpic.link/manu/2020-05-23_pulse_diagram_mic_mix_with_mon.png
[2] 
https://lists.freedesktop.org/archives/pulseaudio-discuss/2020-May/031751.html

___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] How to combine microphone audio and music from application to pipe to video conference

2020-05-26 Thread Sean Greenslade
On Tue, May 26, 2020 at 02:42:18PM -0400, Samir Parikh wrote:
> Sean Greenslade wrote on 5/24/20 1:44 AM:
> Sean,
> 
> Thanks for this!  Very helpful!  I appreciate you taking the time to also
> include the diagrams.  It helps me understand a bit more some fo the
> commands you gave earlier.
> 
> You've been very helpful and generous with your time and explanations so I
> hope I'm not reaching my limit of questions with you or the list but I have
> a few more:
> 
> - In general, what is the purpose of the "loopback module"?  It just looks
> like a pass through.  The docs[1] say that "This allows one to route audio
> from a source directly back to a sink. This module performs adaptive
> resampling to adjust for slight differences in the clock speeds of the
> source and sink devices" but I'm not sure what purpose it is serving in this
> application.

In this case, it's converting the stream type from a source to a sink.
Recall that these different types cannot be directly routed to each
other. This is why I made the distinction between the pointed ends and
the rounded ends in the diagrams.
 
> - In your original configuration, you had me create just one loopback
> module.  In your more complicated setup, there appear to be 3 in total. Do I
> just use the original
>   pacmd load-module module-loopback sink=virt_mix
> command to create the other 2 but change the sink?

Yes, every time you call that command, you load another loopback module.
The sink= and source= options let you specify the initial state of the
connections.

> - In general, is pavucontrol just used to create the "connections"?

Yes, you can use pavucontrol to modify any of the connections. As
mentioned above, if you know the source/sink names in advance, you can
use the source= and sink= options to preset them when you load the
modules.

> - Within pavucontrol, is my understanding of what the various tabs do
> correct?
>   Playback:  Shows the application sources of sound
>   Recording: Shows any application that can take sound as input
>   Output Devices: Sinks
>   Input Devices: Sources

Yes, that's correct. Note that the behavior of applications can differ,
so sometimes you will see applications appear and disappear from the
playback and recording tabs as they start and stop recording / playing
back audio. For example, Firefox will create an individial sink input
stream for every separate audio source, and delete it when the source's
tab is closed.

--Sean

___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] How to combine microphone audio and music from application to pipe to video conference

2020-05-26 Thread Samir Parikh

Sean Greenslade wrote on 5/24/20 1:44 AM:


This is possible, but adds some complexity to the setup. To hopefully
make this easier to follow, I've made a little flowchart of all the
components:

https://dumbpic.link/manu/2020-05-23_pulse_diagram_mic_mix_with_mon.png

Remember that pulseaudio draws a distinction between sources and sinks,
and normally doesn't allow you to route a source to sink or vice-versa.
So source components have a rounded face, and sink components have a
pointed face.

Certain endpoints are "exclusive," meaning that they can only have one
thing connected to or from it. These points have a grey shading to
indicate that property.

Modules with a thick border are real hardware. Modules with a thin
border are software. The dotted line around "auto monitor" refers to the
fact that it is auto-created when a virtual sink is created.

The thick lines connecting modules are the routings within Pulse. These
routings can all be modified in realtime within pavucontrol.

Hopefully this makes enough sense to help you to augment your script.
For comparison, here's the flowchart for my original suggestion that
does not let you monitor the music:

https://dumbpic.link/manu/2020-05-23_pulse_diagram_mic_mix.png

--Sean



Sean,

Thanks for this!  Very helpful!  I appreciate you taking the time to 
also include the diagrams.  It helps me understand a bit more some fo 
the commands you gave earlier.


You've been very helpful and generous with your time and explanations so 
I hope I'm not reaching my limit of questions with you or the list but I 
have a few more:


- In general, what is the purpose of the "loopback module"?  It just 
looks like a pass through.  The docs[1] say that "This allows one to 
route audio from a source directly back to a sink. This module performs 
adaptive resampling to adjust for slight differences in the clock speeds 
of the source and sink devices" but I'm not sure what purpose it is 
serving in this application.


- In your original configuration, you had me create just one loopback 
module.  In your more complicated setup, there appear to be 3 in total. 
Do I just use the original

pacmd load-module module-loopback sink=virt_mix
command to create the other 2 but change the sink?

- In general, is pavucontrol just used to create the "connections"?

- Within pavucontrol, is my understanding of what the various tabs do 
correct?

Playback:  Shows the application sources of sound
Recording: Shows any application that can take sound as input
Output Devices: Sinks
Input Devices: Sources

Thanks again!
Samir

[1] 
https://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/Modules/#module-loopback

___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] How to combine microphone audio and music from application to pipe to video conference

2020-05-23 Thread Sean Greenslade
On Sat, May 23, 2020 at 11:49:54AM -0400, Samir Parikh wrote:
> Ok, I'm back after researching and trying some things a bit more.
> 
> Sean Greenslade wrote on 5/16/20 1:23 AM:
> > This is definitely possible entirely within pulseaudio. I'll go over the
> > basic concepts here, then show an example.
> ...
> > Now you can begin playing music, and in the Playback tab of pavucontrol
> > move the music playback to the VirtualMixer.
> 
> I got this far in following your instructions but got stumped on that last
> part about moving the music playback to the VirtualMixer.  This screenshot
> shows my options for where to direct the Rhythmbox output:
> https://imgur.com/a/PRCYV3B
> 
> If I select VirtualMixer, playback of the music continues but I can no
> longer hear it.  Is there a way for me to also hear it through my own
> speakers/headset?

This is possible, but adds some complexity to the setup. To hopefully
make this easier to follow, I've made a little flowchart of all the
components:

https://dumbpic.link/manu/2020-05-23_pulse_diagram_mic_mix_with_mon.png

Remember that pulseaudio draws a distinction between sources and sinks,
and normally doesn't allow you to route a source to sink or vice-versa.
So source components have a rounded face, and sink components have a
pointed face.

Certain endpoints are "exclusive," meaning that they can only have one
thing connected to or from it. These points have a grey shading to
indicate that property.

Modules with a thick border are real hardware. Modules with a thin
border are software. The dotted line around "auto monitor" refers to the
fact that it is auto-created when a virtual sink is created.

The thick lines connecting modules are the routings within Pulse. These
routings can all be modified in realtime within pavucontrol.

Hopefully this makes enough sense to help you to augment your script.
For comparison, here's the flowchart for my original suggestion that
does not let you monitor the music:

https://dumbpic.link/manu/2020-05-23_pulse_diagram_mic_mix.png

--Sean

___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] How to combine microphone audio and music from application to pipe to video conference

2020-05-23 Thread Samir Parikh

Ok, I'm back after researching and trying some things a bit more.

Sean Greenslade wrote on 5/16/20 1:23 AM:
> This is definitely possible entirely within pulseaudio. I'll go over the
> basic concepts here, then show an example.
...
> Now you can begin playing music, and in the Playback tab of pavucontrol
> move the music playback to the VirtualMixer.

I got this far in following your instructions but got stumped on that 
last part about moving the music playback to the VirtualMixer.  This 
screenshot shows my options for where to direct the Rhythmbox output:

https://imgur.com/a/PRCYV3B

If I select VirtualMixer, playback of the music continues but I can no 
longer hear it.  Is there a way for me to also hear it through my own 
speakers/headset?


> Finally, begin recording / using your conferenece application. In the
> Recording tab of pavucontrol, find the entry for the recording
> application / conference application. Change its microphone to "Monitor
> of Null Output", which is the virtual source that pulls from the
> virt_mix sink. Verify that it is behaving the way you want.

I did this part as you described:
https://imgur.com/a/HXR5tdz

The great news is that when I launch Jitsi, the app picks up the music 
stream.  I confirmed this by joining the video conference from another 
device and the music comes through clearly, using the my laptop's 
default microphone!

https://imgur.com/a/wbTvysv

> Hopefully this isn't too confusing. Feel free to ask for clarification
> if needed. I've set up a number of complex audio workflows in linux,
> some of which took a lot of experimentation to get working well.

The only issue now is that Jitsi doesn't seem to be picking up my laptop 
microphone -- it just picks up the music.  Did I do something wrong?  If 
I can get Jitsi to pick up my microphone AND if I can somehow hear the 
music myself, I think we've NAILED this!


Thanks in advance!
Samir
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] How to combine microphone audio and music from application to pipe to video conference

2020-05-18 Thread Sean Greenslade
On Mon, May 18, 2020 at 03:59:45PM -0400, Samir Parikh wrote:
> Sean Greenslade wrote on 5/17/20 10:04 PM:
> > On Sun, May 17, 2020 at 07:01:25AM -0400, Joe wrote:
> > > Someone should write a small book on this. I bet it would sell.
> > 
> > Hah, you know, typing up this response has made me consider doing a
> > proper write-up for my much more elaborate/crazy/overcomplicated setup
> > involving network audio, pulse, JACK, carla, and calf LV2 plugins to do
> > automatic livestream background music replacement with gate-triggered
> > music ducking.
> > 
> > https://dumbpic.link/manu/2020-05-17_unmufflegate_carla_flow.png
> > 
> > --Sean
> 
> If it can clearly explain the basics of Linux audio networking, the concepts
> of Pulse, JACK and how they differ, and how to do things like in my original
> question, I'll be the first in line to put down 10-20 USD for a copy!

So, I did end up doing a writeup of my more intense
Pulse/JACK/Carla/Calf setup. It's definitely on the complicated side,
and not at all necessary for solving the original quesion posed in this
thread, but if people are interested:

http://seangreenslade.com/projects/2020-05_stream_audio_processing/

On the topic of Pulse vs. JACK, I simply don't have much experience
using JACK. In my limited experience, JACK is missing some of the
desktop-focused convenience features that Pulse has, but JACK is more
focused on realtime performance and low-latency, pro-audio workflows.

In the post, I didn't go into much detail on the network audio side of
things, mostly because the solution I settled on (Pulse native TCP)
works remarkably well with basically no effort or tweaks on my part. If
you're in a totally Linux-based environment, Pulse TCP is the way to go.
I had a few false starts with RTP/RTSP and multicast, which turned out
to be very fiddly to get working reliably.

--Sean

___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] How to combine microphone audio and music from application to pipe to video conference

2020-05-18 Thread Mario Sottile - Marionetas Mey
Sorry for not reading every mail of this thread... but I want to share 
with you my experience with PulseAudio - Zoom. I tried a lot of things 
to make mic-music work. I have onboard soundcard and a Logitech USB 
headphones/mic. And, finally, I end using other method, completly different.


- For the first time, I tried to use mic and music from OBS and create 
"something" to make Zoom take the audio: Pulseaudio remap module. I 
output all the audio from OBS to my speakers and remap it to a source 
module.


- Later, I discovered that audio output (monitor) from OBS was not 
stable... so, I create a system using pulseaudio sink modules, SoX and 
Play commands from console. Also, with SoX, I applied some filters in 
realtime (pitch, eq, highpass, echo and reverb).


- Then, I tried to hear only the music and Zoom in headphones and send 
my voice and the music to speakers (and turn them off "hardwarely"). For 
this, I created pulseaudio loopback modules and combine modules. It 
appear to work everything Ok... till I saw my CPU: on fire. I don't have 
a modern computer. This Pulseaudio consumtion and OBS consumption 
and Zoom consumption, the video was awfull. With luck: 5fps or less.


- I forgot to mention that the first try was with Jack. But, as I said, 
my computer was not good for OBS and Jack. So, I desisted.


- Finally, by trying to optimize OBS resolution, modules, SoX, Play and 
getting lot of headache... I tried Jack again. With stting OBS 
resolution at 704x396 instead of HD (less than half CPU process), I 
could use Jack with 128 frames: 8ms latency. So, I created a patch in 
PureData and connect what I want to what I want. I hear what I want and 
send what I want. Filters, fadeins, fadeouts, music, samples... 
everything I want.


Sorry that this is Pulseaudio maillist, but my advice is: use Jack.

If you still need pacmd/pactl commands to make it work as my first 
tries... ask for them. I can share them with you.


Good luck.

Marionetas Mey

Mario Sottile - Director
(011) 15.6283.1576
www.mariomey.com.ar
i...@mariomey.com.ar

El 18/5/20 a las 16:59, Samir Parikh escribió:

Sean Greenslade wrote on 5/17/20 10:04 PM:

On Sun, May 17, 2020 at 07:01:25AM -0400, Joe wrote:

Someone should write a small book on this. I bet it would sell.


Hah, you know, typing up this response has made me consider doing a
proper write-up for my much more elaborate/crazy/overcomplicated setup
involving network audio, pulse, JACK, carla, and calf LV2 plugins to do
automatic livestream background music replacement with gate-triggered
music ducking.

https://dumbpic.link/manu/2020-05-17_unmufflegate_carla_flow.png

--Sean


If it can clearly explain the basics of Linux audio networking, the 
concepts of Pulse, JACK and how they differ, and how to do things like 
in my original question, I'll be the first in line to put down 10-20 
USD for a copy!

___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] How to combine microphone audio and music from application to pipe to video conference

2020-05-18 Thread Samir Parikh

Sean Greenslade wrote on 5/17/20 10:04 PM:

On Sun, May 17, 2020 at 07:01:25AM -0400, Joe wrote:

Someone should write a small book on this. I bet it would sell.


Hah, you know, typing up this response has made me consider doing a
proper write-up for my much more elaborate/crazy/overcomplicated setup
involving network audio, pulse, JACK, carla, and calf LV2 plugins to do
automatic livestream background music replacement with gate-triggered
music ducking.

https://dumbpic.link/manu/2020-05-17_unmufflegate_carla_flow.png

--Sean


If it can clearly explain the basics of Linux audio networking, the 
concepts of Pulse, JACK and how they differ, and how to do things like 
in my original question, I'll be the first in line to put down 10-20 USD 
for a copy!

___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] How to combine microphone audio and music from application to pipe to video conference

2020-05-18 Thread Samir Parikh

Sean Greenslade wrote on 5/17/20 12:29 AM:


Feel free to experiment and ask about anything else that's unclear. I
know it took me a while to wrap my head around the concepts of sources
vs source outputs vs sinks vs sink inputs.

--Sean



Sean,

Thanks again for your detailed responses.  I am going to need a few days 
to digest what you've provided and to also read up on the documentation 
you linked to.  I posted the same question over at the Linux Audio User 
mailing list[1] and got suggestions to try solving my problem with OBS 
as well as JACK, so I've got a few things to try out.


Rest assured, I will post back here with either a solution or, more 
likely, more questions!


Thanks
Samir

[1] 
https://lists.linuxaudio.org/archives/linux-audio-user/2020-May/113035.html

___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] How to combine microphone audio and music from application to pipe to video conference

2020-05-17 Thread Sean Greenslade
On Sun, May 17, 2020 at 07:01:25AM -0400, Joe wrote:
> Someone should write a small book on this. I bet it would sell.

Hah, you know, typing up this response has made me consider doing a
proper write-up for my much more elaborate/crazy/overcomplicated setup
involving network audio, pulse, JACK, carla, and calf LV2 plugins to do
automatic livestream background music replacement with gate-triggered
music ducking.

https://dumbpic.link/manu/2020-05-17_unmufflegate_carla_flow.png

--Sean

___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] How to combine microphone audio and music from application to pipe to video conference

2020-05-17 Thread Joe
Someone should write a small book on this. I bet it would sell.

Joe

On 5/16/20 1:23 AM, Sean Greenslade wrote:
> On Fri, May 15, 2020 at 11:04:00PM -0400, Samir Parikh wrote:
>> Hello,
>>
>> I am trying to combine the audio from my microphone (either built in
>> microphone from my laptop or bluetooth headset) with music playing
>> from Rhythmbox Music Player running on Ubuntu 16.04 and pipe that as
>> the audio input to video conference services such as Jitsi.
>>
>> I don't know much about Linux audio internals and wasn't sure how to
>> do this.  Can I do this completely via the operating system using
>> Pulse Audio?  Do I need to do something with Jack?  Or do I need
>> specialized software such as OBS, Ardour or Reaper?
>>
>> Any help or suggestions on pointing me in the right direction or how
>> to get started would be greatly appreciated.  I'm hoping that I can do
>> this completely through software without external hardware such as a
>> mixer or something.
> This is definitely possible entirely within pulseaudio. I'll go over the
> basic concepts here, then show an example.
>
> Pulse has two types of sound devices, sources and sinks. Sources are
> input devices like microphones. Sinks are output devices like speaker or
> headphone ports. Programs that work with sound can attach to sources in
> order to pull sound in, and can attach to sinks to output sound. I
> suggest playing around with the "pavucontrol" utility to see what
> sources and sinks are present on your machine. It also shows what
> applications are recording or playing back audio, and allows you to
> redirect existing audio streams on the fly. It's quite handy.
>
> Within pavucontrol, there is a separation between sources and sinks, and
> the two cannot directly be mixed. In order to mix a music sink and a
> microphone source, we'll use a few manually-loaded pulseaduio modules.
> Note that this can easily be scripted once you find the set of commands
> that work well for your setup.
>
> We'll first need to create a "virtual mixer" device. This will receive
> both the music and the voice streams and mix them together. Run the
> following commands:
>
> $ pacmd load-module module-null-sink sink_name=virt_mix
> $ pacmd update-sink-proplist virt_mix device.description=VirtualMixer
>
> Pavucontrol should now list "VirtualMixer" in the Output Devices tab.
>
> Next, you'll need a loopback device to feed your microphone's sound to
> this virtual mixer. Run this command:
>
> $ pacmd load-module module-loopback sink=virt_mix
>
> In pavucontrol, go to the Recording tab and change the Show dropdown to
> All Streams. There should be an entry titled "Loopback to VirtualMixer"
> with a dropdown to select the loop input. Pick the appropriate input
> that corresponds to your microphone.
>
> Now you can begin playing music, and in the Playback tab of pavucontrol
> move the music playback to the VirtualMixer.
>
> Finally, begin recording / using your conferenece application. In the
> Recording tab of pavucontrol, find the entry for the recording
> application / conference application. Change its microphone to "Monitor
> of Null Output", which is the virtual source that pulls from the
> virt_mix sink. Verify that it is behaving the way you want.
>
> Hopefully this isn't too confusing. Feel free to ask for clarification
> if needed. I've set up a number of complex audio workflows in linux,
> some of which took a lot of experimentation to get working well.
>
> --Sean
>
> ___
> pulseaudio-discuss mailing list
> pulseaudio-discuss@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] How to combine microphone audio and music from application to pipe to video conference

2020-05-16 Thread Sean Greenslade
On Sat, May 16, 2020 at 11:34:56PM -0400, Samir wrote:
> Sean Greenslade wrote on 5/16/20 1:23 AM:
> 
> > Pulse has two types of sound devices, sources and sinks. Sources are
> > input devices like microphones. Sinks are output devices like speaker or
> > headphone ports. Programs that work with sound can attach to sources in
> > order to pull sound in, and can attach to sinks to output sound. I
> > suggest playing around with the "pavucontrol" utility to see what
> > sources and sinks are present on your machine. It also shows what
> > applications are recording or playing back audio, and allows you to
> > redirect existing audio streams on the fly. It's quite handy.
> > 
> Sean,
> 
> Thanks so much for your quick and detailed reply to my post (and apologies
> for taking so long to respond!).

No worries, email lists are meant to be asynchronous.

> I'm still trying to wrap my head around your steps but am encouraged that
> this may be possible with just Pulse Audio and no external hardware.
> 
> When I run "pavucontrol" with Rhythmbox playing music, here is what the
> "Input Devices" tab looks like with "All Input Devices" shown:
> https://imgur.com/a/kSth4O1
> 
> The "Monitor of Built-in Audio Analog Stereo" input corresponds to the music
> coming from Rhythmbox.  The "Built-in Audio Analog Stereo" is my laptop's
> built-in microphone.

Every sink device (audio outputting hardware), both real and virtual,
will automatically have a "monitor source" created for it. This monitor
source allows a recording app to record the sounds that a sound output
is producing.

> Given that, do I still run your two commands to create the "virtual mixer"?

If your goal was to only play your system audio into the
videoconference, you would indeed be able to use just the automatic
monitor source. However, you would need to make sure the videoconference
app is not outputting its sound to that sound card, otherwise you would
be looping the conference audio back into the conference and causing
echos and possibly feedback.

With my suggested virtual sink approach, you can feed your music app
into the virutal sink and record only that. Meanwhile the
videoconference audio output goes to your real soundcard output.

The third command in my original response takes care of the task of
feeding microphone audio into the virtual mixer. This is not set up
automatically because it would be easy to accidentally feed your mic
into your speakers and cause loud feedback. By specifying the virtual
mixer sink in the command, this prevents that incorrect routing.

> $ pacmd load-module module-null-sink sink_name=virt_mix
> $ pacmd update-sink-proplist virt_mix device.description=VirtualMixer
> $ pacmd load-module module-loopback sink=virt_mix
> 
> While I'm comfortable on the command line, I don't know anything about Pulse
> Audio so just wanted to double-check and take this step-by-step.

The nice thing about doing this via the command line is that the changes
are not permanent. If you find that things wind up in an unexpected
state, you can simply kill pulseaudio and let it respawn with its
default settings:

$ pulseaudio -k

There's lots of information about the modules I've used here on the
pulseaudio online docs:

https://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/Modules/#module-loopback

Feel free to experiment and ask about anything else that's unclear. I
know it took me a while to wrap my head around the concepts of sources
vs source outputs vs sinks vs sink inputs.

--Sean

___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] How to combine microphone audio and music from application to pipe to video conference

2020-05-16 Thread Samir

Sean Greenslade wrote on 5/16/20 1:23 AM:


Pulse has two types of sound devices, sources and sinks. Sources are
input devices like microphones. Sinks are output devices like speaker or
headphone ports. Programs that work with sound can attach to sources in
order to pull sound in, and can attach to sinks to output sound. I
suggest playing around with the "pavucontrol" utility to see what
sources and sinks are present on your machine. It also shows what
applications are recording or playing back audio, and allows you to
redirect existing audio streams on the fly. It's quite handy.


Sean,

Thanks so much for your quick and detailed reply to my post (and 
apologies for taking so long to respond!).


I'm still trying to wrap my head around your steps but am encouraged 
that this may be possible with just Pulse Audio and no external hardware.


When I run "pavucontrol" with Rhythmbox playing music, here is what the 
"Input Devices" tab looks like with "All Input Devices" shown: 
https://imgur.com/a/kSth4O1


The "Monitor of Built-in Audio Analog Stereo" input corresponds to the 
music coming from Rhythmbox.  The "Built-in Audio Analog Stereo" is my 
laptop's built-in microphone.


Given that, do I still run your two commands to create the "virtual mixer"?

$ pacmd load-module module-null-sink sink_name=virt_mix
$ pacmd update-sink-proplist virt_mix device.description=VirtualMixer

While I'm comfortable on the command line, I don't know anything about 
Pulse Audio so just wanted to double-check and take this step-by-step.


Thanks
Samir
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] How to combine microphone audio and music from application to pipe to video conference

2020-05-15 Thread Sean Greenslade
On Fri, May 15, 2020 at 11:04:00PM -0400, Samir Parikh wrote:
> Hello,
> 
> I am trying to combine the audio from my microphone (either built in
> microphone from my laptop or bluetooth headset) with music playing
> from Rhythmbox Music Player running on Ubuntu 16.04 and pipe that as
> the audio input to video conference services such as Jitsi.
> 
> I don't know much about Linux audio internals and wasn't sure how to
> do this.  Can I do this completely via the operating system using
> Pulse Audio?  Do I need to do something with Jack?  Or do I need
> specialized software such as OBS, Ardour or Reaper?
> 
> Any help or suggestions on pointing me in the right direction or how
> to get started would be greatly appreciated.  I'm hoping that I can do
> this completely through software without external hardware such as a
> mixer or something.

This is definitely possible entirely within pulseaudio. I'll go over the
basic concepts here, then show an example.

Pulse has two types of sound devices, sources and sinks. Sources are
input devices like microphones. Sinks are output devices like speaker or
headphone ports. Programs that work with sound can attach to sources in
order to pull sound in, and can attach to sinks to output sound. I
suggest playing around with the "pavucontrol" utility to see what
sources and sinks are present on your machine. It also shows what
applications are recording or playing back audio, and allows you to
redirect existing audio streams on the fly. It's quite handy.

Within pavucontrol, there is a separation between sources and sinks, and
the two cannot directly be mixed. In order to mix a music sink and a
microphone source, we'll use a few manually-loaded pulseaduio modules.
Note that this can easily be scripted once you find the set of commands
that work well for your setup.

We'll first need to create a "virtual mixer" device. This will receive
both the music and the voice streams and mix them together. Run the
following commands:

$ pacmd load-module module-null-sink sink_name=virt_mix
$ pacmd update-sink-proplist virt_mix device.description=VirtualMixer

Pavucontrol should now list "VirtualMixer" in the Output Devices tab.

Next, you'll need a loopback device to feed your microphone's sound to
this virtual mixer. Run this command:

$ pacmd load-module module-loopback sink=virt_mix

In pavucontrol, go to the Recording tab and change the Show dropdown to
All Streams. There should be an entry titled "Loopback to VirtualMixer"
with a dropdown to select the loop input. Pick the appropriate input
that corresponds to your microphone.

Now you can begin playing music, and in the Playback tab of pavucontrol
move the music playback to the VirtualMixer.

Finally, begin recording / using your conferenece application. In the
Recording tab of pavucontrol, find the entry for the recording
application / conference application. Change its microphone to "Monitor
of Null Output", which is the virtual source that pulls from the
virt_mix sink. Verify that it is behaving the way you want.

Hopefully this isn't too confusing. Feel free to ask for clarification
if needed. I've set up a number of complex audio workflows in linux,
some of which took a lot of experimentation to get working well.

--Sean

___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss


[pulseaudio-discuss] How to combine microphone audio and music from application to pipe to video conference

2020-05-15 Thread Samir Parikh
Hello,

I am trying to combine the audio from my microphone (either built in
microphone from my laptop or bluetooth headset) with music playing
from Rhythmbox Music Player running on Ubuntu 16.04 and pipe that as
the audio input to video conference services such as Jitsi.

I don't know much about Linux audio internals and wasn't sure how to
do this.  Can I do this completely via the operating system using
Pulse Audio?  Do I need to do something with Jack?  Or do I need
specialized software such as OBS, Ardour or Reaper?

Any help or suggestions on pointing me in the right direction or how
to get started would be greatly appreciated.  I'm hoping that I can do
this completely through software without external hardware such as a
mixer or something.

Thanks in advance.

Samir
___
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss