Software Lab NMC 2013

From CCRMA Wiki

(Difference between revisions)
Jump to: navigation, search
 
(14 intermediate revisions not shown)
Line 50: Line 50:
* Run the command ''pwd'' to find out the current directory. You will find that you are in the ''ccrma'' subdirectory of the directory ''/home''.
* 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
+
* 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'' subdirectory, you should run the command
-
''cd pd_lecture''
+
''cd pd''
* 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.
-
* Find out if you have successfully connected Satellite CCRMA to the Internet by running the command
 
-
''ping yahoo.com''
 
-
* If you get responses that take about 100 ms to 200 ms, then your settings are correct.
 
 +
== Starting Audio And Pd ==
 +
* 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 on the Raspberry Pi (often it is yellow).
-
== Starting Audio And Pd ==
+
* A default pd patch starts running automatically when your kit finishes booting up. To stop the default pd patch from running, execute the command
-
* First we need to start up the audio connection kit. It's easiest to do so using the graphical interface, so execute the command '''start-jackd'''
+
''stop-default''
-
* 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 on the Raspberry Pi (often it is yellow).
+
'''Remember that each time you boot up your kit and want to edit your patch, you should stop the default patch from running by using the command ''stop-default'' '''
-
* Start pd now with the following command, where again we include &:
+
* Start pd now with the following command (the "space" & just means that the pd process shouldn't take over the terminal -- that way you can keep using the terminal independently of whatever pd is doing)
''pd &''
''pd &''
-
* 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.
+
This time the graphical user interface (GUI) for pd should also start.
-
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.
+
* To start audio, click on the ''Compute audio'' checkbox.
 +
* Now to test audio, go to the media pull-down menu and choose ''Test Audio and MIDI.''  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.
 +
* Once you have audio working, close the window test audio and MIDI window.
 +
* Choose ''Open'' from the ''File'' menu and select the patch ''4_algorithmic_music.pd'' within the ''pd_lecture'' subdirectory. 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.
-
== The Patches Are Already On The Board==
+
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.
-
*  You can find the main patch at /home/ccrma/pd/labs-Music-250a-2012/lab1/myinstrument.pd
 
-
== Play Around With the Patches ==
+
== Dive Into Pd ==
 +
* The patch ''~/pd/examples/just-play-WAV-files/play-WAV-file.pd'' shows the easiest way to play a WAV file. Try it out!
-
* 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.
+
* Look at the pd lecture patches stored in ''~/pd/pd-lecture'' (For example, see the patch ''4_algorithmic_music.pd''. Make sure that audio is on and increase the volume from zero in the patch.)
-
* 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.
-
==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.
+
== The Patches Are Already On The Board ==
 +
* You can find the main patch for the laboratory exercise at /home/ccrma/pd/labs-Music-250a-2012/lab1/myinstrument.pd  Open it and 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.)
-
* 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.
 
Line 143: Line 147:
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.
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.
 +
 +
 +
 +
 +
 +
== More Sound Synthesizer Patches ==
 +
* Try out some of the patches from Andy Farnell's book ''Designing Sound.'' These patches are installed in ''~/pd/DesigningSoundBookExamples'' Most of the patches in there work with this version of pd, but a few patches don't! (As you try out the patches, keep in mind also that many of the patches are ''subpatches.'' That means that they are lower level patches that are used to serve some specific purpose within a higher level patch. Therefore, you may have to search around some to find the higher level patches that are easier to use to make sound.)
 +
 +
* One intriguing way to synthesize sound is using physical models. A ''physical model'' is a computer program that simulates the laws of physics to create sound. Some physical models simulate traditional acoustic musical instruments, or other models simulate hypothetical situations that could be built using physical elements, but might be impractical. Try playing around with some of the physical models in ~/pd/SaM-models -- the ''FireFaderSimulator'' versions of the patches are the ones you will want to use. The process of tuning the model parameters can be useful from a compositional perspective because it can help provide you with a specific palette of sounds.
 +
Line 156: Line 170:
-
== Appendix: Troubleshooting ==
+
== Appendix A: Troubleshooting ==
Tips:
Tips:
 +
* If you are having problems with audio, make sure that ''compute audio'' is set to on.
 +
* If the audio is stuttering, then your processor might not be powerful enough to run all of the patches that are open. Remember, Satellite CCRMA is not as powerful as a laptop. Therefore, be careful about building complicated patches. You can monitor how much CPU you are using by running the ''top'' command in the terminal.
* Type <tt>dmesg</tt> to see if there are any relevant messages that look like error messages.
* Type <tt>dmesg</tt> to see if there are any relevant messages that look like error messages.
-
* Check if the Jack audio server has crashed. If so, then restart it.
 
Solutions:
Solutions:
* If you are running out of space on the SD card, you can free up some space by deleting items in <tt>/usr/src</tt>. For instance, all of the files needed for building Pure Data Extended are rather large.
* If you are running out of space on the SD card, you can free up some space by deleting items in <tt>/usr/src</tt>. 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 <tt>/etc/resolv.conf</tt> You could do this using the <tt>set-DNS-server</tt> 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, [http://audacity.sourceforge.net/ Audacity], [http://chuck.cs.princeton.edu/ ChucK], [http://faust.grame.fr/ Faust], [https://ccrma.stanford.edu/groups/soundwire/software/jacktrip/ 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
+
== Appendix B: Transferring Files To and From Your Kit ==
 +
* Download [http://cyberduck.ch/ CyberDuck] to your laptop to make it easy to transfer files back and forth from your kit.
 +
* Start CyberDuck on your laptop, and then create the following new bookmark:
-
''sudo apt-cache pkgnames''
+
[[Image:Bookmark.png]]
-
You will notice that this list is way too long to look at. You can pipe it to the text file using the command
+
* Once you have finished entering the text, close the bookmark window.
 +
* Then you can use CyberDuck to connect to your Satellite CCRMA kit by double clicking on the ''SFTP to Satellite CCRMA'' bookmark.
 +
* After you enter the password ''temppwd'', CyberDuck will connect and open window to open up showing the files in the /home/ccrma home directory on your kit.
 +
* You can drag and drop files from here to move them back and forth.
 +
* If you move WAV files to your kit, please remember that the default sampling rate for pd is 22kHz, so you may want to resample them first. For example, [http://audacity.sourceforge.net/ Audacity] can be used to resample the audio files.
-
''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 using'''
 +
