Here’s the p5/arduino example
Author: Jet Townsend
Class notes, 17 Nov 2020
Interactive jacket project from Baskinger’s Experimental Form class.
Look at the 2019 Final Crit for some good examples on elevator pitches and proposals.
Next Tuesday, 24 Nov, is the last day you can use A10. We’ll make that a work day. Thursday, 26 Nov, no class due to turkey day.
For Thursday, have a proposal posted to the blog’s Final Crit category.
Class notes, 12 Nov 2020
p5.js / arduino
Configure/test p5.js not required for final crit but lets make sure you can use it if you decide to. The NYU ITP instructions are a good guide. Do not use the online p5.js web editor, use local files and a local browser and text editor.
Final Crit
Start thinking about the final crit. We only have one more day to access A10, 24 Nov, and you should have your wish lists ready
For the final crit combine visual, sound, and kinetics with a state machine and sensors to make something more accessible, usable, or uses universal design.
Here’s a rough schedule. On some of the work days I will do a brief lecture based on questions or inspirational projects done in other physical computing projects. The remainder of this time is making up for my not having open-office hours in A10.
- 17 Nov — workshop proposals
- 19 Nov — work day
- 24 Nov — last day in A10
- 26 Nov — vacation
- 1 Dec — work day
- 3 Dec — crit test flight
- 8 Dec — work day
- 10 Dec — final crit
Assignment for Tuesday
Crit warmup: come up with a problem to solve. No need to write code (unless you want to), just a statement of the problem and your solution.
We will discuss these on Tuesday and brainstorm improvements.
Viewing assignment
These are based on the idea of how you can hide/obfuscate the man behind the curtain.
Former FBI Agent Explains How to Read Body Language
Former CIA Operative In Charge of Disguise Explains How Spies Use Disguises (except for the model with a sleeve)
…and debunks spies and disguises in entertainment:
quick reading assignment for 12 Nov
Chapters 11 and 12
Using a transducer to make my desktop a speaker
Pretty simple circuit that makes a lot of noise.
PDF of the sketch arduino-transistor-speaker
Sound Crit
Generate sounds related to an environment that make the environment easier to use for people who might have issue with collecting data via sight or physical capabilities. This includes data they might not be able to perceive, say “how many people are in the elevator coming to my floor?” or “when will my bus arrive at my bus stop?”
Universal design and accessibility are good starting places. I work with a lot of heat when I’m in the studio, welding metal or working with glass. As we usually say (rather loudly) while going to the first-aid box, “hot metal looks just like cold metal” or “hot glass looks just like cold glass”. I have temperature probes but they require me using both hands while looking at a screen. How can I get an audible warning that I’m about to touch something dangerously hot?
Class notes, 29 October, 2020
Non-instrument sounds used in music
M.I.A: https://www.youtube.com/watch?v=ewRjZoRtu0Y
Kraftwerk:
Tour de France, use of bicycle/human sounds as part of a song: https://www.youtube.com/watch?v=rTe7U92ecX8
Autobahn, which I talked about but we didn’t listen: https://www.youtube.com/watch?v=1DO-Ddqbqgs
Art of Noise is another band that used sampling to bring non-instrument noises to music:
Another song using the orchestral hit, Close (To the Edit): https://www.youtube.com/watch?v=-sFK0-lcjGU
German industrial band Einstürzende Neubauten uses found objects for percussion and background tambre: https://www.youtube.com/watch?v=KrfOahWNT_A
Cultural conflation
M.I.A. has western/asian drifter culture as part of a video shot in Morrocco in support of a movement to let women legally drive cars. https://www.youtube.com/watch?v=3Yuqxl284cg
Environmental sound
why is this machine so quiet?
what is all the computation happening in this machine?
how is this different from a Trader Joe’s microwave-meal-box?
Colorblind simulator
Maria asked a question about how to express color as sound. One place to start this sort of research is a colorblind simulator: https://www.color-blindness.com/coblis-color-blindness-simulator
Mini-assignment 9
What sounds would you add to your house to make it more accessible?
Some examples
- your thermostat plays a song right before turning on the heat or air conditioning so you know you’ll need to turn up the volume on the TV.
- the songs my water boiler, rice cooker, and clothes washer play when they are ready/done
- a song my clothes dryer plays when the cycle is finished
- weather forecast sounds using rain and thunder, but what about a sunny day or a day with snow?
Class notes, 27 Sep 2020
Genre conflation
This is a counter to sampling and using electronics to invent new music. Instruments from one style of music are used to perform a style of music from a completely unrelated genre. My favorite examples are “pirate metal” or the band Orkestra Obsolete playing famous pop music.
We’re skipping a lot of contemporary genres — things like EDM, IDM, dub, liquid trap, and future soul. There’s an entire class in this topic, but if you want to go on a genre-binge-fest then Ishkur’s Guide is one place to start: http://music.ishkur.com/
Physical interaction options
How to hide things in plain sight: https://www.youtube.com/watch?v=T61-twuvJA4
Bill Shannon, PGH native, who defies disability with dance performance:
and his tutorial on a dance form he developed:
Ways of making sound
Some examples of different ways people create sound
Foley artists creating the sounds of weather.
The Arduino guide to handling debounce on switches.
A mapping of western scale notes to frequencies.
The Sound Noise Device that uses cameras to create animation and sound.
It’s easy to create sounds without speakers:
- music made with steppers
- A “top ten” list of arduino music projects
- historical tube doorbells and someone what lost their mind
Using things you already have at home
There’s a Japanese TV show for kids, “Pythagora Switch“, that features Rube-Goldberg like devices made with stuff you’d find around the house. These are so popular with adults that people go a little over the top making/recording their own devices still using common items.
Arduino data collection/processing tips
how to debounce a switch: https://www.arduino.cc/en/Tutorial/Debounce
standard deviations, arrays, and monitoring a variable source. flattening data with mean / median.
// -*-c++-*- /* The MIT License (MIT) Copyright (c) 2019 Jet Townsend Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* basic stats with analogRead() intputs A0 pot output D2 Speaker D13 LED 40 NEOPIXEL */ #include <Adafruit_NeoPixel.h> #ifdef __AVR__ #include <avr/power.h> #endif #define PIN 44 #define NUMPIXELS 1 Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRBW + NEO_KHZ800); static int plotter = 1; static int console = !plotter; static const int inPot = A0; unsigned int potValue; static const int sampleSize = 16; int readings[sampleSize]; unsigned int sampleIndex = 0; unsigned long lastSampleTime = 0; unsigned long sampleInterval = 100; // in ms // we need to move these out of the loop() as well unsigned int median = 0; unsigned int low = 1024; unsigned int high = 0; unsigned int mean = 0; static const int statusLed = 13; unsigned int lastRedVal = 0; unsigned int analogMax = 1023; void setup() { //analogWriteResolution(10); // Set analog out resolution to max, 10-bits analogReadResolution(12); // and read at 12 bits analogMax = 1023 * 4; Serial.begin(115200); pinMode(inPot, INPUT); pinMode(statusLed, OUTPUT); pixels.begin(); // This initializes the NeoPixel library. } void loop() { // TODO what happens if you try to set a negative color? unsigned int redVal = 0; // TODO // don't read the input on every loop to help stabilize the data // sampling over time is also a UI change, you have to actively // block light for // sampleSize * sampleInterval milliseconds to create a change unsigned long now = millis(); if (lastSampleTime + sampleInterval < now) { lastSampleTime = now; potValue = analogRead(inPot); // good for debugging: // Serial.print(now); // Serial.print(" "); // Serial.println(potValue); readings[sampleIndex] = potValue; sampleIndex < (sampleSize - 1) ? sampleIndex++ : sampleIndex = 0; digitalWrite(inPot, HIGH); for (int i = 0; i < sampleSize; i++) { mean += readings[i]; if (readings[i] < low) { low = readings[i]; } if (readings[i] > high) { high = readings[i]; } } mean = mean / sampleSize; bubbleSort(); median = readings[sampleSize / 2]; } // set the pixels with different values, mean, median, current read // long map(long x, long in_min, long in_max, long out_min, long out_max) // in A10, the value of 600 was the bottom end // TODO use a flashlight to break this, more light == lower number // than 600 redVal = map(median, 5, analogMax, 0, 255); // at home, 950 was the bottom end. Remember that higher value == less light // how do we dynamically set the bottom end of the map? // redVal = map(median, 950, analogMax, 0, 255); // what about changing the max value of redVal so we have a dimmer range? // redVal = map(median, 600, analogMax, 0, 128); // TODO keep the pixel from blinking /* // simple, but allows for some blinking if (redVal != lastRedVal) { pixels.setPixelColor(0, pixels.Color(redVal,0,0)); pixels.show(); // This sends the updated pixel color to the hardware. lastRedVal = redVal; } */ // use a tolerance to limit to a range // by making this not a const we can change it in the code // as needed int tolerance = 5; // This looks like it should work, right? // what happens if lastRedVal is 0? if ( (redVal > (lastRedVal + tolerance)) || (redVal < (lastRedVal - tolerance)) ) { pixels.setPixelColor(0, pixels.Color(redVal, 0, 0)); pixels.show(); // This sends the updated pixel color to the hardware. lastRedVal = redVal; } // console if (console) { Serial.print("reading "); Serial.print(potValue); Serial.print(" low "); Serial.print(low); Serial.print(" high "); Serial.print(high); Serial.print(" mean "); Serial.println(mean); Serial.print(" median "); Serial.print(median); Serial.print(","); Serial.print(" redVal "); Serial.println(redVal); delay(100); digitalWrite(inPot, LOW); delay(100); } else if (plotter) { // plotter Serial.print(low); Serial.print(","); Serial.print(high); Serial.print(","); Serial.print(mean); Serial.print(","); Serial.print(median); Serial.print(","); Serial.println(redVal); } } // tigoe's sort for an array void bubbleSort() { int out, in, swapper; for (out = 0 ; out < sampleSize; out++) { // outer loop for (in = out; in < (sampleSize - 1); in++) { // inner loop if ( readings[in] > readings[in + 1] ) { // out of order? // swap them: swapper = readings[in]; readings [in] = readings[in + 1]; readings[in + 1] = swapper; } } } }
Assignment 9: Make sounds with an Arduino
For this assignment, using an Arduino, generate sound-over-time and sound-by-interrupt that conveys meaning, feeling, or specific content. You can generate sound with a speaker or a kinetic device (ex: door chime) or some other novel invention.
This is a good time to use push buttons or other inputs to trigger sound and another input to define the type of sound.
This is also where interrupts are very useful.
My example in class was how my phone *doesn’t* use interrupts well. If I am listening to music and someone rings my doorbell at home, my phone continues to play music *and* the doorbell notification app at the same time. If I need to talk to the person ringing the bell, their voice is mixed in 50/50 with the music I’m listening too.
What the app should do is stop the music, play the notification, then give me the opportunity to talk to the person at the door, then continue playing music.