Last active
December 24, 2015 11:29
-
-
Save Alexander-0x80/6791647 to your computer and use it in GitHub Desktop.
Bash script to convert base note sound to full octave .
This file contains 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 | |
# Using: Sox | |
# | |
# If not installed : | |
# sudo apt-get install sox libsox-fmt-mp3 | |
# | |
if [ ! -f $1 ] | |
then | |
echo "Bad filename." | |
exit | |
fi | |
# There are 12 semitones to an octave, | |
# Measured in 100ths of a semitone. | |
# so that would mean +/- 1200 for one octave. | |
# Info : | |
# http://en.wikipedia.org/wiki/Semitone | |
declare -A notes=( | |
[c]=0 [cs]=76 [d]=193 [ds]=310 | |
[e]=386 [f]=503 [fs]=579 [g]=696 | |
[gs]=772 [a]=889 [as]=1006 [b]=1082 ) | |
for note in ${!notes[@]}; | |
do | |
# sox <infile> <outfile> pitch <shift> | |
sox $1 ${note}$2.mp3 pitch ${notes[${note}]} | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment