<p>Unfortunately, before down-sampling you have to apply an anti-aliasing filter that removes all energy at and above Nyquist. what you are looking for is sharp anti-aliasing filters, which indicates large filters (lot of taps in case of FIR  filters).</p>
<p>There are two ways to help you, decimate not in one step 48/12 = 4, but in 3 steps 48/2/2/3. Such sequential down-sampling helps in terms of numerical stability as you use shorter filters. The other way is to down-sample to 6 kHz
48/2/2/2. The trade off is your decision (loosing frequency, or larger files)</p>

CC BY-SA 4.0
2022-07-06T18:27:03.070Z
2022-07-06T18:27:03.070Z
WMXZ
<p>If you want to go forward with using SoX, once installed it's pretty easy to use. It is much faster than other programs that need GUIs to run, and I have never noticed data loss. However the set up can be a trip.</p>
<p>First, if you haven't already, you can download <a href="https://sourceforge.net/projects/sox/" rel="noreferrer">SoX here</a>.</p>
<p>Next, install it as per the installers instructions. I find it useful to keep in my Program Files directory, as I use it in the Command Prompt and in Python. Then, you'll need to add it to your Path:</p>
<ol>
<li>Go to My Computer → Properties → Advanced System Settings → Environment Variables → System variables.</li>
<li>Select Path.</li>
<li>Click Edit → New :</li>
<li>Add this: C:\Program Files (x86)\sox-CHECK YOUR VERSION NUMBER\</li>
</ol>
<p><a href="https://i.sstatic.net/7i4U3.png" rel="noreferrer"><img src="https://i.sstatic.net/7i4U3.png" alt="enter image description here" /></a></p>
<p>Next, open your command prompt window, and navigate to your working directory. Type sox and you should see that it is properly installed.</p>
<pre><code>cd c:\Files\YourDir
sox
</code></pre>
<p>This will spit out a bunch of help text, which is easier to read <a href="http://sox.sourceforge.net/sox.html" rel="noreferrer">here</a>.</p>
<p>Next you can run a simple for loop to downsample your files. Here, I am making a new directory for the files, adding a prefix to the filename, and downsampling to 16k.</p>
<pre><code>mkdir downsampled    
for %f in (*.wav) do sox &quot;%f&quot; &quot;downsampled\16k_%f&quot; rate 16k
</code></pre>

CC BY-SA 4.0
2022-07-07T16:43:45.763Z
I was having issues getting it set up - thanks to your answer I was able to get it working and have begun downsampling. Thank you!
Bark95
CC BY-SA 4.0
2023-06-09T20:50:59.327Z
SoX is way much easier to install on Unix-like systems, including macOS, thanks to the various package managers available.
Guillaume Dutilleux
CC BY-SA 4.0
2022-07-07T07:05:05.050Z
2022-07-07T07:12:07.233Z
2022-07-07T07:12:07.233Z
etgriffiths
<p>Matlab got a command that includes (zero delay) filtering:
<a href="https://se.mathworks.com/help/signal/ref/resample.html" rel="noreferrer">https://se.mathworks.com/help/signal/ref/resample.html</a></p>

CC BY-SA 4.0
2023-08-10T13:47:30.920Z
I think the current command is decimate. :)  Which by default uses a lowpass Chebyshev Type I infinite impulse response (IIR) filter of order 8. Matlab is always changing its functions!
etgriffiths
CC BY-SA 4.0
2022-07-07T08:22:09.630Z
2022-07-07T08:22:09.630Z
Jeppe Have Rasmussen
<p>My go to for batch processing/downsampling is Adobe Audition. There is a cost associated with this software but think Adobe largely moved to a monthly subscription model. If you do go that route, here's a <a href="https://youtu.be/DV6r2EqBtrc" rel="nofollow noreferrer">short video</a> about how to batch process a set of files - selecting your sample rate and adding filters, etc. are also functions of the same.</p>

CC BY-SA 4.0
2022-07-06T20:53:09.100Z
2023-04-25T17:20:42.133Z
2023-04-25T17:20:42.133Z
LizFerg
<p>I would highly recommend Sox-o-matic, which is a GUI for decimating, renaming, or converting batches of audio files.</p>
<p>Here is a video for how to install and use it.</p>
<p><a href="https://www.birds.cornell.edu/ccb/sox-o-matic/" rel="nofollow noreferrer">https://www.birds.cornell.edu/ccb/sox-o-matic/</a></p>
<p>Once you've got it installed, it is quite easy to use and fast. Hope this helps.</p>
<p><a href="https://i.sstatic.net/oRdTM.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/oRdTM.png" alt="enter image description here" /></a></p>

