User:Amy Suo Wu/assignment: Difference between revisions
Amy Suo Wu (talk | contribs) No edit summary |
Amy Suo Wu (talk | contribs) No edit summary |
||
Line 1: | Line 1: | ||
source lang="bash"> | |||
Line 4: | Line 5: | ||
@head { | @head { | ||
$tempo | $tempo 120 | ||
$time_sig 4/4 | $time_sig 4/4 | ||
Line 11: | Line 12: | ||
@channel 1 { | @channel 1 { | ||
\$patch | \$patch 17 | ||
\$length | \$length 25 | ||
\$octave 3 | \$octave 3 | ||
\$pan | \$pan 0 | ||
end | end | ||
for ((i=0; i< | for ((i=0; i<13; i++)) | ||
do | do | ||
echo c c c c c r r r r r r r r r r r r r r r | echo c c c r c c r c r c c r | ||
echo c c c r c c r c r c c r | |||
echo c c c r c c r c r c c r | |||
echo c c c r c c r c r c c r | |||
done | |||
cat << end | cat << end | ||
} | |||
@channel 2 { | @channel 2 { | ||
\$patch 17 | \$patch 17 | ||
\$length | \$length 25 | ||
\$octave | \$octave 3 | ||
\$pan | \$pan 127 | ||
Line 38: | Line 43: | ||
end | end | ||
pat="c c c r c c r c r c c r " | |||
pat=$pat$pat$pat$pat | |||
#inplace assignment | |||
for ((i=0; i<13; i++)) | |||
do | |||
echo $pat | |||
pat=${pat:2:0}${pat:0:2} | |||
# shift the pattern | |||
# ${name:offset:length} | |||
done | |||
cat << end | cat << end | ||
} | } | ||
} | } | ||
end | end | ||
#bash clap.sh | midge -o clap.mid; timidity clap.mid (straight from bash to timidity without going through all the steps) |
Revision as of 11:14, 19 October 2010
source lang="bash">
cat << end
@head {
$tempo 120 $time_sig 4/4
} @body {
@channel 1 { \$patch 17 \$length 25 \$octave 3 \$pan 0
end
for ((i=0; i<13; i++)) do echo c c c r c c r c r c c r echo c c c r c c r c r c c r echo c c c r c c r c r c c r echo c c c r c c r c r c c r done
cat << end
}
@channel 2 { \$patch 17 \$length 25 \$octave 3 \$pan 127
end pat="c c c r c c r c r c c r " pat=$pat$pat$pat$pat
- inplace assignment
for ((i=0; i<13; i++)) do echo $pat pat=${pat:2:0}${pat:0:2}
- shift the pattern
- ${name:offset:length}
done
cat << end
} } end
- bash clap.sh | midge -o clap.mid; timidity clap.mid (straight from bash to timidity without going through all the steps)