B104 linux machine

CONTENTS

INTRODUCTION

This page contains directions for using the B104 linux machine and getting sound and MIDI in and out of it.. This version is tailored for the MUSIC 271 course, fall 2005.

The "linux machine" lives in a closet with its screen, keyboard and mouse to the left of the mixer in B104. You can log onto it directly, or, (details later) remotely via the "ssh" program. The machine is running Fedora 4, with KDE as the default desktop; you can change this, but the instructions below will assume you stuck with KDE.

To get started you will need a linux machine account (get this from Miller). The door code to the room comes from the music facilities office.

The customary way to use UNIX is through "shells", which appear in windows. Unless you customize your account differently, you can make a shell window appear on a linux machine by right-clicking anywhere on the desktop and selecting "Open Terminal". You should get a new window with a prompt like "[msp@linux104 ~]$ ". This indicates that UNIX is waiting for you to type a command to it.

When you're through with your UNIX shell you can type

    exit
or sometimes a simple control-D. To log off the machine altogether, find the "log off" menu item (in "desktop). It's a good idea to remember to log off when you're ready to leave.

Note the font style conventions in the example above:

machine-name: anything in italics stands for something you type in.
ssh: anything in this style is what you type in exactly.

UNIX BASICS

This section describes what you should do once you're sitting at the linux machine and have one or more "shells" open on the linux machine.

When you issue a command to a UNIX shell, it usually responds by trying to find a program by that name and run it. Some programs are GUI-based, but the majority just do what you ask and then quit. This makes it easy to automate things, but on the other hand you have to learn what things do up front; there are no cute dialogs to lead you through operations like moving files around.

The UNIX filesystem is arranged as a hierarchy of "directories". Your shell is always in some directory or other, called the "current working directory". When you type out a "simple" filename it is assumed to be in the current directory. You can specify other directories besides the current one using slashes; so if you're in /home/fred for example (this means the subdirectory "fred" of the toplevel directory "home") you can type "tickle/salty" to refer to a file "salty" in the subdirectory "tickle". The "absolute" (full) pathname to the same file would be "/home/fred/tickle/salty". A filename starting with a slash is taken to be absolute; filenames starting with any other character are relative to the current Working Directory.

Here is a short (and incomplete) list of commands you will soon need. All but "nc" are generic UNIX commands.

Files and Directories

Back to top.

Print working directory
To find out in which directory you managed to end up, type:

    pwd

to "print your working directory."

WHen you start a new shell, you will find yourself in your home directory, such as /home/bosco.

Changing directories
The cd command stands for "change directory." You can move to the class directory or your home directory with this command.
Change to another directory
  1. Type the following command where directory_name stands for the directory to which you want to go.
  2. cd directory_name

Change to your home directory
Note that the ~ has magic powers. Alone, it stands for your home directory. When it precedes a user name, it means that person's home directory.
  1. Type:

  2. cd

    OR

    cd ~

You won't see anything happen.
Change to someone else's home directory
  1. Type the following, where username stands for the other person's home directory (e.g. khagan):
  2. cd ~username

Listing the contents of a directory
Next to pwd, ls ("list") is the most useful command for determining where you are. You may either list your current directory by not providing an argument, or you may list another directory by providing its pathname.

  1. To list the current working directory, type:

  2. ls

  3. To list another directory, type:

  4. ls pathname

Copying files
To copy a file, type:
    cp existing_file new_copy

If you specify two simple filenames (without slashes) the cp program works within the current directory. You may specify pathnames for either the source and/or the destination file. If the destination is an existing directory, the new file has the same name as the old one:

  1. Copying a file from someone else's home directory to the current directory:

  2. cp ~username/old-filename new-filename

  3. Copying a pd help file to the current directory:

  4. cp /usr/local/pd/doc/3.audio.examples/17.sampler.loop.pd .

  5. Alternatively:

  6. cd /usr/local/pd/doc/3.audio.examples

    cp 17.sampler.loop.pd ~

Removing files

To remove a file, type:

    rm filename

The filename can be a simple (slashless) filename or a pathname.

Moving files or directories

The syntax for moving files is the same as for copying them:

    mv old-filename new-filename

To move many files at once:
    mv filename1 filename2... destination-directory

Making directories
The mkdir command stands for "make directory." The command creates a directory in the current working directory unless you specify a pathname to another directory.
  1. Change to the directory in which you wish to create a directory.
  2. Type:

  3. mkdir directory_name

You won't see any changes. If you know the pathname to a directory, you can skip the step where you change to the directory in which you wish to create the new directory. Then you may simply type:

    mkdir pathname/directory_name

Copying directories
The cp command stands for "copy." This command may be used for directories or files (see Copying Files below). cp will copy the given file to the current working directory or a specified directory. Since a directory often has contents, you must specify that the command must work recursively. Therefore, the option -r causes cp to copy the contents within the target directory as well.

Type:

    cp -r pathname/target_directory_name pathname_to_destination

It is important to note that one may copy a directory and change the name of the copy by specifying a name for the destination directory withing the command. For example,

    cp -r ~/my_original_directory ~/destination/my_copy

will copy the my_original_directory, which lives in my home directory, to the directory named "destination." However, it will rename it to "my_copy."

Changing access permissions

Sometimes you won't be able to read your friends' files because your account won't have the necessary permission. Ask your friend to make the relevant files "public readable". Also you will need read and "execute" permission to the directories you need to search through to get the files in question. To make a file readable by anyone (but to allow only the owner to modify it, type

    chmod 644 filename1 filename2...

    chmod 755 directory1 directory2...

You can verify the settings using ls -l which gives you a readout as in:
-rw-r--r--   1 msp      msp          5156 Jan 24  1999 1.ring-mod.pd
-rw-r--r--   1 msp      msp          5474 Jan 24  1999 2.bandpass.pd
-rw-r--r--   1 msp      msp         12805 Jan 25  1999 3.phase.vocoder.pd
-rw-r--r--   1 msp      msp           617 Jan 24  1999 README.txt

The "-rw-r--r-" should have 3 "r"s in it if the file is public readable.

to list the current directory itself (not its contents), type ls -l -d . For a directory you should get "rwxr-xr-x".

Reading the UNIX manual
To get help on a UNIX command, type, for example, man ls .

Editing text files
The good text editor is called "nedit." From a shell you can type, for instance,
    nc file1 file2...

SSH: remote login

You can use the "ssh" ("secure shell") program to login to other UNIX machines:

    ssh machine-name

    ssh user-name@machine-name

(You would use the second form is your username is different on the two machines.)

You can use the same protocol to get onto a UNIX machine from a PC or a Macintosh. To do this, find a free "ssh client" for your platform. For the PC, a good one is "putty" which you can find by typing "putty" to Google. I'm not sure which client to use from Mac OS9. From Mac OSX, just use "ssh", which you type to a terminal window.

SFTP: transferring files
Also assuming you find the right client to download, you can run a file-transfer program to get files into and out of the linux machine. From UNIX, type
    sftp user-name@machine-name

(or use the short form if the user names are the same.) From a PC, I use "psftp", also from the Putty web site; type the command to a terminal window.

"psftp" is an interactive, "text-based" program into which you type commands. When you invoke sftp, you should see a prompt like "sftp>". Useful commands from within sftp are:

There seems to be no automatic way to copy collections of files; to do this you probably should use the "scp" program:
    scp -r source-directory destination-machine:destination-directory

... which for a PC is "pscp", and in which you can supply user names in the same way as above.

RUNNING THE MUSIC 271 PATCHES

If you know the details of which audio and MIDI devices you want, you can run Pd directly by typing "pd" to a shell, probably with arguments to specify how you want things set up. But for the purposes of the Music 271 course, there's an auxilliary program named "pdrp" which handles the details for you. Type "pdrp" to a shell and see:
   1) TEST-TONE             6) manoury-pluton      11) stockhausen-mantra
   2) boulez-dialogue       7) reich-phase         12) tenney-collage
   3) chowning-stria        8) risset-duet         13) yuasa-midnight
   4) harvey-mortuous       9) saariaho-noanoa     14) quit
   5) manoury-jupiter      10) steiger-loops
   #?

