Micro Computer Music

PINOUTS
PI IO CONFIGURATIONS
FLOSS MANUAL
JK MANUAL
CLASS EXAMPLE FILES
MORE EXAMPLE FILES
TERMINAL COMMANDS

WEEK 1

  • Introduction
  • Set up PI for VNC – headless setup
  • Set up / clean up your home Wifi Network settings after logging in with VNC
    sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
  • Linux OS
  • Getting Started with PD
  • ZOOM

Objects, messages, numbers, bang, etc
Basic operation
Basic math
Order
Expression
More math
Float and counter

HOMEWORK: Explore object help files in PD

WEEK 2

* BEFORE WE START*

FIX ERROR MESSAGE IN TERMINAL – copy and paste code below into terminal and press ENTER

sudo nano /etc/bash.bashrc

HARDWARE IO PT 1

KEYBOARD AND MOUSE
JOYSTICKS AND HID DEVICES
MIDI – AMIDIAUTO
PI GPIO
PDUINO OBJECT (USE OLDEST VERSION OF FIRMATA) – EXAMPLE
ARDUINO SERIAL OBJECT – SERIAL WRITE AND SERIAL PRINT
TOUCH OSC – EXAMPLE

ZOOM

PD BASICS

PD Basics – Math and Logic
http://www.pd-tutorial.com/english/index.html

Building a Simple Synth
http://write.flossmanuals.net/pure-data/simple-synth/

WEEK 3

HARDWARE IO PT 2

Analog Input from MPC3008 IC to GPIO using I2C

  • PIN 16 – +3
  • PIN 15 – +3
  • PIN 14 – GRND
  • PIN 13 – SPISCLK
  • PIN 12 – SPIMISO
  • PIN 11 – SPIMOSI
  • PIN 10 – SPICS0
  • PIN 9 – GRND
  • PIN 1 – 8 ANALOG INPUTS
Image result for MPC3008

ANALOG TO DIGITAL ICS AND BREAKOUT BOARDS
USB AUDIO IO
ELECTRET MICROPHONE INPUT THOUGH USB

TRS Plug goes into USB audio mic input


Serial Arduino Example (Arduino Code – PD abstractions are in your Externals folder)
OSC (Using your Phone as an extra controller) PD example
Netsend (Communication between external Python scripts and PD)

ZOOM

Week 4

Project Punch List Shoot Out Pt 1

Sequencers
Randomizing
Complex patching = use subpatches and the send/receive objects
Communication with outside software/programs using OSC
Synth objects

ZOOM

Week 5

Sequencer

Panner

Variable Messages

DSP and Sampling

Sample Looper

Develop Patch for Instrument

Week 6

pduinoMaster

ocsExample

Advanced Options for Integrating Sensors and Interface

Develop Patch for Instrument

Processing

Develop Patch for Instrument

Week 7

Build a synth
Synth Building Blocks

samplerS.pd

Motion Sensor

Startup Script
sudo pd -rt -gui -open /path/to/your/patch.pd
Command Line Options

Work on Final Project

RESOURCES

Make an LED Tester!

USEFUL TERMINAL COMMANDS

  • sudo nano /etc/dhcpcd.conf: edit ethernet and wifi settings with nano
  • ssh pi@192.168.0.200: ssh via static IP
  • ssh pi@pi1.local: ssh via without static IP

KEY COMMAND SHORTCUTS

  • Ctrl+B: Moves the cursor backward one character.
  • Ctrl+C: Cancels the currently running command.
  • Ctrl+D: Logs out of the current session.
  • Ctrl+F: Moves the cursor forward one character.
  • Ctrl+H: Erase one character. Similar to pressing backspace.
  • Ctrl+P: Paste previous line(s).
  • Ctrl+S: Stops all output on-screen (XOFF).
  • Ctrl+Q: Turns all output stopped on-screen back on (XON).
  • Ctrl+U: Erases the complete line.
  • Ctrl+W: Deletes the last word typed. For example, if you typed ‘mv file1 file2’ this shortcut would delete file2.
  • Ctrl+Z: Cancels current operation, moves back a directory or takes the current operation and moves it to the background. See bg command for additional information about background.

