[pulseaudio-discuss] How to create a virtual microphone with source set as default monitor device?
Sean Greenslade
sean at seangreenslade.com
Tue Sep 15 21:34:27 UTC 2020
On Sun, Sep 13, 2020 at 05:18:23PM +0000, guest271314 wrote:
> This project started attempting to capture the output of
> window.speechSynthesis.speak().
>
> Consider https://stackoverflow.com/a/43553706.
>
> If run $ pacmd list-sink-inputs will get
>
> index: 219
> driver: <protocol-native.c>
> flags:
> state: RUNNING
> sink: 4 <alsa_output.pci-0000_00_14.2.analog-stereo>
> volume: mono: 64460 / 98% / -0.43 dB
> balance 0.00
> muted: no
> current latency: 0.00 ms
> requested latency: 0.59 ms
> sample spec: s16le 1ch 22050Hz
> channel map: mono
> Mono
> resample method: speex-float-1
> module: 14
> client: 192 <speech-dispatcher-espeak-ng>
> properties:
> media.name = "playback"
> application.name = "speech-dispatcher-espeak-ng"
> native-protocol.peer = "UNIX socket client"
> native-protocol.version = "33"
> application.process.id = "45464"
> application.process.user = "ubuntu-studio"
> application.process.host = "ubuntu-studio"
> application.process.binary = "sd_espeak-ng"
> application.language = "C"
> window.x11.display = ":0.0"
> application.process.machine_id = "<id>"
> application.process.session_id = "<id>"
> module-stream-restore.id =
> "sink-input-by-application-name:speech-dispatcher-espeak-ng"
>
> $ pacmd list-sources
>
> 2 source(s) available.
> * index: 4
> name: <alsa_input.usb-046d_0804_0B17FC60-02.mono-fallback>
> driver: <module-alsa-card.c>
> flags: HARDWARE HW_MUTE_CTRL HW_VOLUME_CTRL DECIBEL_VOLUME LATENCY
> DYNAMIC_LATENCY
> state: RUNNING
> suspend cause: (none)
> priority: 9040
> volume: mono: 0 / 0% / -inf dB
> balance 0.00
> base volume: 20724 / 32% / -30.00 dB
> volume steps: 65537
> muted: yes
> current latency: 4.60 ms
> max rewind: 0 KiB
> sample spec: s16le 1ch 48000Hz
> channel map: mono
> Mono
> used by: 1
> linked by: 1
> configured latency: 40.00 ms; range is 0.50 .. 2000.00 ms
> card: 1 <alsa_card.usb-046d_0804_0B17FC60-02>
> module: 8
> properties:
> alsa.resolution_bits = "16"
> device.api = "alsa"
> device.class = "sound"
> alsa.class = "generic"
> alsa.subclass = "generic-mix"
> alsa.name = "USB Audio"
> alsa.id = "USB Audio"
> alsa.subdevice = "0"
> alsa.subdevice_name = "subdevice #0"
> alsa.device = "0"
> alsa.card = "1"
> alsa.card_name = "USB Device 0x46d:0x804"
> alsa.long_card_name = "USB Device 0x46d:0x804 at
> usb-0000:00:12.0-1.4, high speed"
> alsa.driver_name = "snd_usb_audio"
> device.bus_path = "pci-0000:00:12.0-usb-0:1.4:1.2"
> sysfs.path =
> "/devices/pci0000:00/0000:00:12.0/usb1/1-1/1-1.4/1-1.4:1.2/sound/card1"
> udev.id = "usb-046d_0804_0B17FC60-02"
> device.bus = "usb"
> device.vendor.id = "046d"
> device.vendor.name = "<vendor>"
> device.product.id = "0804"
> device.product.name = "<name>"
> device.serial = "046d_0804_0B17FC60"
> device.form_factor = "webcam"
> device.string = "hw:1"
> device.buffering.buffer_size = "192000"
> device.buffering.fragment_size = "96000"
> device.access_mode = "mmap+timer"
> device.profile.name = "mono-fallback"
> device.profile.description = "Mono"
> device.description = "<description>"
> module-udev-detect.discovered = "1"
> device.icon_name = "camera-web-usb"
> ports:
> analog-input-mic: Microphone (priority 8700, latency offset 0
> usec, available: unknown)
> properties:
> device.icon_name = "audio-input-microphone"
> active port: <analog-input-mic>
>
> One part of what am trying to do is create a virtual microphone that
> takes input from speech-dispatcher-espeak-ng persistently or route
> output from speech-dispatcher-espeak-ng to the microphone, so that
> when capture the microphone the output will be from speech-dispatcher.
> How to achieve that?
$ pacmd load-module module-null-sink sink_name=feed_espeak_to_me
$ pacmd update-sink-proplist feed_espeak_to_me device.description="\"Feed Espeak\""
$ pacmd update-source-proplist virtual_mic_espeak_output device.description="\"ESpeak output virtual mic\""
Point Espeak's output to the "Feed Espeak" sink, and point your
recording application at the "ESpeak output virtual mic".
--Sean
More information about the pulseaudio-discuss
mailing list