Monday, April 20, 2015

Rosella's Modern Life

 

These are some storyline sketches. This project will be story-based and "constructed." The things I will be lowering into Rosella's aquarium will be generic because I want the narrative to shape the interaction. The crux of the piece is that while all it really is is a fishtank with a snail inside, we're inclined to assign value and sentiment to Rosella and the things we drop into the tank.

Speaking of dropping things into a tank, I was able to use a continuous servo to drop an item in:


Since the screen will be the peoples' main interface, I want to do the project in Max. Maxuino fits my needs perfectly, since all the Arduino is doing in this project is lowering and raising objects. As shown in the video, all I need are some timed bangs on float boxes to get them spinning equivalent distances. That's also as fast as I could make the servos spin, but that's not a complaint. Don't want to crush Rosella.

Two buttons will be the primary mode of interaction, with each button deciding what Rosella "does" in her life. I want it to be similar to the King's Quest series, or maybe more true to the concept, Peasant's Quest by HomeStarRunner. The narrative will be completely ridiculous.
  • Rosella goes to the mall.
  • She (you) decides to fill out one of those "win a boat" sweepstakes forms you see all the time
  • She miraculously wins the sweepstakes two weeks later but the company fulfills the sweepstakes has since been foreclosed
  • As a "consolation prize," they give her the (now ex-) CEO's firstborn child, Frank
    • A generic snail toy model is lowered into the tank
  • Rosella goes about her business, encountering other events
  • 5 real minutes later, Frank runs away, leaving a note that says he left to "find his passion in above-water basket weaving"
    • The snail model is raised back up
Moving forward I would like to create a structure out of wood that holds servos securely and is able to securely sit on the top of the fishtank. I see laser cutting in my immediate future.

Sunday, April 19, 2015

This post is half project update, half rant about the Xbox Kinect/Windows Kinect, and the incredible struggle it has been to get the Kinect to "connect" buh dum chee!

It's now been about two weeks of wrestling with these products to talk to my computer. Basically, I tried EVERYTHING! I struggled to get them working on Mac, but had huge problems with out of date software and drivers. A basic summary: Two versions of Open NI: Simple Open NI and Open NI 2.0. After Open NI 2.0 was made the project was shut down, and this was several years ago. Since many new products have come out since, a lot of the tutorials have unanswered recent questions on how to get these new hardware devices to work with old software and old sample code. Also, almost everything you will find online about this is an unorganized mess!! It's scattered around by users instead of put out by the developers. Windows makes the Kinect and Windows or Mac do not really seem to want to make it work easily on a Mac. Fine, I get that. So I downloaded the Bootcamp Windows 8 Partition on my computer. That resulted in a whole slew of other problems, with drivers not working at first, internet not connecting as a result, blah blah blah, got that worked out eventually.

Got everything going and didn't have enough space to install the software. Moral of the story I learned- DO NOT give Bootcamp the minimum amount of space required for installation, cause then it's useless if you want to do anything on it. Reinstalled Bootcamp with more space. Okay! Should work now! NOPE.