GENERAL COMMANDS

  • apt-get update: Synchronizes the list of packages on your system to the list in the repositories. Use it before installing new packages to make sure you are installing the latest version.
  • apt-get upgrade: Upgrades all of the software packages you have installed.
  • clear: Clears previously run commands and text from the terminal screen.
  • date: Prints the current date.
  • find / -name example.txt: Searches the whole system for the file example.txt and outputs a list of all directories that contain the file.
  • nano example.txt: Opens the file example.txt in the Linux text editor Nano.
  • poweroff: To shutdown immediately.
  • raspi-config: Opens the configuration settings menu.
  • reboot: To reboot immediately.
  • shutdown -h now: To shutdown immediately.
  • shutdown -h 01:22: To shutdown at 1:22 AM.
  • startx: Opens the GUI (Graphical User Interface).

FILE AND DIRECTORY COMMANDS

  • cat example.txt: Displays the contents of the file example.txt.
  • cd /abc/xyz: Changes the current directory to the /abc/xyz directory.
  • cp XXX: Copies the file or directory XXX and pastes it to a specified location; i.e. cp examplefile.txt /home/pi/office/ copies examplefile.txt in the current directory and pastes it into the /home/pi/ directory. If the file is not in the current directory, add the path of the file’s location (i.e. cp /home/pi/documents/examplefile.txt /home/pi/office/ copies the file from the documents directory to the office directory).
  • ls -l: Lists files in the current directory, along with file size, date modified, and permissions.
  • mkdir example_directory: Creates a new directory named example_directory inside the current directory.
  • mv XXX: Moves the file or directory named XXX to a specified location. For example, mv examplefile.txt /home/pi/office/ moves examplefile.txt in the current directory to the /home/pi/office directory. If the file is not in the current directory, add the path of the file’s location (i.e. cp /home/pi/documents/examplefile.txt /home/pi/office/ moves the file from the documents directory to the office directory). This command can also be used to rename files (but only within the same directory). For example, mv examplefile.txt newfile.txt renames examplefile.txt to newfile.txt, and keeps it in the same directory.
  • rm example.txt: Deletes the file example.txt.
  • rmdir example_directory: Deletes the directory example_directory (only if it is empty).
  • scp user@10.0.0.32:/some/path/file.txt: Copies a file over SSH. Can be used to download a file from a PC to the Raspberry Pi. user@10.0.0.32 is the username and local IP address of the PC, and /some/path/file.txt is the path and file name of the file on the PC.
  • touch example.txt: Creates a new, empty file named example.txt in the current directory.

NETWORKING AND INTERNET COMMANDS

  • ifconfig: To check the status of the wireless connection you are using  (to see if wlan0 has acquired an IP address).
  • iwconfig: To check which network the wireless adapter is using.
  • iwlist wlan0 scan: Prints a list of the currently available wireless networks.
  • iwlist wlan0 scan | grep ESSID: Use grep along with the name of a field to list only the fields you need (for example to just list the ESSIDs).
  • nmap: Scans your network and lists connected devices, port number, protocol, state (open or closed) operating system, MAC addresses, and other information.
  • ping: Tests connectivity between two devices connected on a network. For example, ping 10.0.0.32 will send a packet to the device at IP 10.0.0.32 and wait for a response. It also works with website addresses.
  • wget http://www.website.com/example.txt: Downloads the file example.txt from the web and saves it to the current directory.

SYSTEM INFORMATION COMMANDS

  • cat /proc/meminfo: Shows details about your memory.
  • cat /proc/partitions: Shows the size and number of partitions on your SD card or hard drive.
  • cat /proc/version: Shows you which version of the Raspberry Pi you are using.
  • df -h: Shows information about the available disk space.
  • df /: Shows how much free disk space is available.
  • dpkg – –get–selections | grep XXX: Shows all of the installed packages that are related to XXX.
  • dpkg – –get–selections: Shows all of your installed packages.
  • free: Shows how much free memory is available.
  • hostname -I: Shows the IP address of your Raspberry Pi.
  • lsusb: Lists USB hardware connected to your Raspberry Pi.
  • UP key: Pressing the UP key will print the last command entered into the command prompt. This is a quick way to repeat previous commands or make corrections to commands.
  • vcgencmd measure_temp: Shows the temperature of the CPU.
  • vcgencmd get_mem arm && vcgencmd get_mem gpu: Shows the memory split between the CPU and GPU.