CC BY-SA 4.0
2023-04-24T17:08:50.537Z
2023-06-22T16:43:43.847Z
2023-06-22T16:43:43.847Z
Ben Gottesman
<p>If you are in the world of Intel-processor macOS, try <strong>xACT</strong> (stands for <strong>x</strong> <strong>A</strong>udio <strong>C</strong>ompression <strong>T</strong>oolkit). It is a nice app that does many different batch tasks with audio files. It was built on top of many of the tasks performed by SoX.
Once there, check the util tab.</p>
<p><a href="http://xact.scottcbrown.org/xACT2.50.zip" rel="nofollow noreferrer">http://xact.scottcbrown.org/xACT2.50.zip</a></p>

CC BY-SA 4.0
2022-07-07T14:41:24.103Z
2022-07-07T14:41:24.103Z
Mario Rollo
<p>You should be able to decimate files using PAMGuard and apply the proper anti-aliasing filter to avoid losing samples. See the attached image below of the help menu for the decimator module.</p>
<p>If you want to also save those files rather than just decimating and running a detector within the program, you should be able to do it within the software by setting up a sound recorder module. You then direct the sound recorder to save those  decimated .wav files.</p>
<p><a href="https://i.sstatic.net/7r4bi.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/7r4bi.png" alt="enter image description here" /></a></p>

CC BY-SA 4.0
2022-07-06T20:03:56.603Z
2023-04-19T11:57:58.507Z
2023-04-19T11:57:58.507Z
Cory Hom-Weaver
<p>I have a large acoustic dataset (multiple years) with 6 hour recordings at 48 kHz sample rate. I am looking at patterns in humpback whale chatter and want to downsample my data to a 4 or 6 kHz sample rate. I have been using <a href="https://github.com/MarineBioAcousticsRC/Triton" rel="noreferrer">the Triton package in Matlab</a>, developed by the Scripps Whale Acoustic Lab/Acoustic Ecology Lab. When I use the 'decimate' function to downsample my data, I find that it loses some data at the edge of the specified sample rate - i.e. if I decimate my 48 kHz sample rate to a 4 kHz sample rate, the produced sound file only has good data from 0 - 1800 Hz, roughly. While it's unlikely that I am missing a lot of humpback vocalizations in this 1800-2000 Hz window, I am wondering if there are other softwares that will downsample without losing samples near the nyquist frequency. Additionally, it takes several days to decimate a 3-4 month deployment in the Triton package.</p>
<p>A colleague recommended <a href="http://sox.sourceforge.net/" rel="noreferrer">SoX (Sound eXchange)</a>, but I have had trouble getting it to work. They said it doesn't lose any data near the nyquist, and that it decimates much faster than Matlab.</p>
<p>Does anyone else use Sox? Or another software to decimate their large datasets?</p>

<sox>
What software do you use to decimate (downsample) your large acoustic files?
# What software do you use to decimate (downsample) your large acoustic files?

(Asked by: username_0 on 2022-07-06)

