CC Lab Final | OpenFrameworks Concept

openframeworks-2

OpenFrameworks Final Musings

And how I should actually plug things in before thinking they don’t work…

So the final unit of CC Lab comes to a close, OpenFrameworks. At first, I was kind of “eh” about C++ and OF, but as the last few weeks progressed and I took some tutorials and started to do really cool things and combine them together for even cooler things, my attitude has changed.  I really am enjoying my time with OpenFrameworks and have a billion ideas of fun side projects I want to try in the future.

At first, I thought it would be fun to play with a Kinect – I mean, who in MFADT doesn’t? However, after picking up a used Kinect from GameStop and watching the setup tutorials, I just couldn’t get it to load up.  In hindsight, I think I may have made a VERY stupid error… I noticed on D12 yesterday that my friend had theirs plugged in both to the wall and the USB drive on the computer.  I only plugged into USB drive since light went on and it seemed to be on/I thought it was USB or plug…  Ooopsss…

Either way, I returned the Kinect to GameStop on Sunday and asked to be sent a guaranteed refurbished model, to avoid any issues with firmware updates on used models.  It will be coming at the end of the week and after finals are all over -ahhhhhhhhhhh – I will have some fun with it. I keep seeing cool things for lightsaber casts to poles… I ❤ swords. Just saying.

Final Concept

So after the Kinect debacle, I realized that that idea was off the table.  No big deal. I had wanted to take my last homework project, featuring semi-interactive balls that were reactive to sound, and make it really interactive using a Kinect.  How else could I do this?  Luckily, while trolling for add-ons I found a great tutorial on how to hook up your Wii remote and Nunchuk to OpenFrameworks using ofxOSC and it is super super easy to do (doesn’t even require Wifi I realized!)

After playing with their example for awhile, I hooked it up a little bit to my old HW project just to see if it would work, and Ouila! It did – a little.

I trolled around the web for some more ideas, and found a couple of really cool videos done with the Wii Remote – though no code examples. Whatever though, just need an example for whatever the thing is – particle, box2d etc. and I can hopefully hack the Wii remote connectivity into it. It seems like it should be pretty easy since all the Wii remote features pass to float and boolean variables which can then be put into anything I want…

Particles+physics+wiimote from David Penuela on Vimeo.

So, for my final concept I am going to re-create my old HW project but make it 1000x cooler. First of all, I’m going to have a music video streaming in the background instead of just a picture. My idea for how this could be used is in a dance club where they can use the Wii remote to play with the visuals while DJing.  I will then have shapes on the screen that are both reactive to the sound (pulsing), using a gradient (ofxGradient add-on), controllable by the Wii Remote (ofxOSC addon) with values and their manipulations shown on the screen (ofxGUI addon).

Overall I will be using three add-ons, one from the internet – ofxOSC, ofxGUI, and ofxGradient. I will also be connecting my Wii to the computer using a program OSCulator – which also does cool things with Midi. Finally, I will be using pulling sound frequencies to control motion on the screen as well. At the end of the day, a user should be able to use both the Wii Remote and the Wii Nunchuk to control the user-interface from as far away as 20 feet.

Code

Here is a snippet of code for updating the Wii Remote connection in the .app file and controlling the sound/video using device. I am starting from scratch on interactions since I want to take advantage of the variety of orientation data from both Wii remote and Nunchuk, the Nunchuk joystick, and all buttons on each item. For now just have the music/video loading and volume control.

//MARK - Update Wii OSC - Get the Devices
    //Wii Remote Updating
    // check for waiting messages
    while( receiver.hasWaitingMessages() )
    if(w == 0 || h == 0){
            w = ofGetWidth();
            h = ofGetHeight(); }
    // get the next message
        ofxOscMessage m;
        float x,y;
        receiver.getNextMessage( &m )
   //Nunchuk Joystick
        if ( m.getAddress() == "/wii/2/nunchuk/joy/0" )
        x = m.getArgAsFloat( 0 );
            wiiX = x * w;
            cout << "x: " << wiiX << " y: " << wiiY << "\n"}
        else if ( m.getAddress() == "/wii/2/nunchuk/joy/1" )
     y = 1 - m.getArgAsFloat( 0 );
            wiiY = y * h;
            cout << "x: " << wiiX << " y: " << wiiY << "\n"}
    //Nunchuk Buttons
        else if (m.getAddress() == "/wii/2/nunchuk/button/C") {
            nunchukCButton = m.getArgAsBool(false); }        
        else if (m.getAddress() == "/wii/2/nunchuk/button/Z") {
            nunchukZbutton = m.getArgAsBool(false); }
   //Nunchuk Orientation
        else if (m.getAddress() == "/wii/2/nunchuk/accel/pry/0") {
             nunchukRoll = m.getArgAsFloat(0); }
        else if (m.getAddress() == "/wii/2/nunchuk/accel/pry/1") {
            nunchukYaw = m.getArgAsFloat(0); }
        else if (m.getAddress() == "/wii/2/nunchuk/accel/pry/2") {
            nunchukPitch = m.getArgAsFloat(0); }       
        else if (m.getAddress() == "/wii/2/nunchuk/accel/pry/3") {
            nunchukAccel = m.getArgAsFloat(0); }
      
   //Use Wii to Play Music & Video
        if (nunchukButtonC == true) {
            bigBang.play();
            bigBangVid.play();
        } else if (nunchukZButton == true) {
            bigBang.stop();
             bigBangVid.stop(); }
        //Use Plus and Minus to Control Volume
        if (buttonPlus == true) {
            volume = volume + .001f;
        } else if (buttonMinus == true) {
            volume = volume - .001f;
       ] }

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s