VNC VIEWER SETUP

  1. Turn your Mac’s wifi off
  2. Select file/new connection
  3. VNC Server: pi11.local (or your unique static IP address IE 192.168.0.200)
  4. NAME: pi11.local (or your unique static IP address IE 192.168.0.200)
  5. Click OK
  6. Click on the graphic that it makes
  7. USER NAME: pi
  8. PASSWORD: pi11
  9. check Remember Password
  10. Click OK
  11. You may turn your Mac’s wifi back on

Loading Externals in PD


ALWAYS DOUBLE CHECK AND MAKE SURE THAT THE PATHS ARE CORRECT. DELETE THE ONES THAT ARE NOT.

Adding/Removing Software



TYPE INSIDE OF THE SEARCH FIELD ON THE TOP LEFT, SELECT APP PACKAGES THAT YOU WANT, AND CLICK “APPLY

Launching Shortcuts

MORE

SSH INTO PI ON MAC:

From your Mac or PC, open terminal and type…

ssh-keygen -R piX.local
ssh piX@piX.local

GPIO: Shutdown Button

Add a single momentary type switch between GRND and GPIO21
In the terminal type

sudo nano /boot/config.txt

dtoverlay=gpio-shutdown,gpio_pin=21

Back-Up Pi SD Card with a Clone

  • Get an SD USB adapter
  • Download SD Card Formatter
  • Format the SD card on Mac with SD Card Formatter application
  • Put SD card into the SD USB adapter and plug it into one of the Pi’s USB inputs
  • On Pi use the Raspberry Pi Menu/Accessories/SD Card Copier
  • Copy from: Pi’s drive
  • Copy to: external SD card
  • Click Start and wait for it to copy
  • Always have a backup of your SD card before you make changes to files that will affect your OS

Set up Pi to Run on Boot

Back up your SD card

Make a folder called “scripts” in the /home/pi directory

In the terminal type: 

sudo nano /home/pi/scripts/launch_app_script

With nano open add the following code:

# This script will start Pd in nogui (without gui) 
# And it will open PD patch, "masterPlayer.pd"  

 echo "Starting Pd..." 
 pd -nogui  /home/pi/patches/masterPlayer.pd &

control/x: to exit
y: to commit changes
enter: to exit nano back to the terminal

Now we need to tell the Pi to launch our script at start-up. To do this, we have to edit a file called “rc.local”. 

Open “rc.local” in the nano editor by typing the following in the terminal:

sudo nano /etc/rc.local

Add the following line after the first comments (comments start with a #) :

. /home/pi/scripts/launch_app_script

control/x: to exit
y: to commit changes
enter: to exit nano back to the terminal

Once you’ve saved that file, you have to make it ‘executable’ by typing the following in the terminal:

sudo chmod 755 /home/pi/scripts/launch_app_script

Now, you should be able to test it by typing the following command into the terminal:

/home/pi/scripts/launch_app_script

On reboot, PD should launch in headless mode (no gui)
If you open the terminal, you will see PD activity.
You may also want to disconnect the Raspian gui completely in your Pi settings. This will take less processing power if you aren’t running Processing or anything else that needs a gui.

RASPI STATIC IP SETUP

https://www.raspberrypi.org/learning/networking-lessons/rpi-static-ip-address/

CONNECTING PD TO PROCESSING

MORE EXAMPLE FILES

LINKS

Accelerometer Tutorial

https://www.realvnc.com/en/connect/download/viewer/

https://learn.sparkfun.com/tutorials/connecting-arduino-to-processing/all

https://www.raspberrypi.orgh

https://www.techrepublic.com/article/everything-you-need-to-know-about-the-raspberry-pi-3-model-b-a-guide-to-the-fastest-pi-yet/

https://www.c-sharpcorner.com/article/anatomy-of-raspberry-pi/

Miller Puckett

https://puredata.info/

http://www.pd-tutorial.com/english/index.html