9

This question is about parsing audio data as a microphone input.

How do I want to use this?

Since I'm a mute, I want to be able to use TTS data, such as:

espeak-ng "Hello World" --stdout | some-magical-program

Allowing me to use an input of text to speak, without needing them to check text chat everytime.

muru
  • 193,181
  • 53
  • 473
  • 722
Ezard
  • 93
  • 5
  • 3
    Just to clarify, you would like to direct the output from `espeak-ng` (or another tool) into an application, such as Teams/Skype/NewRow/etc.? – matigo Mar 25 '22 at 05:15
  • 2
    If you can get the TTS program to output to a speaker, you could create a virtual microphone linked to a virtual speaker you create. The program would output to the virtual speaker, which could pass it on to a virtual microphone, which Zoom listens from. If you don’t get a good answer, I will put a bounty on this. – cocomac Mar 25 '22 at 06:12
  • @matigo Yes, that is precisely the solution I'm seeking. – Ezard Mar 25 '22 at 08:17
  • @cocomac I would love to hear the process of this. If by bounty you mean you already know a solution and would love to get paid for it, I would be happy to pay for this. – Ezard Mar 25 '22 at 08:19
  • 1
    Bounty means, **he** will "pay" for it (with reputation points), not you. – pLumo Mar 25 '22 at 08:36
  • Check this https://unix.stackexchange.com/questions/82259/how-to-pipe-audio-output-to-mic-input – pLumo Mar 25 '22 at 08:38
  • I can confirm that using the method in the link that pLumo provided will work nicely with `espeak-ng` in Microsoft Teams. I did not try any other application, but there's no reason to think that it would not work. This is not a "beautiful" solution, but it certainly gets the job done. – matigo Mar 25 '22 at 08:58

1 Answers1

3

Note: This is an updated version of the U&L answer that pLumo linked to.

PulseAudio makes it possible to redirect audio to an application as though the sound were coming from the microphone. Fortunately, this can be done with a GUI, too.

Prerequisites:

If you do not already have PulseAudio Control (pavucontrol) on your computer, you will want to install this. It can be done via the Terminal like this:

sudo apt install pavucontrol

Configuring PulseAudio:

  1. Open PulseAudio Control: PulseAudio Control

  2. Click the "Input Devices" tab, then select "Monitors" from the bottom filter: Input Devices

  3. Click on the "Recording" tab. You will likely see the list is empty: Recording

    Now comes the part where we redirect audio to an application. To do this, we must have something that is actively using the microphone. For the sake of this example, I will be using a video call performed within a browser, but this will work with any application that can use the microphone, from Audacity to OBS to Zoom.

  4. From the application that you would like to communicate with, begin the call. Your microphone can be muted during this process.

  5. The "Recording" tab in PulseAudio Control will now show the application that is using the microphone: Recording Active Note: The bar under "Silence" will now move to indicate it is picking up sound.

  6. Change the "from" selection from the current microphone to "Monitor of Built-in Analogue Stereo". This may be named slightly differently on your system, but the value will start as "Monitor of ...": Recording a Different Source

  7. Use espeak-ng (or any other application) to send sound:

    espeak-ng "Here we have a basic message that will be heard locally as well as over the call."
    

    Confirmed working during call earlier today.

    If you use pico2wave, you will need to run two commands to have this work:

    pico2wave -w out.wav -l en-US "Here is another basic message that will be heard locally as well as over the call."; aplay out.wav
    

Things to Know:

  • all sounds from the computer are sent across the call when this mechanism is active, so any notification dings will be heard loud and clear by people on the call
  • using the mute button during a call seems to work exactly as expected, which can resolve the distraction issue caused by the previous point
  • your hardware microphone will not be active when this is running, so people will not hear you cough, type, or take a sip of coffee
matigo
  • 20,403
  • 7
  • 43
  • 70