Basic Electroacoustics II: Programming and Electronics for Art & Music

Music G6602
Tuesday 3-5pm, Room 313 Prentis Hall
Spring 2010
hello.
Professor: Douglas Repetto [douglas at music columbia edu]
TA: Damon Holzborn [damon at zucasa dot com]
hello.
Our Motto: "Why and how."
hello.
syllabus | schedule

06 April 2010

Python & the command line

Today we'll take a look at the Python programming language and some basic command line skilz that kilz.

Both Python and the command line are a next step towards your glorious hacker future. They're tools that are not as domain-specific as Processing, which means they're a bit more difficult to get your head around at first, but they're ultimately quite powerful.

The command line

The command line is a text-based interface for your computer. Instead of using the mouse to click on things, you type commands into a text "terminal." Why would you want to do that?

If you search on "command line tutorial" you'll find lots of semi-useful sites that go over the basic commands. We'll do a quick tour through this one.

    ls  	list files and directories
    ls -a 	list all files and directories
    mkdir 	make a directory
    cd directory 	change to named directory
    cd 	change to home-directory
    cd ~ 	change to home-directory
    cd .. 	change to parent directory
    pwd 	display the path of the current directory
    
    cp file1 file2  	copy file1 and call it file2
    mv file1 file2 	move or rename file1 to file2
    rm file 	remove a file
    rmdir directory 	remove a directory
    cat file 	display a file
    less file 	display a file a page at a time
    head file 	display the first few lines of a file
    tail file 	display the last few lines of a file
    grep 'keyword' file 	search a file for keywords
    wc file 	count number of lines/words/characters in file
    
    command > file  	redirect standard output to a file
    command >> file 	append standard output to a file
    command < file 	redirect standard input from a file
    command1 | command2 	pipe the output of command1 to the input of command2
    cat file1 file2 > file0 	concatenate file1 and file2 to file0
    sort 	sort data
    who 	list users currently logged in

Python

Here's a good list of Python tutorials. We'll stroll through a little bit of this one.

An example!!!

We'll take a quickquick look at the EchoNest remix API as an example of using Python and the command line to make music. We'll make a remix example that prints out beat locations and durations in an mp3 file and then manipulates that data using various command line commands.

Assignment:

For next week, please bring as many of these things as you can. All available at RadioShack or from the innards of a broken toy. There are three or for RadioShacks close to campus. Keep walking south on Broadway until you find all that you need! Optional: