Difference between revisions of "Software Lab 250"
|Line 2:||Line 2:|
Lab write-up due on Wednesday, Oct. 5 at 5PM
Lab write-up due on Wednesday, Oct. 5 at 5PM
Most instructions by Edgar Berdahl, and lab patches for musical interaction description by Matt Wright and possibly others. See the instructions on [https://ccrma.stanford.edu/courses/250a/labs/ https://ccrma.stanford.edu/courses/250a/labs/] for how to submit the lab!
Most instructions by Edgar Berdahl, and lab patches for musical interaction description by Matt Wright and possibly others. See the instructions on [https://ccrma.stanford.edu/courses/250a/labs/ https://ccrma.stanford.edu/courses/250a/labs/] for how to submit the lab! For this lab you need your [http://ccrma.stanford.edu/~eberdahl/Satellite Satellite CCRMA kit], a computer to program it, and some headphones with a mini 1/8" stereo jack.
For this lab you need your [http://ccrma.stanford.edu/~eberdahl/Satellite Satellite CCRMA kit], a computer to program it, and some headphones with a mini 1/8" stereo jack
Revision as of 16:14, 21 September 2011
Lab 1: Intro To Satellite CCRMA and Making Music with Pd
Lab write-up due on Wednesday, Oct. 5 at 5PM
Most instructions by Edgar Berdahl, and lab patches for musical interaction description by Matt Wright and possibly others. See the instructions on https://ccrma.stanford.edu/courses/250a/labs/ for how to submit the lab! For this lab you need your Satellite CCRMA kit, a computer to program it, and some headphones with a mini 1/8" stereo jack.
- 1 The Satellite CCRMA Setup
- 2 Powering Up For The First Time
- 3 Connect To Satellite CCRMA
- 4 Avoid Powering Down the Board Without Halting it First!
- 5 Getting Comfortable With Satellite CCRMA
- 6 Starting Audio And Pd
- 7 Download the Lab Patches
- 8 Play Around With the Patches
- 9 Documentation
- 10 Short questions
- 11 Design a different musical interaction
- 12 The Community
- 13 Optional: Programming Linux
- 14 Halt Your Board Properly When Finished!
The Satellite CCRMA Setup
Included in your kit you should have
- Satellite CCRMA Hardware (Beagle Board + microSDHC memory card + Arduino Nano + solderless breadboard) - One 5V power adaptor to plug into the Beagle Board - One Ethernet cable for external communication - Arduino Nano - One GT Max adjustable-length USB cable
If you are missing something, please go get it before assembling your kit. Use the USB cable to connect the Arduino to the Beagle Board. Make sure you plug the micro SDHC memory card fully into its seat so that it looks as shown inside the red box:
Powering Up For The First Time
Plug the Ethernet port of the Satellite CCRMA into your laptop. Then plug in the 5V power supply into the Beagle as shown below. You should see some lights turn on, flickering every now and then. This means that Satellite CCRMA is booting up.
Connect To Satellite CCRMA
In order to see what your Satellite CCRMA kit is doing and program it, you need to log in to it. To do so, follow these instructions.
After you login, you will see the prompt ccrma@satellite:~$ This means that you are logged into a computer named "satellite" as the user "ccrma", and you are currently in the directory ~, which is the shortcut for your home directory.
Avoid Powering Down the Board Without Halting it First!
Would you take the battery out of your laptop and unplug its power adaptor without shutting down? I don't think so! The same goes for Satellite CCRMA, at least when you can avoid it, because it is a small computer running linux.
Now we will test the halt procedure. Run the halt command as superuser by typing sudo halt at the Satellite CCRMA prompt. Then you will again have to type in the password temppwd in order to have the privilege to run this command. The SSH connection will be closed, but it will still be 20 seconds or so before Satellite CCRMA has completely shut down. (Note: The command sudo reboot would instead have caused Satellite CCRMA to reboot itself.)
Wait an extra entire minute to ensure that Satellite CCRMA is shut down. However, it will not power itself off. To do this, you need to disconnect the 5V power adaptor from the hub.
Getting Comfortable With Satellite CCRMA
- Turn on Satellite CCRMA again using the same procedure as before where you plug the power into the USB hub. After about 30 seconds, the board should be booted up again, so you can log in again by running the command
ssh -XY firstname.lastname@example.org
- Run the command pwd to find out the current directory. You will find that you are in the ccrma subdirectory of the directory /home.
- Type the ls command to see what is in the current directory. The blue items are subdirectories of the current directory. You can change directories using the cd command. For instance, to change into the pd_lecture subdirectory, you should run the command
- Now again type pwd to make sure that you understand where you are! Run the ls command to see what files are in here.
- Find out if you have successfully connected Satellite CCRMA to the Internet by running the command
- If you get responses that take about 100 ms to 200 ms, then your settings are correct.
Starting Audio And Pd
- First we need to start up the audio connection kit. It's easiest to do so using the graphical interface, so execute the command
The ampersand (&) is there to indicate that even though you are opening a new window, you should still be able to keep typing at the old terminal. There might be some strange error message windows, but just close these to get back to the main JACK Audio Connection Kit. To start audio, click on the Start button.
- In order to be able to hear audio, you will need to plug a pair of ear buds, headphones, or loudspeakers into the 1/8" (2.54mm) jack labeled AUDIO OUT on the Beagle Board. Be very careful when plugging the headphones in and not to pull too hard on the headphone cable! Unfortunately it comes off of the board very easily, and then you will have to buy a new board for $150!!!
- Start pd now with the following command, where again we include &:
- Choose Open from the File menu and select the patch 4_algorithmic_music.pd. In the main pd-extended window, click on the compute audio button. Then go back to the patch, move the speed and width sliders slightly to the right, and bring up the volume. You should now hear some sound in your headphones. Play around with the parameters to see what new sounds you can discover.
Troubleshooting: If you still do not here any sound, then probably you missed one of the steps so far. If you look at the messages in the main pd window, you might find a clue.
Download the Lab Patches
- Now go back to the terminal again, and run pwd to remind yourself that you are in /home/ccrma/pd_lecture. Run the command
(yes with two periods!) to go up one directory level. Run pwd again to check that you are now in /home/crrma.
- The wget command can be used to download a file off of the Internet from any public http-style URL. To download the patches for this laboratory exercise, run the command
- Run ls to verify that you can see software_lab_pd.zip in the current directory.
- It is a ZIP archive, so to unarchive the contents run
- Type ls again just to make sure, and then enter the directory that came out of the ZIP file by executing
Play Around With the Patches
- Go back to pd and open the patch labeled myinstrument.pd inside software_lab_pd. Make sure that compute audio is set to on and qjackctl is still open and running. Play around with the patch. You should be able to exhaust its musical potential in a matter of minutes; reflect on its strengths and limitations.
- Also try to understand how it works as a piece of software. (But please don't get hung up on the arcana - as always, if you get stuck, ask for help rather than waste time.)
- Right-click or option-click on any object to get a contextual menu including "help," which opens that object's help patch. (If you are using a Mac and don't have a right mouse button, then go to the X11 pull-down menu, select Preferences, and make sure that Emulate three button mouse is checked in the Input pane. Now, you should be able to right-click by clicking while holding down the Command key.)
- Right-click on a blank portion of a Pd patch. Now when you select "help" you get a list of Pd's built-in objects, arranged by category.
- In the upper right hand corner of each Pd window is a "help" menu. This accesses the Pd tutorials as well as some online reference documentation.
Why is the following patch a bad idea?
Make a patch that shows how to connect some objects together to calculate the function 1-x where x is an input number. Save the patch in a file called OneMinus.
Design a different musical interaction
Here are some ideas of changes that might make the patch more interesting:
- Involve more QWERTY keys
- Involve the mouse (see the [MouseState] object)
- Load in a larger collection of samples.
- Implement a mechanism to switch among banks of samples
- Multiple gestures to one result: design a way for the parameters of each triggered note to depend on multiple key presses. For example, maybe only the space bar triggers notes, and all the other keys determine parameters of notes.
- Make your patch automatically generate a bassline as a function of the key presses
- Set multiple parameters modally, as volume works in the sample patch
- Use chording: keep track of all the keys that are currently pressed, and use only that information to set the parameters for each note.
- One gesture to multiple results
- Use the "metro" object to trigger a steady stream of notes. Now you have two new parameters: repetition rate, and whether the metro is on or off.
- Use the "counter" object to step through a cycle (of samples, parameter settings, etc.)
- You could combine "metro" and "counter" to build a rudimentary sequencer that can step through a rhythmic pattern
- Invent a mechanism to record short sequences of keypresses and play them back in time.
- Incorporate looping or other interactive controls over the soundfile playback
- Use Pd's "spigot" object to route control information to different parts of your patch at different times
- Use some additional signal processing such as a filter, delay line, reverb, tremolo, etc. This gives you more parameters to control.
- Polyphony: make it so the patch can play multiple samples at the same time. (Hint: put multiple copies of "play-sample" in your patch)
- Use a totally different form of sound synthesis, such as FM, granular, or physical modeling.
We recommend that you pick one or a small number of these and work on it in depth, iterating on both the program/test/debug cycle as well as the design/implement/play cycle to craft something that has actual musical potential or is at least more fun to play. If you have an existing idea for your class project, you could use this lab to start thinking about implementing some of the modes and mappings. By all means, if you're inspired to try something else, go for it. If you'd rather spend today getting more of a broad sense of Pd's capabilities, feel free to work on many of these suggestions.
There is a large, dedicated, and very generous community of Pd users on the Internet. Do some web searching (e.g., with a search engine, or else starting from some more specific resources) and look for interesting externals and/or patches. Download, install, and play with at least one. Can you incorporate it into what you programmed in the previous part?
For more help in finding resources, don't forget to look on the PID Links page.
Optional: Programming Linux
We don't actually expect you to do anything here, we are just providing some more information that is maybe helpful for you linux gurus. Since ccrma@satellite runs ubuntu linux on an OMAP chip, many standard software packages have been compiled for it. This is why we were easily able to install software such as Jack, Audacity, ChucK, Faust, Jacktrip, and the Arduino software.
If you are lucky, you can install your favorite software using the apt-get utility. To get a list of packages available on the OMAP's ARM architecture, type
sudo apt-cache pkgnames
You will notice that this list is way too long to look at. You can pipe it to the text file using the command
sudo apt-cache pkgnames > packages.txt
and then look at it using emacs packages.txt, or you search for a particular package, such as
sudo apt-cache pkgnames | grep emacs.
Or, you can compile linux software yourself on the Beagleboard. The gcc, g++ tools etc. are already installed.
Type the df command. You can see that there is not a whole lot more than 1GB available on the SD card, so you should only install software if you decide that you need it.
Halt Your Board Properly When Finished!
Remember to shut down your board when you are done before powering it off! (Of course as Spencer pointed out, if you are operating truly autonomously, of course you cannot login and run the halt command. Nevertheless, if it is not too inconvenient please try to shut down properly if you can. If you do not, then you may find that your memory card becomes corrupted.) As described above, you can do this by executing the command sudo halt and then waiting 30 seconds before disconnecting the power cables.