Skip to content

Instantly share code, notes, and snippets.

@echophon
Last active February 21, 2023 02:59
Show Gist options
  • Save echophon/79b288d3b34358dd7756d30c245b56f8 to your computer and use it in GitHub Desktop.
Save echophon/79b288d3b34358dd7756d30c245b56f8 to your computer and use it in GitHub Desktop.
#!/bin/bash
# bank/pattern generator for the Acid Rain Technology Constellation
# an eight channel gate sequencer that uses euclidean patterns and logic
# random selectors
operators=("AND" "OR" "XOR")
probabilities=("25" "50" "75" "100")
minlength=3
maxlength=16
maxratchet=1
maxdivision=16
for bank in {0..1}; do
bankname=$(printf "%03d" $bank)
mkdir -p $bankname
for i in {0..19}; do
filename=$(printf "$bankname/%02d.txt" $i)
# write clock header - static for now
echo "starting bank $bankname pattern $i"
echo "clock = 0,1,120,4,1,1,1,50" > $filename
# write cv headers - static for now
for j in {0..9}; do
echo "cv$j = 0,0,0,0,0,100" >> $filename
done
# generate channel settings
for k in {0..7}; do
echo "starting channel $k"
op=${operators[$RANDOM % ${#operators[@]} ]}
echo "C$k = 0,0,1,1,50,0,$op" >> $filename
for l in {0..7}; do
mute=$(shuf -i 0-1 -n 1)
divide=$(shuf -i 1-$maxdivision -n 1)
ratchet=$(shuf -i 1-$maxratchet -n 1)
length=$(shuf -i $minlength-$maxlength -n 1)
events=$(shuf -i 1-$((length > 1 ? length-1 : 1)) -n 1)
rotate=$(shuf -i 1-$((length > 1 ? length-1 : 1)) -n 1)
prob=${probabilities[$RANDOM % ${#probabilities[@]} ]}
echo "C$k.P$l = $mute,$prob,$length,$events,$rotate,1,$ratchet,$divide" >> $filename
done
done
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment