I'm trying to make a voice distorter with my raspberry Pi, I made a script with this line of code

play "|rec --buffer 2048 -d pitch -300 echos 0.8 0.88 100 0.6 150 .5 band 1.2k 1.5k|"

But I get the error invalid syntax which is referring to " and when I remove that I get the error referring to | .

  • have you tried a space after the pipe symbol (|)? Is that he entire line? Can you include a few lines around the above code. Dec 4, 2015 at 23:07
  • Look up "proper sh syntax" or just learn sh/bash syntax, it'll help you alot to do it before you try to program with sh/bash Dec 5, 2015 at 15:01

1 Answer 1


Perhaps you should try:

rec --buffer 2048 -d pitch -300 echos 0.8 0.88 100 0.6 150 .5 band 1.2k 1.5k | play

The *nix shell command line symbol '|' means "pipe" or "take the standard output from the command to the left and feed it as stadard input to the command on the right".

You CAN do the sort of thing you wrote, but you need to use the back-quote '`' character (on the key to the left of "1!" on my UK keyboard); in the *nix shell, stuff surrounded by a pair of these means "replace what is enclosed with the standard output from it when run as a command".:

play `rec --buffer 2048 -d pitch -300 echos 0.8 0.88 100 0.6 150 .5 band 1.2k 1.5k`

Note that my answer is based on general shell command line knowledge, I am assuming that play and rec handle standard input and output respectively as something to output to / input from a sound device as a file. I see on my Debian PC that both are aliases to sox {Sound Exchange - the Swiss Army knife of audio manipulation}.

  • I tried the line you edited but now I get the error nvalid syntax and it highlights 2048
    – Junaid
    Dec 5, 2015 at 19:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.