''sudo halt''
-
 
+
'''when you are done before powering it off!'''
-
 
+
-
 
+
-
== 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.)
+
Line 197: Line 209:
== Copying Files To and From Your Kit ==
== Copying Files To and From Your Kit ==
-
* Alternatively, if you would like to use software with a nice GUI for copying files back and forth from your kit, you can install additional special software on your laptop.  For Windows, install [https://itservices.stanford.edu/service/ess/pc/securefx Secure FX], or for Mac OS X, install [https://itservices.stanford.edu/service/ess/mac/fetch Fetch].  These programs actually use scp, but they hide the details of the pathnames from you.
+
* Alternatively, if you would like to use software with a nice GUI for copying files back and forth from your kit, you can install additional special software on your laptop.  For Windows, install [https://itservices.stanford.edu/service/ess/pc/securefx Secure FX], or for Mac OS X, install [https://itservices.stanford.edu/service/ess/mac/fetch Fetch].  These programs actually use ''scp'', but they hide the details of the pathnames from you.

Current revision as of 10:53, 13 August 2013

Lab 1: Making Music with Pd in Satellite CCRMA
Lab write-up due on Tuesday at 10AM

Most instructions by Edgar Berdahl, and lab patches for musical interaction description by Matt Wright and possibly others

For this lab you need your Satellite CCRMA kit, a computer to program it, and some headphones with a mini 1/8" stereo jack.


Contents

The Satellite CCRMA Setup (Before Adding Arduino)

Included in your kit so far you should have

- Raspberry Pi Model B (with 512MB of RAM)
- One memory card (it may already be inserted into your Raspberry Pi)
- One Ethernet cable for communication with your laptop
- One USB micro cable

If you are missing something, please go get it before assembling your kit. Make sure you plug the SD memory card is seated all of the way in its slot.



Powering Up For The First Time

Plug the Ethernet port of the Raspberry Pi into your laptop. Then use the USB micro cable to power up the Raspberry Pi. (If you have a USB power supply, you could use it to power the Raspberry Pi, or if not you can try using your laptop's USB connector to power the Rasberry Pi.) You should see some lights turn on, flickering every now and then. This means that the Raspberry Pi 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. Wait until about 15 seconds after you see the message "Connection to 192.168.105.106 closed by remote host," and then disconnect the power from the Raspberry Pi via the micro USB connector.



Getting Comfortable With Satellite CCRMA

  • Turn on Satellite CCRMA again using the same procedure as before by plugging the micro USB connector into the Raspberry Pi. 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 subdirectory, you should run the command

cd pd

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



Starting Audio And Pd

  • 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 on the Raspberry Pi (often it is yellow).
  • A default pd patch starts running automatically when your kit finishes booting up. To stop the default pd patch from running, execute the command

stop-default

Remember that each time you boot up your kit and want to edit your patch, you should stop the default patch from running by using the command stop-default

  • Start pd now with the following command (the "space" & just means that the pd process shouldn't take over the terminal -- that way you can keep using the terminal independently of whatever pd is doing)

pd &

This time the graphical user interface (GUI) for pd should also start.

  • To start audio, click on the Compute audio checkbox.
  • Now to test audio, go to the media pull-down menu and choose Test Audio and MIDI. 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.
  • Once you have audio working, close the window test audio and MIDI window.
  • Choose Open from the File menu and select the patch 4_algorithmic_music.pd within the pd_lecture subdirectory. 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.



Dive Into Pd

  • The patch ~/pd/examples/just-play-WAV-files/play-WAV-file.pd shows the easiest way to play a WAV file. Try it out!
  • Look at the pd lecture patches stored in ~/pd/pd-lecture (For example, see the patch 4_algorithmic_music.pd. Make sure that audio is on and increase the volume from zero in the patch.)
  • 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.



The Patches Are Already On The Board

  • You can find the main patch for the laboratory exercise at /home/ccrma/pd/labs-Music-250a-2012/lab1/myinstrument.pd Open it and 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.)



Short questions

Why is the following patch a bad idea?

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



More Sound Synthesizer Patches

  • Try out some of the patches from Andy Farnell's book Designing Sound. These patches are installed in ~/pd/DesigningSoundBookExamples Most of the patches in there work with this version of pd, but a few patches don't! (As you try out the patches, keep in mind also that many of the patches are subpatches. That means that they are lower level patches that are used to serve some specific purpose within a higher level patch. Therefore, you may have to search around some to find the higher level patches that are easier to use to make sound.)
  • One intriguing way to synthesize sound is using physical models. A physical model is a computer program that simulates the laws of physics to create sound. Some physical models simulate traditional acoustic musical instruments, or other models simulate hypothetical situations that could be built using physical elements, but might be impractical. Try playing around with some of the physical models in ~/pd/SaM-models -- the FireFaderSimulator versions of the patches are the ones you will want to use. The process of tuning the model parameters can be useful from a compositional perspective because it can help provide you with a specific palette of sounds.



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 A: Troubleshooting

Tips:

  • If you are having problems with audio, make sure that compute audio is set to on.
  • If the audio is stuttering, then your processor might not be powerful enough to run all of the patches that are open. Remember, Satellite CCRMA is not as powerful as a laptop. Therefore, be careful about building complicated patches. You can monitor how much CPU you are using by running the top command in the terminal.
  • 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.



Appendix B: Transferring Files To and From Your Kit

  • Download CyberDuck to your laptop to make it easy to transfer files back and forth from your kit.
  • Start CyberDuck on your laptop, and then create the following new bookmark:

Image:Bookmark.png

  • Once you have finished entering the text, close the bookmark window.
  • Then you can use CyberDuck to connect to your Satellite CCRMA kit by double clicking on the SFTP to Satellite CCRMA bookmark.
  • After you enter the password temppwd, CyberDuck will connect and open window to open up showing the files in the /home/ccrma home directory on your kit.
  • You can drag and drop files from here to move them back and forth.
  • If you move WAV files to your kit, please remember that the default sampling rate for pd is 22kHz, so you may want to resample them first. For example, Audacity can be used to resample the audio files.



Halt Your Board Properly When Finished!

  • Remember to shut down your board using

sudo halt

when you are done before powering it off!



Copying Files To and From Your Kit

  • Alternatively, if you would like to use software with a nice GUI for copying files back and forth from your kit, you can install additional special software on your laptop. For Windows, install Secure FX, or for Mac OS X, install Fetch. These programs actually use scp, but they hide the details of the pathnames from you.



More Pd resources


PID 2013
Personal tools