[pulseaudio-discuss] How to create a virtual microphone with source set as default monitor device?
guest271314
guest271314 at gmail.com
Tue Sep 8 00:03:59 UTC 2020
> I doubt that will be possible. Pavucontrol makes use of the native
pulseaudio APIs, which are not exposed to javascript.
If mpv can be embedded in an HTML document
https://github.com/Kagami/mpv.js it should be possible to embed
pavucontrol or pavucontrol-qt
(https://doc.qt.io/qt-5/qtwebchannel-javascript.html ;
https://medium.com/@petar.koretic/why-you-should-use-qt-qml-for-you-next-cross-platform-application-part-1-desktop-5e6d8856b7b4)
in particular in a browser; for example using WebAssembly; WASI;
Native Messaging; at least the ability to control Recording tab (-t 2)
from JavaScript or an HTML form.
> After reading through those bug reports and related issue links, it's
pretty clear that this is not a use case that they are particularly
interested in supporting.
The majority of own repositories at github are dedicated to fixing
WontFix; supporting SSML parsing; variable width and height video
capture with ability to merge multiple tracks into a single media
container, or stream media without a container; streaming audio
potentially infinite input streams, that is, a dynamic Internet radio
station; capturing speech synthesis output from Web Speech API, which
is the origin of this use case of capturing system audio output.
> May I perhaps suggest using a different
browser? Firefox had no problem with monitor inputs last time I
checked.
Interestingly, am completing testing of another workaround where since
Firefox does capture monitor devices, a new, dedicated instance of
Nightly is started prior to launching Chromium, the MediaStreamTrack
and MediaStream therefrom are added to a WebRTC RTCPeerConnection, and
currently using clipboard for signaling which is not ideal though is
one way to exchange text data between different browsers, accessing
the monitor device at Chromium instance generated at Nightly
https://gist.github.com/guest271314/04a539c00926e15905b86d05138c113c.
That approach avoids writing and reading raw PCM to memory.
> No idea, I've never done it myself. The example listed in the online
docs shows a simple stereo swap, so you could presumably adapt it by
switching the channels to be non-swapped (and of course substitute your
specific master source name).
Not sure precisely how to begin.
Am still trying to gather the specific commands in code that
pavucontrol uses when setting the stream at the UI. Am not certain
what to pass to pactl move-source-output at what time
https://gitlab.freedesktop.org/pulseaudio/pavucontrol/-/issues/91#note_590795.
On Mon, Sep 7, 2020 at 2:31 PM Sean Greenslade <sean at seangreenslade.com> wrote:
>
> On Mon, Sep 07, 2020 at 12:31:22AM -0700, guest271314 wrote:
> > > There are a couple of options. One is to simply redirect the sink input
> > > once it is opened (e.g. with pavucontrol).
> >
> > That option is used at
> > https://github.com/guest271314/captureSystemAudio#launch_pavucontrol.
> >
> > For the pavucontrol option the next goal is to embed pavucontrol in an
> > HTML document.
>
> I doubt that will be possible. Pavucontrol makes use of the native
> pulseaudio APIs, which are not exposed to javascript.
>
> > > If you really need a non-monitor source device to be present, I think
> > > your best option would be module-remap-source. It shouldn't be too hard
> > > to come up with a "remap" that's just a passthrough:
> > >
> > > https://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/Modules/#module-remap-source
> >
> > Chromium is expecting a microphone device. Currently if a monitor is
> > set at command line the capture throws an exception, see
> > https://bugs.chromium.org/p/chromium/issues/detail?id=931749.
>
> After reading through those bug reports and related issue links, it's
> pretty clear that this is not a use case that they are particularly
> interested in supporting. May I perhaps suggest using a different
> browser? Firefox had no problem with monitor inputs last time I
> checked.
>
> > Have so far tried kernel module and null-sink without achieving
> > capture of system audio.
> >
> > What is the command for the remap option for this case?
>
> No idea, I've never done it myself. The example listed in the online
> docs shows a simple stereo swap, so you could presumably adapt it by
> switching the channels to be non-swapped (and of course substitute your
> specific master source name).
>
> https://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/Modules/#module-remap-source
>
> --Sean
>
> _______________________________________________
> pulseaudio-discuss mailing list
> pulseaudio-discuss at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
More information about the pulseaudio-discuss
mailing list