I already hated Microsoft a bit, since memories of my insanely slow and old Dell computer at home are pretty much all I associate with the company. But the uninformative website, complete lack of helpful information in error messages, and totally incompetent help phone line has taken my burning hate for Microsoft to a whole new level. I digress, basically, if you have the newest version of the Kinect for Windows (2.0!! NOT IN THE TITLE! THEY DIDN'T NAME TWO VERSIONS DIFFERENTLY!) then, I would assume, if you download the software for the updated SDK 2.0 on the Kinect for Windows website, you will have it working perfect in no time. However, there is an older model of the Kinect for Windows, with a different model number, that is super easy to differentiate because it looks different, and yet there is no place to "click here if your Kinect for Windows looks like this and download the OLDER SDK drivers." Anyways, rant over, that was the solution. The older SDK drivers got the Kinect to connect! Still only running samples, have to figure out how to get the sample code into a compiler that I can pick up and run with for my project. Also still having issues getting Touch Designer working, I have the NIVIDIA graphics card you need, but it seems mine may be a different model. Overall, finally made some progress. Final thoughts: Mac needs to come out with an alternative to the Kinect or better integration! Windows is the worst, forever and always.

TL;DR
I hate Microsoft. Finally got the Kinect to be seen by the computer though.

Thursday, April 16, 2015

ESP Levitation (actually just a webcam and a fan)

For my project I decided to do an interactive alternative to Erwin Redl's "Ascension (thirty-one)"  using a pretty similar mechanism, a ball in a tube being levitated by a fan. The video above is me playing with the prototype, made with acrylic tubing, a squirrel cage fan (from sparkfun), plywood, a ping pong ball, a mosfet, an arduino and a webcam. Imagine its like the worlds fair or something, and stay tuned for the upscaled (not janky) version!

Sunday, March 15, 2015

Explaining the witchcraft behind the Time Organ

I had originally planned on writing about the physical process of creating my Time Organ, but looking now at how things turned out, I think discussing the software behind it will be more interesting. (As far as the physical device, I'd say the most important takeaway is that these Rock Band Keyboards are fantastically cheap, have 25 keys w/ velocity, a touch sensor strip, a MIDI out port, and a ton of room inside for sensors and wires and junk, so you should all buy one to mess around with.)

First off: the code is all here on github for anyone curious – I tried my best to keep things well organized, although the commenting can be sparse in places. The majority of the logic is in Max (plus some amounts of arduino and javascript code), with the functionality split up into several main patchers, embedded in bpatchers here in main.maxpat:


The core features to think about are:
  • A custom granular synth engine that 
    • can draw grains from live recordings as well as pre-recorded samples
    • reacts in real-time to parameter changes
    • uses a Hanning window to smooth in and out of grains
    • operates on the scale of milliseconds, rather than microseconds like many other gran-synth setups
  • The gran-synth output is then piped through a poly~ object and pitch-shifted based on MIDI key input, so the sound can be played polyphonically.
  • The pattrstorage object is used (even though it crashes Max every time) to save presets of buffer contents, grain windows, and other parameters, which can then be recalled by button presses from the arduino.
  • A stutter~ object is constantly recording the last 5 seconds of audio from channel 2, and when the "freeze" button is pressed, that buffer is copied to the gran-synth engine's buffer.
  • The patch actually doesn't require the physical device to mess around with – try flipping the toggle on near that lower keyboard, and fiddling with the keys and some other controls to see what happens.
I'll start by talking about the granular synth stuff. The patches in my actual project have gotten pretty complex for the sake of supporting things like stereo, bypassing certain effects, and loading default values, but the core concepts are pretty intuitive. Here are simplified versions of the patch "granvolution" and the patch "polygrain" inside of it, which is loaded inside the poly~ object:
So there are really just 3 main things going on: The polygrain~ patch plays the grain when it gets a bang, multiplies the output by the hanning window generated by the fadecurve patch I wrote (the details of which aren't very important – just think of it as a smoother adsr~), and then outside the poly~, the whole repeated stream of sounds gets multiplied by the average amplitude from my other mic to allow breath control of volume.

Then the "tailfx" patch you see at the end there handles the pitch shifting, compression, and reverb:

(The pitchshift, reverb, and compress patches are all other custom ones, but they do pretty much what you'd expect, so no need to dive into that.) 

The last main piece, but probably the one most relevant to other people in this class, is the patch inside controller.maxpat, called arduino-buttons.maxpat:
This uses Max's javascript support for parsing and sending serial data, which I think is a great choice for those who like to maintain their sanity, since Max doesn't technically even have the concept of a string type. I'll let anyone curious check out the scripts themselves on github, but the main idea is this: messages are sent using readable ASCII characters, instead of binary data (avoids the need for bitwise operations), and each message sent uses a single character at the beginning as an identifier (b for button, p for potentiometer, r for reverb, etc.) followed by some more characters encoding the data it wants to communicate. Something like "s 1 0" from the arduino to Max means that switch 1 was turned off. Or "r 65" from Max to arduino means that I set reverb to 65%, so it should print that to the LCD screen so the performer has that feedback.

parseSerial.js has a few functions named after these identifiers (b(), p(), s(), etc) which are automatically called when the object receives a message starting with that symbol. Then it cleans up the data and sends it out the outlets in a Max-friendly way. toSerial.js basically does the opposite, but in a much more general way – it will turn any list of characters into a list of bytes, perfect for sending to the serial object. Feel free to use these ideas or the code itself in your projects to make communicating over serial in Max a little easier!




Thursday, March 12, 2015

Powering LED

I wanted to use addressable LED strip for probably more than a year now and I finally got the chance to use it!  I was always afraid that it was complicating to use, but it was surprisingly not that difficult.

Here is a brief steps that I took to power the strip.  If you want to know more about the specific details, please feel free to ask me.

I bought the strips from Sparkfun (SPARKFUN LED STRIP) last semester for 451 project even though I didn't get the chance to actually incorporate it in the game.  The hookup guide that can be found in that link was VERY useful and straightforward.  Once I got power, it didn't take too long until I figured out how to control the lighting using sensors; programming on Arduino was pretty straightforward.

It was powering that confused me.  I completely underestimated how much current each strip eats up.
^So, I ended up using this power supply. JamecoPowerSupply

First thing I did as soon as I got it was to find an AC cable and then stripping it up to obtain three cables inside (as shown in the photo above).  Spade terminal is used to connect things.


^Double row terminal blocks were used (one for ground and the other for vcc)  

^Overall picture of how everything is setup


Can multiple addressable LED strips be controlled using only one Arduino code?  YES!
I just used two different PWM pins and made a second LED strip class within the code.  Controlling it with a sensor wasn't that bad either!

Can't wait to use it more in the future.








Friday, March 6, 2015

Connecting Things Together

Here is a blog post about how I'm connecting things together (and it worked!)

Because I will have each pipe and Arduino separate by few feet, I needed a way to have all the wirings minimal and clean.    


After consulting with Professor Gurevich, I decided to use an ethernet cable to connect the sensors and LED strips on each pipe to the Arduino.  
If I didn't use an ethernet cable, I would have total of 9 wires coming from each pipe.  Since I have 4 pipes total, there would be 36 wires!  Instead of 36 wires, I only have 4 ethernet cables total.  Clean is good...



^This is what's on bottom of every pipe.  Speaker terminal and ethernet cable terminal.



^I soldered the ethernet terminal and some male hdr pins onto a perf board.  All the wires from the sensors and LED are connected here.


                                                                  ^On Arduino's side


 All the sensor datas are sent to Arduino with no problem.  It was definitely worth it!


Thursday, March 5, 2015

Updated string accordion proof of concept


I should've had this done last week... ah well. It doesn't help that I was sick all spring break until just today! I'm just catching up now.

Just getting to this point took considerable effort even with everything built and coded. A few uncooperative connections made for several hours of work today.

A new instrument housing is more necessary than I thought. The parts simply need to fit together better for this to work properly and with any hope of durability. Enclosure 1.0.2 is on the docket for tomorrow (altered lasercut file and then a walk across the street to the woodshop).