Skip to content

Instantly share code, notes, and snippets.

@realtimeprojects
Last active September 5, 2017 11:14
Show Gist options
  • Save realtimeprojects/3590672a06c90e18a1c2810d1167f0ce to your computer and use it in GitHub Desktop.
Save realtimeprojects/3590672a06c90e18a1c2810d1167f0ce to your computer and use it in GitHub Desktop.
reduce yousician sound effects volume on Mac OS X / Linux
#!/bin/bash
# Purpose: Silence down yousician sound effects on Mac OS X
# Usage: ./ysilence.sh
# Requirements: ffmpeg installed (brew install ffmpeg)
# USE AT YOUR OWN RISK!
# However, you can fixed damaged installations by just removing the Yousician.app folder
# inside /Applications/Yousician Launcher.app
# Adjust this path to your needs, ysilence will lookup the soundseffect below this path
YS_PATH="/Applications/Yousician Launcher.app/"
WDIR=$(mktemp -d)
IFS=$(echo -en "\n\b")
function die
{
echo $1
exit 1
}
function silence_file
{
file="$1"
echo silencing $file to $WDIR/tmp.ogg
fileb=$WDIR/tmp.ogg
rm -f $fileb
ffmpeg -i "$file" -filter:a "volume=0.01" -strict -2 -ac 2 -acodec vorbis $fileb || return 1
echo replacing $file by $WDIR/tmp.ogg
cp $fileb "$file"
}
echo checking ffmpeg
which ffmpeg || die "no ffmpeg installed"
echo checking yousician files
FILES=$(find "$YS_PATH" -regex ".*EncodedAudio.*\.ogg")
for file in $FILES; do
silence_file "$file"
done;
die EOT
rm -rf $WDIR
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment