Help with using sox as a voice changer?


Silent-Hunter

Hardcore Member
Joined
May 29, 2010
Messages
3,153
I already posted a question on Super User about this, but I was wondering if maybe someone here knows.

I'm attempting to make a realtime voice changer to make me sound like a turian (from Mass Effect).

What I'd like to do, is take input from the mic, split it into two channels, lower the pitch on both but apply flanging and a slight delay to only one, and then mix them back together before outputting them to a pulseaudio sink.

Right now I'm having to just flange the whole thing, but it just doesn't sound quite right.

Is there any way to do this with sox?

If this is the wrong section please let me know.
 

FBnil

Waiting to Champion the Pyra to the World...
Joined
Dec 14, 2012
Messages
3,224
Location
Yurp
Yes, of course, here

For the Pandora, this worked for me:

# smurf voice:
Bash:
arecord -f cd -r 11025 -D hw:0,1 | play -t wav - pitch +500
You can get SOX from 2 places, one is memorecorder-installer (once installed does not require the PND to be run to expose the binaries) the other one is sox

remember to export LD_LIBRARY_PATH=yoursoxdir/lib
http://repo.openpandora.org/?page=detail&app=sox
Post automatically merged:

For that flanger thing, Not sure how to get your exact settings, but:

try

Bash:
|play -t wav - pitch -500 flanger 2222
it will die with explanation how the flanger works (even with an ascii image!) and what the settings are, and their range. Remove the "2222" to get the default values for the flanger.

For examples, see the flanger section in
https://linux.die.net/man/1/soxexam
 
Last edited:

Silent-Hunter

Hardcore Member
Joined
May 29, 2010
Messages
3,153
My issue is I need to have two separate effect chains, one that only affects channel 1, and another that only effects channel 2. Does SoX support this? I've been using the flanger and I got the settings for that where I want them, but I need to have my unflanged voice on top of it.
 

FBnil

Waiting to Champion the Pyra to the World...
Joined
Dec 14, 2012
Messages
3,224
Location
Yurp
Yes, SoX supports, this. Just look at how flanger DOES use the unprocessed voice too:


Code:
$ sox --help-effect flanger

Effect usage:

flanger [delay depth regen width speed shape phase interp]
                  .
                 /|regen
                / |
            +--(  |------------+
            |   \ |            |   .
           _V_   \|  _______   |   |\ width   ___
          |   |   ' |       |  |   | \       |   |
      +-->| + |---->| DELAY |--+-->|  )----->|   |
      |   |___|     |_______|      | /       |   |
      |           delay : depth    |/        |   |
  In  |                 : interp   '         |   | Out
  --->+               __:__                  | + |--->
      |              |     |speed            |   |
      |              |  ~  |shape            |   |
      |              |_____|phase            |   |
      +------------------------------------->|   |
                                             |___|
       RANGE DEFAULT DESCRIPTION
delay   0 30    0    base delay in milliseconds
depth   0 10    2    added swept delay in milliseconds
regen -95 +95   0    percentage regeneration (delayed signal feedback)
width   0 100   71   percentage of delayed signal mixed with original
speed  0.1 10  0.5   sweeps per second (Hz)
shape    --    sin   swept wave shape: sine|triangle
phase   0 100   25   swept wave percentage phase-shift for multi-channel
                     (e.g. stereo) flange; 0 = 100 = same phase on each channel
interp   --    lin   delay-line interpolation: linear|quadratic

hmm... perusing the code now, it does NOT have a way to convey the "loudness" is conveyed with "width" of the flanger added to the original stream.

You "might" get something with named pipes, and then using tee to split the mono wav it into 2, and processing both streams, each to another named pipe, which you then join using sox... on what system where you on? Linux, Windows, Pandora?
At that point, you just might use Pulse-Effects if you have Pulse-Audio on your Linux.

edit2: Nope, The code of Pulse-Effects does not show flanger, there are other things in there though.

So the only thing I know will work is https://jackaudio.org/
But get that to run first, then we can talk :)
 
Last edited:

Silent-Hunter

Hardcore Member
Joined
May 29, 2010
Messages
3,153
Oh thank you! I still can't make the flanged voice deeper than the passed through bit, but this should help a lot. I misread it when it showed in the commandline.
 

Silent-Hunter

Hardcore Member
Joined
May 29, 2010
Messages
3,153
I think I got it mostly how I want it! I still wish I could deepen the flanged voice more than the non-flanged voice. But I got it closer.

Thanks for the links too!
 
Top