I recently compared the two to decide which one to use in my Scaper soundscape synthesis and augmentation library, and figured I'd share what I found here in case anyone finds it helpful.
Sox and Rubberband are two excellent open-source command-line tools for audio processing. Both have python wrappers too: pysox and pyrubberband.
Both sox and rubberband provide optional arguments that allow you to fine tune the shifting/stretching algorithm for the specific audio content being processed. In my very quick and dirty (and non-comprehensive) exploration, I found one setting for sox and one setting for rubberband that generally gave the best sounding results (to my ears), so I used the same setup for all comparisons below.
âIn all the audio examples below, the following commands were used:
- sox infile.wav outfile.wav pitch 100
- rubberband --pitch 1 infile.wav outfile.wav -c 6
- sox infile.wav outfile.wav tempo -s 0.833
- rubberband --time 1.2 infile.wav outfile.wav -c 6
I strongly recommend listening to the examples below with good headphones, since the differences are sometimes quite subtle (but definitely noticeable with a good pair of cans).
Music: male voice
âMusic: female voice
So... which one's better? Like most things in life, it depends. It depends on your target application and what matters most in that context, it depends whether you're only doing pitch shifting or time stretching or both, it depends on your audio content, the parameters you choose...
For my application I have a relatively clear winner, but I won't bias you with my opinion ;)