Created
September 10, 2020 10:41
-
-
Save wil92/4f07b4e592e936d8dce3289ac571dfb2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# by wil92 | |
# remove the noise of an audio | |
# list of needed packages | |
PACKAGES=("sox" "libsox-fmt-ao" "libsox-fmt-mp3" "libsox-fmt-pulse" "libsox-fmt-alsa" "libsox-fmt-base" "libsox-fmt-oss"); | |
# install dependencies if they are not installed already | |
for i in "${PACKAGES[@]}" | |
do : | |
if [ $(dpkg-query -W -f='${Status}' $i 2>/dev/null | grep -c "ok installed") -eq 0 ]; | |
then | |
sudo apt-get install $i -y; | |
fi | |
done | |
# output file name, by default is the same name of the input file | |
if [ -z $2 ]; then NEW_FILE=$1; else NEW_FILE=$2; fi | |
# Remove noise from audio file | |
sox $1 -n noiseprof tmp_profile | |
sox $1 $2 noisered tmp_profile 0.10 | |
rm tmp_profile |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# by wil92 | |
# convert a list of audios from .ogg to .mp3 and then normalize the level of audio of those | |
# list of needed packages | |
PACKAGES=("mp3gain" "ffmpeg"); | |
# install dependencies if they are not installed already | |
for i in "${PACKAGES[@]}" | |
do : | |
if [ $(dpkg-query -W -f='${Status}' $i 2>/dev/null | grep -c "ok installed") -eq 0 ]; | |
then | |
sudo apt-get install $i -y; | |
fi | |
done | |
# convert files from ogg to mp3 | |
for i in *.ogg; do ffmpeg -i "$i" "${i%.*}.mp3"; done | |
# normalize audio level in all the mp3 files | |
mp3gain -c -r *.mp3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment