https://github.com/naugtur/podcastmaker-cli
a pile of bash tricks for unattended audio editing
https://github.com/naugtur/podcastmaker-cli
Last synced: 6 months ago
JSON representation
a pile of bash tricks for unattended audio editing
- Host: GitHub
- URL: https://github.com/naugtur/podcastmaker-cli
- Owner: naugtur
- Created: 2018-10-22T19:33:47.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2021-09-21T22:32:35.000Z (about 4 years ago)
- Last Synced: 2025-02-15T07:32:12.963Z (8 months ago)
- Language: Shell
- Size: 2.41 MB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# podcastmaker-cli
a pile of bash tricks for unattended audio editing## tools
```
sudo apt-get install normalize-audio sox libsox-fmt-mp3 mp3val mp3blaster
```## podcast maker example code
```
./podcastplease.sh chunk*.wav
```## input format
input for the earwax filter needs to be in stereo 44100hz
can remove earwax or convert the inputs
```
ffmpeg -i a.m4a -ac 2 -ar 44100 b.mp3
```
## research### remove loud clicks before normalization
- use limitergain
- don't kow how it works yetvol gain [type [limitergain]]
Seems to work:
```
sox testfiles/test.mp3 b.wav vol 1.5 amplitude 0.3
```
though docs say limitergain should be 0.05 but this limits the peaks much better somehow.
But it's not working for all waveforms. Gotta look for a different limiter implementation. `compand` was mentioned as limiter too.### compression
```
for file in ~/gpodder-downloads/*/*.mp3; do sox "$file" "$file-compresssed.mp3" compand 0.3,1 6:-70,-60,-20 -5 -90 0.2 ; rm "$file" ; done
```https://forum.doom9.org/showthread.php?t=165807
```
speech:
compand 0.02,0.20 5:-60,-40,-10 -5 -90 0.1
source: http://www.benmcdowell.com/blog/2012/01/29/batch-processing-audio-file-cleanup-with-sox/voice/music:
compand 0.1,0.3 -60,-60,-30,-15,-20,-12,-4,-8,-2,-7 -2
source: http://www.dzone.com/snippets/sox-audio-editor-settings
and
source: http://forums.joe.to/viewtopic.php?f=149&t=57817voice/radio:
compand 0.01,1 -90,-90,-70,-70,-60,-20,0,0 -5
source: http://icecast.imux.net/viewtopic.php?t=3462audio books:
compand 0.3,5 6:-70,-60,-20 -10 -6 0.2
source: http://www.ericphelps.com/batch/samples/MP3_Recode.txtpodcast:
compand 0.3,1 6:-70,-60,-20 -5 -90
source: https://dissectionbydavid.wordpress.com/2010/10/01/using-sox-via-php-to-cleanup-podcasts/much stronger compression:
compand 0.3,1 6:-70,-60,-20 -5 -90 0.2 \
source: https://askubuntu.com/questions/90568/apply-compressor-effect-to-new-podcasts-automatically
```### noise
#### noise gate
- slight noise gate
compand .1,.2 -inf,-50.1,-inf,-50,-50 0 -90 .1
- strong noise gate
compand .2,.2 -inf,-30.1,-inf,-30,-30 0 -90#### noise reduction
noiseprof [profile-file]
Calculate a profile of the audio for use in noise reduction. See the description of the noisered effect for details.noisered [profile-file [amount]]
Reduce noise in the audio signal by profiling and filtering. This effect is moderately effective at removing consistent background noise such as hiss or hum. To use it, first run SoX with the noiseprof
effect on a section of audio that ideally would contain silence but in fact contains noise - such sections are typically found at the beginning or the end of a recording. noiseprof will write out a noise
profile to profile-file, or to stdout if no profile-file or if `-' is given. E.g.
sox speech.wav -n trim 0 1.5 noiseprof speech.noise-profile
To actually remove the noise, run SoX again, this time with the noisered effect; noisered will reduce noise according to a noise profile (which was generated by noiseprof), from profile-file, or from
stdin if no profile-file or if `-' is given. E.g.
sox speech.wav cleaned.wav noisered speech.noise-profile 0.3
How much noise should be removed is specified by amount-a number between 0 and 1 with a default of 0.5. Higher numbers will remove more noise but present a greater likelihood of removing wanted compo‐
nents of the audio signal. Before replacing an original recording with a noise-reduced version, experiment with different amount values to find the optimal one for your audio; use headphones to check
that you are happy with the results, paying particular attention to quieter sections of the audio.On most systems, the two stages - profiling and reduction - can be combined using a pipe, e.g.
sox noisy.wav -n trim 0 1 noiseprof | play noisy.wav noisered```
# This script shows using several
# effects in combination to normalise and trim voice recordings that
# may have been recorded using different microphones, with differing
# background noise etc.SOX=/usr/bin/sox
if [ $# -lt 2 ]; then
echo "Usage: $0 infile outfile"
exit 1
fi$SOX "/tmp/tmp_audio_leveled.wav" -n trim 0 0.5 noiseprof newprofile
$SOX "/tmp/tmp_audio_leveled.wav" $2 noisered newprofile$SOX "$1" "/tmp/tmp_audio_leveled.wav" \
remix - \
highpass 100 \
norm \
compand 0.05,0.2 6:-54,-90,-36,-36,-24,-24,0,-12 0 -90 0.1 \
vad -T 0.6 -p 0.2 -t 5 \
fade 0.1 \
reverse \
vad -T 0.6 -p 0.2 -t 5 \
fade 0.1 \
reverse \
norm -0.5 ````
https://superuser.com/questions/588793/need-to-clean-up-audio-noise-using-sox##### ffmpeg
https://superuser.com/questions/733061/reduce-background-noise-and-optimize-the-speech-from-an-audio-clip-using-ffmpeg
FFmpeg now has 3 native filters to deal with noise background:
afftdn: Denoises audio samples with FFT
anlmdn: Reduces broadband noise in audio samples using a Non-Local Means algorithm
arnndn: Reduces noise from speech using Recurrent Neural Networks. Examples for model files to load can be found here.Also, since some time, one can use ladspa (look for noise-supressor) and/or lv2 (look for speech denoiser) filters with FFmpeg.
### normalization
```
#!/bin/sh
#normalize everythingfor i in `ls *.wav`; do
FOO=`sox $i -e stat -v 2>&1`
BN=`basename $i .wav`
echo "norming $i with factor $FOO ..."
sox -v $FOO $i -t wav ${BN}.norm.wav
done
```-e in script above doesn't work and needs to be replaced with a filename to make it work.
but this does the same as above:
```
sox input.wav outoput.wav norm
```I ended up using this for now
```
sox --norm=-3 input.wav outoput.wav
```### other fun
earwax Makes audio easier to listen to on headphones. Adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio so that when listened to on headphones the stereo image is moved from inside your head (standard
for headphones) to outside and in front of the listener (standard for speakers).silence [-l] above-periods [duration threshold[d|%]
[below-periods duration threshold[d|%]]Removes silence from the beginning, middle, or end of the audio. `Silence' is determined by a specified threshold.
spectrogram
writes to spectrogram.png### building audio from multiple files, mixing
#### Crossfade intro
```
sox --combine concatenate intro.wav all.mp3 result.mp3 splice -q 16,3
# 16 is the length of intro, 3 is the length of overlap
```splice for joining parts of the recording or cuts
trim
silence or vadcombine inputs with mix-power (to overlay music)
- measure music length, add silence to speech input, add fade effects and overlay
- abuse splice to create enough of a crossfadeconcatenate parts