Syllabus 20091006

From XPUB & Lens-Based wiki

Tue Oct 6, 2009

  • Review Command-line imagemagick assignment from last week
  • "Audio Loops" Intro / "Hands-on" digital audio

Audio loops & "cat" ups

Check out the sox cookbook page.

Create your tones

Start by using sox to generate some "building block" sounds.

Convert each sound to a "raw" file to be manipulated by Python.

sox source.wav --rate 44100 --bits 16 --channels 2 --encoding signed-integer source.raw


Use Python Loops as a "Sequencer"

from os import system

for i in range(3):
    system("cat 01.raw >> song.raw")
    system("cat 03.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")


Example of "sequential loops":

from os import system

for i in range(3):
    system("cat 01.raw >> song.raw")
    system("cat 03.raw >> song.raw")

for i in range(3):
    system("cat 02.raw >> song.raw")
    system("cat 04.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")


Example of a "nested loop":

from os import system

for i in range(3):
    system("cat 01.raw >> song.raw")
    system("cat 03.raw >> song.raw")

    for i in range(3):
        system("cat 02.raw >> song.raw")
        system("cat 04.raw >> song.raw")

# print("goodbye")

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



Finding open-licensed audio online

sample source

Assignment for next week

Produce a "song" using sox & python loops. Produce two "songs", one with "sequential loops", and one with a nested loop.


Attachments