pico2wave only supports outputting to a file (edit: with extension .wav). How can I coerce the output into a pipe for aplay, without cleaning up any named pipes or temporary files or a wrapper script?

Ie, pico2wave -w tmp.wav "test" && aplay tmp.wav && rm tmp.wav creates a temporary file, and is thus not what I'm looking for as a solution.

  • 1
    Another option might be a LD_PRELOAD hack that changes the system calls pico2wave uses to instead target the stdout device.
    – thrig
    Commented Nov 21, 2016 at 22:17
  • 1
    I am 95% sure that we’ve had this question before (either here or on Super User), but I’ve spent ten minutes searching, and I can’t find it. The general solution (assuming that you’re using bash, and you don’t need to specify a particular extension) is prog1 inputs >(cat)  | prog2. Commented Nov 21, 2016 at 23:51

1 Answer 1


A note on the general solution: to many programs which require a filename you can give the path /dev/stdout (a link to /proc/self/fd/1, assuming said files exist) and they will happily send their output to stdout. One may also use process substitution in bash with cat, ie foo -f >(cat) args | bar (thanks, g-man).

Because pico2wave checks the file extension, a possible solution is to symlink /dev/stdout to a path with the appropriate extension, ideally somewhere such as /var/local/. This does create an extra file, but not per process: ln -s /dev/stdout /var/local/pico2wave.wav, then pico2wave -w /var/local/pico2wave.wav "test" | aplay works.

  • If you use /tmp/pico2wave.wav then the file will be deleted whenever the system boots, so you at least wouldn't need to manually clean up the file.
    – evilsoup
    Commented Nov 21, 2016 at 22:44
  • I suppose what I want is "no setup/teardown steps"; I prefer /var/local/ over /tmp/ in that there is a one-time setup instead of per-boot, and that feels like the right place to put such a path on an individual machine.
    – Iiridayn
    Commented Nov 21, 2016 at 22:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .