Install Sox Locally

Repo

realzza/Sox-Local-Installer

Background

Sox has been instrumental in audio processing and manipulation and is known as the Swiss Army Knife of sound processing programs. Everything is ok when I use my personal server on which Sox is preinstalled via root. However, I found installing Sox on a group server challenging, where installing Sox calls for root permission and operation.

Install with Root on Linux

Typically, installing Sox should be more than easy if you are the root of a Linux server.

sudo
1
2
sudo apt update
sudo apt install sox

Install Sox without root

This section is the core of this blog. I will address two methods to install Sox locally.

Install from source

Install from source is to download the source code and install manually.
First, we go to the user root directory or an assigned directory to download the source code.

Download Source Code
1
2
cd ~
wget https://nchc.dl.sourceforge.net/project/sox/sox/14.4.2/sox-14.4.2.tar.gz

Next, we unzip the source code.

Unzip
1
tar xvfz sox-14.4.2.tar.gz

Next, use the configuration file inside ~/sox-14.4.2 to check the destination system’s configuration and available features to ensure the project can be built. Please be reminded that the --prefix argument requires an absolute path format.

Configure
1
./configure --prefix=$HOME/sox-14.4.2

Next, we build the project.

make
1
make && make install

Last but not least, we add a Sox bin to our path. Edit your .bashrc file in your user root. Add the following line,

1
export PATH="$SOX_DIR/bin:$PATH"

$SOX_DIR should align with the --prefix argument where you made the configuration.

Install from conda-forge

The methods above usually take more than half an hour to complete. It is intolerable for someone in desperate need to use Sox. Days after, I ran into a much easier method to get Sox installed locally. All you need is a conda environment and one command line.

1
2
3
conda create -n sox python=3.8 -y
conda activate sox
conda install -c conda-forge sox

After that, you have Sox installed safe and sound.

More on conda-forge

conda-forge is more powerful than I previously assumed. According to their website, it is a channel that collects all the packages available in conda. A often-used tool htop also requires sudo permission to get installed, you can still use conda-forge to install it anyway without any root concerns. Just like

htop
1
conda install -c conda-forge htop

What makes me even more surprised is that, although torch for m1 mac is not officially supported, we can install the osx-arm64 torch wheels from conda-forge. Although it still has some supporting issue, it can cover most using cases within torch.

Reference

Author

Ziang Zhou

Posted on

2022-04-06

Updated on

2022-04-05

Licensed under

Comments