SHARE
TWEET

Untitled

a guest Feb 17th, 2019 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. full_filename=$(basename "$1")
  2. EXT="${full_filename##*.}"
  3. FILENAME="${full_filename%.*}"
  4. FILENAME="${FILENAME// /\\ }"
  5.  
  6. #echo $FILENAME
  7. #echo $EXT
  8.  
  9. TARGET_BPM=184
  10.  
  11. echo "Calculating BPM..."
  12. BPM=`bpm-tag -m 120 -x 200 -f -n "${1// /\\ }" 2>&1 | grep -oP '\d+\.\d+'`
  13. FACTOR=`bc <<< "scale=5; ${TARGET_BPM}/${BPM}"`
  14.  
  15. echo "BPM is $BPM"
  16. echo "Applied tempo factor to reach ${TARGET_BPM}BPM: $FACTOR"
  17.  
  18. NORMALIZED_FILENAME="$FILENAME-normalized.mp3"
  19. NORMALIZED_BPM_FILENAME="$FILENAME-normalized-${TARGET_BPM}BPM.mp3"
  20.  
  21. echo "Normalizing file..."
  22. sox --norm "${1// /\\ }" -C 0 "${NORMALIZED_FILENAME}"
  23.  
  24. echo "Applying tempo change..."
  25. sox "${NORMALIZED_FILENAME}" -C 0 "${NORMALIZED_BPM_FILENAME}" tempo -m $FACTOR
  26. rm "${NORMALIZED_FILENAME}"
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top