Now type a number from 1 to 14. Start with "1", the test tone. When you're done with the test tone, quit Pd and you get the "pdrp" menu back. "14" quits and you get back to the shell prompt.

THE B104 LINUX MACHINE AUDIO SETUP

The linux machine has eight audio connections to and from the B104 patch bay. The outputs normally appear on the mixer's line inputs 1 through 8. The mixer's "control room" output goes to the stereo pair, and the mixer "buss" outputs can be patched to the 8 smaller speakers.

The mixer, a Tascam DM-24, is extremely complicated.

To start out, recall the "linux" setting for the mixer (number 4). Just recalling a setting on the mixer can be difficult. First hit the "library" button (right of screen) until you see the preset library show up (other libraries control effects, etc; the button cycles between them). Then twiddle the knob until preset 4 shows. Then CHECK THE "SNAPSHOT RECALL SAFE" flags which can defeat the setting from actually taking effect! They should be showing on the LCD screen. Then hit the "recall" button (not the "enter" button which is probably how you messed up the snapshot recall safe settings above.)

The input channel levels and the Control Room settings aren't presettable and have to be massaged by hand: input levels to 10 oclock or so, control room select to "stereo", and control room volume to 12 oclock.

To hear stereo sound output, patch the "control room out" (third row, 14 and 13 from right) to the main speaker outputs (fourth row, all the way to the right).

Then run the PDRP test tone and see if you get anything.

To get sound into the computer, you will probably want to run through the mixer channels 9-16 and route them to Aux outputs. The "linux" preset sends channel 9 to Aux 1, which appears as "assignable output 1" on the patch bay (first row, 16 and 15 from right). Patch this to "Delta 10/10 / linux input" channel 1 (second row, all the way to the left). Usually I patch both Aux 1 and 2 as a pair, but this isn't necessary for any of the patches here.

Usually you'll want to send the microphone to the computer. First, make sure the mic is plugged into the mixer (I use channel 9). Switch the meter bar to "ch 1-24", tap on the mic, and hope to see a signal on the meter. Then it migth be a good idea to switch the meter bridge to "master" and verify that the Aux 1 output also has the signal. Then, assuming you've set teh patch bay as described above, run the "pdrp" test tone patch, turn on "meters" there, and see if the numbers are in a good range (tapping the mic should give 80 or 90 dB; 100 is clipping.)

RECORDING AND EDITING SOUNDFILES

The good sound editor is Audacity. You can start it from the KDE menu ("applications->sound&video") or from a shell by typing "audacity". Make sure Pd is not making sound when Audacity starts (it will fail to get the audio hardware and not check again until restarted), but once it starts up you can alternate between recording/playing from Audacity and making sound with Pd.

MIDI

B104 has a MIDI piano connected to the Linux machine. The piano has to be put in "real time MIDI mode." After powering the piano up, hit "midi" and then hit the RECORD button until you see that MIDI out is "kbd" and not "DELAYOUT." You should test this using the "testtone" patch (via the "pdrp" command) before you try to use it.


Acknowledgement: the UNIX lore here is adapted from Kerry Hagan's UNIX page.