Difference between revisions of "Further Reading"

From CCRMA Wiki
Jump to: navigation, search
Line 21: Line 21:
  
 
* Now again type ''pwd'' to make sure that you understand where you are! Run the ''ls'' command to see what files are in here.
 
* Now again type ''pwd'' to make sure that you understand where you are! Run the ''ls'' command to see what files are in here.
 +
 +
 +
 +
 +
 +
 +
== Arduino Firmware ==
 +
* Prior to the workshop, the following steps were used to install the StandardFirmata firmware onto the Arduino. If you ever add a new Arduino to your Satellite CCRMA kit, you will need to repeat these steps. Or if you want to customize the firmware, you might want to load a different version of Firmata onto the Arduino or even write your own firmware from scratch.
 +
** The next step is to install some default firmware onto the Arduino so that it knows what we want it to do. First make sure that the Arduino Nano is connected to the Raspberry Pi via the retractable USB cable.
 +
 +
** Then, start the Arduino software in the terminal by typing the following 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.
 +
 +
''arduino &''
 +
 +
** Open ''StandardFirmata'' from the Arduino software pull-down menus File|Examples|Firmata.  Look at the program.  This is what will control the Arduino.
 +
 +
** Select ''Arduino Nano w/ ATMega328'' under Tools->Board and ''/dev/ttyUSB0'' under Tools->Serial Port.  Then hit the Play button to verify and compile the program. 
 +
 +
** Upload the Firmata firmware to your Arduino Nano using upload button, the fourth square button from the left (the one with the sideways arrow). If you watch the RX and TX lights on the Arduino carefully, you will "see" the data flow over the serial USB link into the Arduino as the firmware is uploaded.
 +
 +
** Close the Arduino program by closing all of the Arduino windows. (This is important!)
 +
  
  

Revision as of 14:23, 16 February 2013

This is a smorgasboard of other things to think about.


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. Wait until about 15 seconds after you see the message "Connection to 192.168.105.106 closed by remote host," and then disconnect the USB micro cable powering the Raspberry Pi.


Getting Comfortable With Satellite CCRMA

  • Turn on Satellite CCRMA again using the same procedure as before where you plug the power into the Beagle Board. After about 30 seconds, the board should be booted up again, so you can log in again by running the command

ssh -XY ccrma@192.168.105.106

  • 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/pd-lecture subdirectory, you should run the command

cd pd/pd-lecture

  • Now again type pwd to make sure that you understand where you are! Run the ls command to see what files are in here.




Arduino Firmware

  • Prior to the workshop, the following steps were used to install the StandardFirmata firmware onto the Arduino. If you ever add a new Arduino to your Satellite CCRMA kit, you will need to repeat these steps. Or if you want to customize the firmware, you might want to load a different version of Firmata onto the Arduino or even write your own firmware from scratch.
    • The next step is to install some default firmware onto the Arduino so that it knows what we want it to do. First make sure that the Arduino Nano is connected to the Raspberry Pi via the retractable USB cable.
    • Then, start the Arduino software in the terminal by typing the following 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.

arduino &

    • Open StandardFirmata from the Arduino software pull-down menus File|Examples|Firmata. Look at the program. This is what will control the Arduino.
    • Select Arduino Nano w/ ATMega328 under Tools->Board and /dev/ttyUSB0 under Tools->Serial Port. Then hit the Play button to verify and compile the program.
    • Upload the Firmata firmware to your Arduino Nano using upload button, the fourth square button from the left (the one with the sideways arrow). If you watch the RX and TX lights on the Arduino carefully, you will "see" the data flow over the serial USB link into the Arduino as the firmware is uploaded.
    • Close the Arduino program by closing all of the Arduino windows. (This is important!)




Learning More About Synthesizing Sound

  • Now go back to the terminal again, and run pwd to remind yourself that you are in /home/ccrma/pd/pd-lecture. Run the command

cd ..

(yes with two periods!) to go up one directory level. Run pwd again to check that you are now in /home/ccrma.

  • You used to have to download a zip-file of all of the PD patches and sound files used in this lab. Now, these are instead installed on the Satellite CCRMA kit by default. Type:

cd labs-Music-250a-2012/lab1

and hit enter to change to the Lab 1 directory. If you run ls you will see a variety of PD patches and some sound files.

Play Around With the Patches

  • Go back to pd and open the patch labeled myinstrument.pd inside labs-Music-250a-2012/lab1. Make sure that compute audio is set to on. 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.)


Documentation

  • 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.


Short questions

Why is the following patch a bad idea?

Badidea.gif

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
  • 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 only 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.



The Community

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. Optional: 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.



Appendix: Troubleshooting

Tips:

  • Type dmesg to see if there are any relevant messages that look like error messages.

Solutions:

  • If you are running out of space on the SD card, you can free up some space by deleting items in /usr/src. For instance, all of the files needed for building Pure Data Extended are rather large.
  • If you are unable to access the internet from Satellite CCRMA, and you are not at CCRMA, then you may need to change the DNS nameserver specified in /etc/resolv.conf You could do this using the set-DNS-server command.



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, 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.

However, your Satellite CCRMA kit has to be connected to the Internet in order to download any of these packages!!!


Halt Your Board Properly When Finished!

Remember to shut down your board when you are done before powering it off! (Of course, 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.)



More Pd resources


PID 2013