User:Amy Suo Wu/assignment: Difference between revisions

From XPUB & Lens-Based wiki
No edit summary
No edit summary
 
(9 intermediate revisions by the same user not shown)
Line 1: Line 1:
CLAPPING MUSIC BY STEVE REICH
<source lang="bash">




Line 4: Line 7:


@head {
@head {
     $tempo 200    
     $tempo 120    
     $time_sig 4/4
     $time_sig 4/4


Line 11: Line 14:
   
   
     @channel 1 {
     @channel 1 {
         \$patch 5
         \$patch 17
         \$length 12        
         \$length 25        
         \$octave 3
         \$octave 3
         \$pan 40
         \$pan 0
end
end


for ((i=0; i<12; 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 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
 
 


done
cat << end
cat << end
 
    }
  }




  @channel 2 {
  @channel 2 {
         \$patch 17
         \$patch 17
         \$length 12
         \$length 25
         \$octave 2
         \$octave 3
         \$pan 5
         \$pan 127
   
   
        
        
Line 38: Line 45:
      
      
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
}
}
end
#bash clap.sh | midge -o clap.mid; timidity clap.mid (straight from bash to timidity without going through all the steps)
OR






echo c c c c c c c c d e f g a b c4 d4 e4 f4 g4 a4 b4 c5 d5 e5 f5 g5 a5 b5 c6 d6 e6 d6 c6 b5 a5 g5 f5 e5 d5 c5 b4 a4 g4 f4 e4 d4 c4 b3 a3 g3 f3 e3 d3 
echo c c c c c c d e f g a b c4 d4 e4 f4 g4 a4 b4 c5 b4 a4 g4 f4 e4 d4 c4 b3 a3 g3 f3 e3 d3 
echo c c c c c c c c d e f g a b c4 d4 e4 f4 g4 a4 b4 c5 c5 b4 a4 g4 f4 e4 d4 c4 b3 a3 g3 f3 e3 d3 


pat="xxx_xx_x_xx_"


cat << end
@head {
    \$tempo 120 
    \$time_sig 4/4
}
@body {
    @channel 1 {
        \$patch 1
        \$length 16       
        \$octave 4
        \$pan 0
end
for ((bar=0; bar<13; bar++))
do
for ((repeat=0; repeat<12; repeat++))
do
echo $pat | sed 's/x/c /g; s/_/r /g'
done
done






cat << end
cat << end
    }


@channel 2 {
        \$patch 1
        \$length 16
        \$octave 5
        \$pan 127
     


   
end
for ((bar=0; bar<13; bar++))
do
for ((repeat=0; repeat<12; repeat++))
do
echo $pat | sed 's/x/c /g; s/_/r /g'
done
pat=${pat:1}${pat:0:1}
# shift the pattern
# ${name:offset:length}
done
cat << end


}
}
}
}
end
end

Latest revision as of 14:53, 29 October 2010

CLAPPING MUSIC BY STEVE REICH

<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

  1. inplace assignment

for ((i=0; i<13; i++)) do echo $pat pat=${pat:2:0}${pat:0:2}

  1. shift the pattern
  2. ${name:offset:length}


done

cat << end

} } end


  1. bash clap.sh | midge -o clap.mid; timidity clap.mid (straight from bash to timidity without going through all the steps)



OR



pat="xxx_xx_x_xx_"

cat << end

@head {

   \$tempo 120   
   \$time_sig 4/4

} @body {

   @channel 1 {
       \$patch 1
       \$length 16        
       \$octave 4
       \$pan 0

end

for ((bar=0; bar<13; bar++)) do for ((repeat=0; repeat<12; repeat++)) do echo $pat | sed 's/x/c /g; s/_/r /g' done done


cat << end

   }


@channel 2 {
       \$patch 1
       \$length 16
       \$octave 5
       \$pan 127

     


end

for ((bar=0; bar<13; bar++)) do for ((repeat=0; repeat<12; repeat++)) do echo $pat | sed 's/x/c /g; s/_/r /g' done pat=${pat:1}${pat:0:1}

  1. shift the pattern
  2. ${name:offset:length}


done

cat << end

} } end