SoX
This is the easiest software to
concatenate and/or split audio files.
Download
https://sourceforge.net/projects/sox/
Wordt standaard geïsntalleerd in C:\Program Files (x86)\sox-14-4-2>
Manuals & resources
General
Focusing on split on silence
Concatenate in real life
It works with .wav, .mp3, …
Het laatste bestand is altijd het doelbestand, de voorgaande de bronbestanden:
sox first.mp3 second.mp3 third.mp3 result.mp3
see: https://stackoverflow.com/questions/25280958/sox-concatenate-multiple-audio-files-without-a-gap-in-between
C:\Program Files (x86)\sox-14-4-2>sox 1.wav 2.wav 3.wav 123.wav
Simple split in real life
De output-bestanden krijgen vanzelf een volgnummer mee:
sox infile.wav output.wav trim 0 30 : newfile : restart
Zo bijvoorbeeld:
sox 15.wav output.wav trim 0 75 : newfile : restart
sox WARN trim: Last 1 position(s) not reached (audio shorter than expected).
Je krijgt dus netjes een melding dat de laatste in de rij korter zal zijn.
Get the last part of an audio file, skipping x seconds
skip e.g. 70 seconds
sox 10.wav out.wav trim 70
Split manually in unequal sections
The following is an example of splitting (the first x seconds of) an input file into a 42.65 second file a 43.1 second file, a 73 second file and ignoring the rest. (
http://sox.sourceforge.net/sox.html)
sox BuxIn034.wav BuxOut%1n.wav trim 0 42.65 : newfile : trim 0 43.1 : newfile : trim 0 73
Split where silence
See another example
splitwavxx.bat.
I had a large .wav file from a concert, that I wanted to split into the separate pieces, based on the silence between the pieces. I knew there were 43 pieces, an intro and an applause at the end, so in total I needed 45 files:
sox -V3 BuxIn.wav BuxOut.wav silence 1 3.0 0.1% 1 0.3 1% : newfile : restart
→ 100 files / 17
https://unix.stackexchange.com/questions/318164/sox-split-audio-on-silence-but-keep-silence
- The first triplet of values means remove silence, if any, at the start until 3.0 seconds of sound above 0.1%.
- The second triplet means stop when there is at least 0.3 seconds of silence below 1%. changed into: 0.3 seconds of silence below 0.3%
sox -V3 BuxIn.wav BuxOut.wav silence 1 3.0 0.1% 1 0.3 0.3% : newfile : restart
→ 33 files => changed into:
0.3 seconds of silence below 0.38% / 7-1 = 6
sox -V3 BuxIn.wav BuxOut.wav silence 1 3.0 0.1% 1 0.3 0.38% : newfile : restart
→ 46 files => OK / 7-1 = 6
Other trials, from commands I found on the www:
sox BuxIn.wav BuxOut.wav silence 1 0.5 1% 1 5.0 1% : newfile : restart
→ 10 files
sox BuxIn.wav BuxOut.wav silence -l 1 0.0 -40d 1 1.0 -40d : newfile : restart
→ 125 files / 14-2 = 12 (verwacht 6, maar al bij al niet slecht)
Split where silence 2
sox soundIn.mp3 soundOut.mp3 silence 1 2 0.5% 1 2.7 1% : newfile : restart
- verwacht: 19
- resultaat: 18, waarvan 4 van 0 kB, dus 14
- = al bij al niet slecht
►
18 - 4 = 14
Op basis hiervan telkens één parameter gewijzigd:
sox sound1.mp3 soundOut1.mp3 silence 0.5 2 0.5% 1 2.7 1% : newfile : restart
sox FAIL silence: usage: [ -l ] above_periods [ duration threshold[d|%] ] [ below_periods duration threshold[d|%] ]
sox sound2.mp3 soundOut2.mp3 silence 1 2.5 0.5% 1 2.7 1% : newfile : restart
► 14 - 1 = 13
sox sound3.mp3 soundOut3.mp3 silence 1 2 0.3% 1 2.7 1% : newfile : restart
► 21 - 8 = 13
sox sound4.mp3 soundOut4.mp3 silence 1 2 0.5% 0.5 2.7 1% : newfile : restart
► 18 - 5 = 13
sox sound5.mp3 soundOut5.mp3 silence 1 2 0.5% 1 1.5 1% : newfile : restart
► 35 - 8 = 27
sox sound6.mp3 soundOut6.mp3 silence 1 2 0.5% 1 2.7 0.7% : newfile : restart
► 14 - 1 = 13
No SoX
Sometimes, I also use NCH Slice Audio File Splitter (
https://www.nch.com.au/splitter/index.html).