How to send stdout to a microphone device (pipewire)

I want to send my stdout to from a periodically executed program to VirtualMic, which is a simulated microphone that I have.

the program is espeak-ng if that helps, and here is the script in question

#!/usr/bin/bash
arecord -q --device front:CARD=U0x46d0x825,DEV=0 -fS16_LE -c1 -r16000 | sprec | grep -oP "final 1: \K.*" | espeak-ng &

Did not you ask almost exactly the same question three days ago?

What you have here is piping the stdout of grep to the stdin of espeak-ng. So what is the question?

I know that grep will output it’s results to stdout.

I know nothing about the program epeak-ng , thus I do not know if it reads from stdin at all.

Hopefully the following guides will answer your slightly vague question…

https://man.archlinux.org/man/espeak-ng.1

espeak-ng has a --stdout option, want to either route that to a separate input (or output, since I can make both work.)

I have no idea what you are saying here.

Your questioning is confusing.

  • your title says something I have no idea about (how can one even want to output something to a device that is build to input something toe the system?)
  • your command gives a pipe that implements already your question on how to send stdout of one program to stdin another program.
  • and now you have something that is complete gibberish to me.

Sorry. Try to formulate your questions in a way that people that are not doing what you do will understand them.

arecord >> speech recognition >> espeak-ng >> microphone input

like in this thread.

When you read that link carefully, you will see that there people also say that you can not output something to an input device. I assume what you want is to input the sound output of your program into the sound system, or maybe capturing it is a sound file of some sort.

so then how would I output stdout from espeak-ng to an audio separate audio output?

It outputs basically to an audio device. From the man page that @deano_ferrari linked to:

-d <device>
Use the specified device to speak the audio on. If not specified, the default audio device is used.

Sorry, this is beyond my understanding, I do not know how these are defined, but IMHO you have to use an output device there (loudspeaker, headset, …) and NOT an input device (microphone)

-w
Write output to this WAV file, rather than speaking it directly.

For later usage.

[— stdout]
Write speech output to stdout.

Better not on a terminal, because there will be rather random bytes from the terminals point of view :wink:

I assume yo have to live with these possibilities.

The output seems to be in „Waveform Audio File Format“. Maybe by using --stdout, you can pipe it through an audio translator to MP3 or other.

woops, I guess I overlooked that -d option. Thanks pointing it out.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.