Posts (page 2)
LISTENING: Masonna 'Frequency L.S.D.'
I can split my own daily listening habits into two categories:
The first is music which I use to augment my daily activities, typically while commuting and working. The second is music I listen to as an end in itself, while doing little or nothing else. There is some overlap between the two, but not much.
If I’m listening to music while commuting or working, it has to be something which, first and foremost, has a strong sense of rhythm which I can nod my head to without having to think very hard. It can be something which evokes pretty much any mood or emotion, thought I find things that somehow evoke more complex emotions (i.e. simultaneous gloom + physical energy, violence + calm, chaos + focus) the most interesting. It has to be something with great attention paid to sonics and atmosphere, whether it be using primarily electronic instruments (i.e. electronica, synthpop, italo disco), primarily acoustic instruments (i.e. exotica, library music), and/or elaborate or adventurous manipulation of non electronic sounds and instruments (i.e. krautrock, underground disco, obscure psych records, 60s girl groups, Joe Meek, ABBA). I have little or no interest in lyrical content nor allegiance to traditional verse-chorus-verse song structure, and extended instrumentals and 15+ minute long tracks are welcomed. Since I typically try not to pay attention to lyrics I’m very open to vocals in languages I can’t comprehend and vocals distorted or vocoded to the point of unintelligibility. In fact, I often prefer them. I want something that propels me forward without requiring my attention (hence singer-songwriter music, folk music, or anything with a heavy focus or lyrical content over sonics are out), but is interesting enough to listen to as an end in itself should it find itself in the foreground of my thoughts (so a lot of techno, house, and trance are out since they seem, to me, to necessitate large social gatherings and/or drug use in order to be enjoyed properly). Typically I find music that fits into my parameters also very good for social gatherings in which my iPod or laptop finds its way to the stereo.
So that’s what I listen to as far as ‘background music’. But sometimes, usually 2 or 3 times a week when I’m at home at night am not going out, I want to just sit there, doing little or nothing else, and listen to the most bizarre, difficult, and/or punishing music I can find. I have found this, by and large, in noise music. Noise music by definition is based around harsh, distortion-heavy sound with very minimal, if any, use of rhythm or melody. Some is improvised, some is very carefully composed, but the objective is always unrelenting sonic assault over traditional musicality. Many of the best works are released vinyl-only in small editions, and the act of looking through my shelving unit for the LP I want, placing it on the turntable, and sitting still and listening for 30+ minutes takes on sort of a ritualistic feeling. The hidden structure of the music and creative voice of the artist reveals itself upon repeated listenings in a way which makes a good noise record a richer and more enjoyable experience upon each listen.
Complete Arduino code here.
I've built all the functionality I want for this semester for the CrudBox (I plan on continuing with it for NIME and likely beyond). Check out the video.
It can now remember 4 different loops. You can see which one you're one on the 7 segment display and scroll to different ones with the rotary encoder knob next to it. The tempo can now be seen on the 4 LEDs in the lower right corner.
To reiterate how it works:
There are 4 speaker terminals on the box, into each of which you can plug any object that can run on 5 volts. In the video I've plugged in LEDs because it makes the interaction clearer, but my main interest is in plugging motors in, attaching them to the box, and amplifying the sounds they make. Each speaker terminal has a button and a pot. Pay attention to which of the 4 tempo LEDs is on, then press a button, then let go. It will switch on the object (motor, LED, etc), then switch it off when you let go. The next time it cycles through the loop of 4 LEDs it will switch on and off at the same points. The object will pulsewidth modulate at different speeds depending on what position the pot is in when you switched it on. You can do this up to 8 times and can change the PWM with each one, then do the same with the 3 other objects.
Whatever number is currently displayed on the 7seg display is the number of the loop you've created. Turn the rotary encoder and the number will change, and you can do what you just did with this new loop. The 7segment display shows numbers 1-4, so you can record 4 different loops.
The code above uses 1 MC14067BCP analog multiplexer for all the switches and knobs for the 4 objects. The rotary encoder and the erase button use digital pins directly on the Arduino. The output is two 74HC595 shift registers in sequence, one for the 7segment display and one for the objects output.
Online version here (right click and hit "Play").
Java code here.
.fla file here.
Currently I only have one of the additions to my midterm project working: my homemade text to speech translator using my own voice. It was fairly straighforward to build and program. Here's how I did it:
1) Obtain a list of every possible phoneme from the Rita getPhonemes() method.
2) Recorded myself saying every one of said phonemes and converting them to mp3s.
3) Do getPhonemes() on a piece of text
4) Read the array given by getPhonemes() into Flash
5) Each phoneme of a word is separated by a dash. Split each word into an array divided by these dashes.
6) Create a function which plays one mp3 at a time, pausing for the duration of the mp3 before moving to the next one.
In this example I used text from Michael Gira's "Why I Ate My Wife". My original idea was to use text from my dreams, but I haven't remembered more than five seconds of any dreams I've had since I presented my final idea 3 weeks ago.
What doesn't work (yet):
I wrote a method which gets all the holoynyms of each word (using getHolonym()), then "crawls" all of those words and looks for their holonyms. This piece of text has a strong focus on the body so I looked for words which would return the word "body" or similar words. From there it would use the Flickr API to find images tagged with that word, then displays them in some form when the word they're related to appears on screen in the Flash movie.
Sadly the methods of RitaWN are giving me a lot of trouble even in very straighforward situations and I get an error about which I've found absolutely no useful documentation online.
For some reason, I could not get many functions in RitaWN to work, even simple ones in simple circumstances, so that and the Flickr API will have to wait.
I made my own 7 segment LED with 21 LEDs and a small piece of perfboard. I had planned on using a normal premade 7 seg display, but I fried 2 of the 3 I bought trying to use them with a 16 channel LED driver chip and a darlington array (i gave them too much power and some of the segments burnt out), and I couldn't find the third one, and in a rush to accomplish something I ended up building this. It took a few very focused hours of soldering. I really dig the look, definitely something of a happy accident.
Since I don't have enough digital outs left on my Arduino for a 7 segment LED driver chip I had to control it through my chain of shift registers. I had to manually write an array for which shift register pins to switch on and off for digits 0 through 9. Here it is:
int digitArray[] = {//zero
1,1,1,1,0,1,1,
//one
0,0,1,1,0,0,0,
//two
0,1,1,0,1,1,1,
//three
0,1,1,1,1,1,0,
//four
1,0,1,1,1,0,0,
//five
1,1,0,1,1,1,0,
//six
1,1,0,1,1,1,1,
//seven
0,1,1,1,0,0,0,
//eight
1,1,1,1,1,1,1,
//nine
1,1,1,1,1,1,0
};
And here's two examples of it in action. The top video shows it counting 1... 2... 3... 4... with the tempo of the loop. The bottom video shows it moving from 0 to 9 as I turn the shift register.
Arduino code here.
Processing code here.
For this assignment I added some simple filtering to my homemade color sensor code. I added a button which you press when there is no object on top of the color sensor, and it records the color values and will stop spitting out color values serially if the red, green, and blue values are all within 10 of the value recorded when the button was pressed. So basically once you do this, if nothing is on top of the sensor it will stop sending values until you do put something on it. It works well, exactly as described, but of course it could create problems if you're testing an object that actually is that color! Being that I'm still not sure what people would use a homemade color sensor for besides various zany interactive art things I'm not sure if that's a problem.
The one project I'm planning on using this sensor for is an installation in a large room in which I'm going to mount a bunch of them all over the walls of a large empty room. I'm going to hand out flashlights of various colors and allow people to control sounds by pointing the flashlights at the sensors all over the room. For this project the filter should be useful, since I don't want any sounds happening if there isn't a bright light being pointed directly at the sensor.
DIY Color Sensor Using RGB LEDs and Photo Cell
From the beginning I of the semester I decided I would do my Sensor Report on either a color sensor or some kind of homemade sensor which had not yet been well documented. I ultimately ended up doing both.
I've had plans for a project involving color sensors since Winter Break, when some friends told me I should do a big interactive art piece using their entire loft space. I've done some other projects using flashlights and Cadmium Sulfide cells to control sound, and wanting to go further with this idea I figured an interesting way to add to it would be to control sound not only using light, but using the color of the lights for added variety (I imagine handing out flashlights with various colored gels on them. Yesterday someone suggested I somehow mount the flashlights on people's heads. Ha!). I didn't manage to work this into any of my classes so I'm planning on working on it over the Summer. I'll be sure to document the whole process on my blog.
I looked online and found some small amount of info on using RGB LEDs and photo cells, but all were written by people with significant tech know-how, and there was nothing which layed it out really thoroughly for people like us who want to be able to just plug everything in and copy some Arduino/Processing code and have a functioning sensor ready to go. So here it is.
Parts:
What you'll need:
1) 1 Adequately bright RGB LED, or adeuqately bright individual red, green, and blue LEDs
If the LEDs are not bright enough they will not reflect enough colored light off the sensed object and you won't get good values. Whereas the RGB LEDs Sparkfun sells are bright enough to work, the RGB LEDs I got from China on eBay are not more than half the brightness of the Sparkfun ones and don't work so well. The Sparkfun ones have luminosities of 800 mcd (millicandelas, which are I believe thousandths of a footcandle) for the red, 4000 mcd for the green, and 900 for the blue, so its safe to say anything at or over 800mcds will give you a good reading.
2) 1 Photocell
Obviously the stronger the photocell the better because it will give you a broader range of values.
3) 3 Switches or buttons
These aren't actually necessary but I used 2 buttons and 1 toggle switch. The buttons are for setting the white balance and black balance (more on that in a bit) and the switch is just to tell Arduino to run the color sensing function.
4) A piece of black foam
For black balancing
5) A piece of white paper of foam board
For white balancing
6) An Arduino
7) Some resistors and wires
8) A small black box with a hole in it
Not absolutely necessary, but you'll get better results from the sensor if you block out ambient light with a black box.
Putting it together:
1) Plug your photocell and RGB LED into your breadboard right next to each other so the tops of both are about vertically aligned.
2) Wrap the circumfrence of the photo cell in black electrical tape so that it reaches a little bit above the top of the photo cell so that it will block direct light coming from the LEDs.
3) Plug everything into the appropriate pins in Arduino. Photo cell into analog pin 2. Red, green, and blue pins of the LED into digital 4, 5, and 6. White and black balance into digital 2 and 3, and sensor on/off switch into pin 7. Remember your resisitors to ground for the photo cell and the switches!!
Programming Arduino and Processing:
Arduino code here
Processing data visualization code here
How it works:
Both the idea and the implementation are pretty simple. The idea is that when an LED of one color is switched on, an object placed in front of it will reflect back some amount of that color based on how much of that color the object contains. Thus by pointing a photo cell at this reflected light you can measure how much of that color the object has. Do this 3 times with red, green, and blue light and in theory you should be able to put the values together to get a color close to that of the object you're sensing.
But first....
White and Black Balancing and Normalizing the Values:
Before we start sensing we're going to need to find out what the minimum and maximum values we get from the photo cell when each LED is on so that we can normalize all of them. I built some code into the Arduino program to do this, and this is why we need buttons for setting white and black balancing as mentioned before. In the code it takes whatever the minimum and maximum are from each and makes it so any values between them will go from 0 to 255, making it as easy as possible to visualize the data in Processing.
To do this:
1) Hold your white piece of paper or foam board about an inch above the photo cell and LED, being sure its completely covering both of them.
2) Hit the White Balance button. The red, green, and blue LEDs should quickly blink one after another. When this happens the values have been recorded. These are the maximum values the photo cell can reach for each color, because nothing can reflect more red, green, and blue light than something pure white.
3) Do the same thing with the Black Balance button and the piece of black foam. This gives us our lowest possible values.
Color Sensing:
Stick the black box on top of the color sensor. Open the Processing app and set the white and black balance as described above. If it isn't already on, switch on the Sensing switch. Values should start coming into the Processing app. Put an object about an inch above the photo cell so the light from the LEDs hit it. See what values you get!
The sensor works best with objects which are NOT shiny. Foam and cloth work the best.
Right now it's far from perfect, but if you put a red, green, or blue object in front of it it will return roughly that color. Colors which are an RGB mixture are not incredibly accurate.
Uses:
1) Mobile appliances and consumer electronics
Automatic light adjustment for cell phones, displays, and such.
Code here.
I'm pretty set on using the DosOnChip as a nonvolatile storage device for my Phys Comp Studio project so I decided to use this as an opportunity to learn how to use it. I started off using Tom Igoe's DosOnChip Processing Terminal app to get comfortable with the commands before I started running it from Arduino. The code Tom provided doesn't quite explain the commands, and the User Guide is a bit cryptic, so I had to play around with it before I fully understood how to write to and read from it (no one else on the floor, or anyone I could find on the internet, seemed to fully understand it either). Here's what I gather about how it works so far:
Getting it ready to receive your commands:
You begin communication by sending 2 carriage returns (written as \r in Arduino) as bytes. As with any successful communication with it will return a byte of the greater than character >. This is it's way of telling you its ready for you to tell it to do something. After this I like to send it a q followed by /r, which quits out of any files which may be already be open. Having files open when you get started can cause problems but I'll get into that later.
Writing data to it from Arduino:
You start out by creating a new text file, or opening an existing text file.
After you receive your > byte, send it a string of ow followed by the name of the text file. If you give it the name of a text file which is on there, it will automatically create it for you. For example, send it
ow DATA1.TXT
and it will open that text file or create a new text file of that name.
It should return
1
which is now the "handle" (remember that word) for writing to DATA1.TXT for now. Once you've opened a file for reading or writing, you will tell the DosOnChip to read or write to it using it's handle, not the name of the text file.
Once we've done this, we can write to the text file with a string like this:
w #1 1
So to write bytes to a file you send it w, then the handle of the text file you want to write to (always with the pound sign in from of it), followed by the number of bytes you want to send it. Once you do this it will return a quotation mark
"
to tell you it's ready for your bytes. In the example above we tell it to get ready for 4 bytes, so we send it something like
asdf
and it returns
"
>
A close quote " to show it took what we sent it, and a fresh > to tell us it's ready for more commands.
Take the MicroSD card out and get a card reader and you should see a text file on it with the bytes you just wrote in it. Savor this moment.
You can keep using these same commands over and over and every time it will write the bytes to the end of your text file.
When I started working with it no one on the floor had had any luck getting it to work consistently. I had no idea where to even begin so I had Jeff send me his almost working code. I tested it out and it created a file and wrote to it the first time I used it, then never worked again. I emailed Jeff and told him this and he had the exact same problem. He also told me the problem might have something to do with the delay time between sending and receiving bytes, so my first impulse was to make the delays much longer. I tried using 1 second delays between every string or byte sent or received and magically everything worked! I still haven't determined what the minimum delay is, but it seems that a better way to go than cutting down the delay time until it stops working is to write code so that it can only send to the DosOnChop after its gotten the appropriate > go ahead from it.