User:Albert Jongstra/openevents/technicalcourse

From XPUB & Lens-Based wiki
< User:Albert Jongstra‎ | openevents
Revision as of 20:33, 23 September 2010 by Migratebot (talk | contribs) (Created page with "== TECHNICAL COURSE == == SEQUENTIAL LOOP == <source lang="text"> from os import system for i in range(1): system("cat snare05.raw >> song.raw") system("cat ...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

TECHNICAL COURSE

SEQUENTIAL LOOP

from os import system

for i in range(1):
    system("cat snare05.raw >> song.raw")
    system("cat snare05.raw >> song.raw")
    system("cat snare05.raw >> song.raw")
    system("cat snare05.raw >> song.raw")
    system("cat loop06.raw >> song.raw")
    system("cat loop7.raw >> song.raw") 
    system("cat snare05.raw >> song.raw")
    system("cat snare05.raw >> song.raw")   
    system("cat snare05.raw >> song.raw")


system("sox --rate 44100 --bits 16 --channels 2 --encoding signed-integer song.raw song.wav")
system("rm song.raw")
system("play song.wav")


NESTED LOOP

#!/bin/bash

# nested-loop.sh Nested "for" loops.

outer=1             # Set outer loop counter

# Beginning of outer loop
for a in 1 2 3 4 5
do
    echo "pass $outer in outer loop."
    play -c1 -r8000 -n synth 0.50 sine 220 vol 0.7
    play -c1 -r8000 -n synth 0.25 square 220 vol 0.7
    play -c1 -r8000 -n synth 0.25 noise 220 vol 0.7
    play -c1 -r8000 -n synth 0.50 sine 220 vol 0.7
    inner=1         # Reser inner loop counter

    # ===========================================
    # Beginning of innner loop.
    for b in 1 2 3 
    do
        play -c1 -r8000 -n synth 0.25 noise 220 vol 0.7
        play -c1 -r8000 -n synth 0.50 sine 220 vol 0.7
        play -c1 -r8000 -n synth 0.2 pinknoise 220 vol 1.0
        play -c1 -r8000 -n synth 0.60 square 55 vol 0.7 
        let "inner+=1" # Increment inner loop counter
    done
    # End of inner loop.
    # ===========================================

    let "outer+=1"     # Increment outer loop counter.
    echo               # Space between outputr in pass of outer loop.
done
# End of outer loop.

# combine all the individual files to a single file

exit 0