I have a large acoustic dataset (multiple years) with 6 hour recordings at 48 kHz sample rate. I am looking at patterns in humpback whale chatter and want to downsample my data to a 4 or 6 kHz sample rate. I have been using [the Triton package in Matlab](https://github.com/MarineBioAcousticsRC/Triton), developed by the Scripps Whale Acoustic Lab/Acoustic Ecology Lab. When I use the 'decimate' function to downsample my data, I find that it loses some data at the edge of the specified sample rate - i.e. if I decimate my 48 kHz sample rate to a 4 kHz sample rate, the produced sound file only has good data from 0 - 1800 Hz, roughly. While it's unlikely that I am missing a lot of humpback vocalizations in this 1800-2000 Hz window, I am wondering if there are other softwares that will downsample without losing samples near the nyquist frequency. Additionally, it takes several days to decimate a 3-4 month deployment in the Triton package.

A colleague recommended [SoX (Sound eXchange)](http://sox.sourceforge.net/), but I have had trouble getting it to work. They said it doesn't lose any data near the nyquist, and that it decimates much faster than Matlab.

Does anyone else use Sox? Or another software to decimate their large datasets?

**Tags:** sox


---

## 7 answers

### Answer by username_8 on 2022-07-06. Score: 9 | Accepted answer

You should be able to decimate files using PAMGuard and apply the proper anti-aliasing filter to avoid losing samples. See the attached image below of the help menu for the decimator module.

If you want to also save those files rather than just decimating and running a detector within the program, you should be able to do it within the software by setting up a sound recorder module. You then direct the sound recorder to save those decimated .wav files.

[![enter image description here](https://i.sstatic.net/7r4bi.png)](https://i.sstatic.net/7r4bi.png)


---

### Answer by username_1 on 2022-07-06. Score: 9

Unfortunately, before down-sampling you have to apply an anti-aliasing filter that removes all energy at and above Nyquist. what you are looking for is sharp anti-aliasing filters, which indicates large filters (lot of taps in case of FIR filters).

There are two ways to help you, decimate not in one step 48/12 = 4, but in 3 steps 48/2/2/3. Such sequential down-sampling helps in terms of numerical stability as you use shorter filters. The other way is to down-sample to 6 kHz
48/2/2/2. The trade off is your decision (loosing frequency, or larger files)


---

### Answer by username_2 on 2022-07-07. Score: 6

If you want to go forward with using SoX, once installed it's pretty easy to use. It is much faster than other programs that need GUIs to run, and I have never noticed data loss. However the set up can be a trip.

First, if you haven't already, you can download [SoX here](https://sourceforge.net/projects/sox/).

Next, install it as per the installers instructions. I find it useful to keep in my Program Files directory, as I use it in the Command Prompt and in Python. Then, you'll need to add it to your Path:

1. Go to My Computer → Properties → Advanced System Settings → Environment Variables → System variables.
2. Select Path.
3. Click Edit → New :
4. Add this: C:\Program Files (x86)\sox-CHECK YOUR VERSION NUMBER\

[![enter image description here](https://i.sstatic.net/7i4U3.png)](https://i.sstatic.net/7i4U3.png)

Next, open your command prompt window, and navigate to your working directory. Type sox and you should see that it is properly installed.

```
cd c:\Files\YourDir
sox

```

This will spit out a bunch of help text, which is easier to read [here](http://sox.sourceforge.net/sox.html).

Next you can run a simple for loop to downsample your files. Here, I am making a new directory for the files, adding a prefix to the filename, and downsampling to 16k.

```
mkdir downsampled    
for %f in (*.wav) do sox "%f" "downsampled\16k_%f" rate 16k

```

> **Comments:**
> **username_0**: I was having issues getting it set up - thanks to your answer I was able to get it working and have begun downsampling. Thank you!  
> **username_3**: SoX is way much easier to install on Unix-like systems, including macOS, thanks to the various package managers available.  

---

### Answer by username_4 on 2022-07-07. Score: 5

Matlab got a command that includes (zero delay) filtering:
<https://se.mathworks.com/help/signal/ref/resample.html>

> **Comments:**
> **username_2**: I think the current command is decimate. :)  Which by default uses a lowpass Chebyshev Type I infinite impulse response (IIR) filter of order 8. Matlab is always changing its functions!  

---

### Answer by username_5 on 2022-07-06. Score: 4

My go to for batch processing/downsampling is Adobe Audition. There is a cost associated with this software but think Adobe largely moved to a monthly subscription model. If you do go that route, here's a [short video](https://youtu.be/DV6r2EqBtrc) about how to batch process a set of files - selecting your sample rate and adding filters, etc. are also functions of the same.


---

### Answer by username_6 on 2023-04-24. Score: 4

I would highly recommend Sox-o-matic, which is a GUI for decimating, renaming, or converting batches of audio files.

Here is a video for how to install and use it.

<https://www.birds.cornell.edu/ccb/sox-o-matic/>

Once you've got it installed, it is quite easy to use and fast. Hope this helps.

[![enter image description here](https://i.sstatic.net/oRdTM.png)](https://i.sstatic.net/oRdTM.png)


---

### Answer by username_7 on 2022-07-07. Score: 3

If you are in the world of Intel-processor macOS, try **xACT** (stands for **x** **A**udio **C**ompression **T**oolkit). It is a nice app that does many different batch tasks with audio files. It was built on top of many of the tasks performed by SoX.
Once there, check the util tab.

<http://xact.scottcbrown.org/xACT2.50.zip>


---

