May 27, 2008
Here is what I did during the Mobil/and workshop
You can find more information about the workshop here: http://www.mobil-and.fr/
Here is what I did during the Mobil/and workshop
You can find more information about the workshop here: http://www.mobil-and.fr/
Next week, I will be taking part in the Mobil/And workshop in ESADSE in Saint-Etienne, France. I was planning content for my speak during the workshop and came up with a rather cheap and robust way of using SMS text messages in Quartz Composer.
Previously, I had been able to come up with a hack that involved BluePhoneElite, AppleScript and iTunes to send SMS to Quartz Composer. I used this for example in the FF>> Media Festival last fall, but it was really awkward solution and you could only have the information of the latest message. So, I had to think of some better way.
This time around, I’m using the excellent Cocoa UltraSMS to send my SMS messages to a MySQL database. Then I’m using a small php-script to convert the database into an XML file which can be easily read and manipulated in Quartz Composer. Here’s how you do it:
WHAT DO YOU NEED
1st STEP – Create the Database
Ok, let’s start. First of all, you need to create an empty MySQL database. For the purpose of this tutorial, I’m going to call my database sms_database.
2nd STEP – Cocoa UltraSMS
Then you need to download and install Cocoa UltraSMS. Setup your phone to connect with it and also insert the information of your database to the fields. Your settings will be different, of course.
After you click OK Cocoa UltraSMS will ask you if you want to create tables for your database. Click OK and and after that hit Start to connect to your phone. Now you can test the connection by sending yourself an SMS. The SMS In counter should increase and if you have Growl enabled you should also see the message in the Growl window.
3rd STEP – PHP lovin’
Now we need to somehow convert the information in the database to an XML file. I’m really far from being a PHP expert, but even I was able to do this, so if you have even a little bit of experience in PHP this shouldn’t be too hard. I used this tutorial to help me.
Here is the PHP code that you will need to upload to your server in order to make this work.
EDIT: As it seems to be almost impossible to paste any working code on WordPress as the WYSIWYG editor f*#%s it all up, I’ve decided to upload the code as a separate file. Download the .txt file here, modify the database settings and rename it to whatevernameyoulike.php. (Can anyone point me to a WordPress plugin that disables all the “intelligent” modifications the editor makes? I’ve tried a few and none of them work perfectly.)
Just upload the .php file to your server and point our browser to the url. It will look something like this http://originalhamsters.com/sms/sms.php
You might have noticed the strange lines in the php code like this one
$row['message'] = str_replace("|", "ö", $row['message']);
I’m using those just to display the Scandinavian letters properly. This really can’t be the best solution to do that, but it works for now, unless you want to use smilies that is. I’ll have to see how and where I should change the encoding settings to get this display properly without this hack.
4th STEP – Quartz Composer
Now for the easy part. In QC you need to just connect the XML Downloader to a couple of Structure Index Member -patches, modify the XML location to be the URL of your .php file and you are all set. Download here a simple .qtz file that just displays the latest message.
5th STEP – What next?
Now it’s just a matter of what to do with the data you receive from the messages. I have a bunch of different applications in mind. You will probably hear from them pretty soon. I just got this thing working today, so I haven’t had the time to test all the possibilities.
Of course, this same technique can be used to access SMS data from various other applications that can read XML files like Flash, Processing etc. I just used Quartz Composer as an example because it’s the environment I’m most comfortable with.
That’s it. Hopefully this is helpful to someone. I’ve seen many interactive installations where SMS messages are used, but I haven’t seen good documentation on how to do it anywhere. Feel free to comment here or email me if you have any improvements or questions.
Here’s some documentation of a project we finished this spring at the university. It’s a project for a course in interface design.
Our group (Aku Meriläinen, Danilo Mascarenhas, Marjukka Parkkinen and Matti Niinimäki) decided to create a multi-user interface that would allow a group of people to work together or compete in creating some sort of a moving collage. At some point in the planning process the idea of communism and propaganda came to surface, so we decided to go with that idea. We experimented with different input devices and visual styles, but eventually this is what came out of it.
I’d like you to meet The Interactive Propaganda Generator. It’s designed to have two different sides or “teams” – the communists and the capitalists – that you can control with different input devices to produce a collage of the two sides shooting different items and symbols at each other. The scene consists of three layers: a changeable background, two characters (one for each side) and the propaganda-tubes. Here are the controls explained:
Control 1 – ReacTIVision fiducial tracking
Control 2 – PlayStation2 Dance Pad
Control 3 – PlayStation2 Dual Shock Controller
Control 4 – Audio Input
Here’s the hardware setup. Click the image for details.
All programming done with Quartz Composer. I could release the .qtz file but it’s not really useful to anyone because it depends on a very specific setup. Email me if you’re interested in details.
And finally some video. Unfortunately, we don’t have any better footage of the system in action but hopefully you’ll get some idea.
I’ve caught a nasty cold, so recently I have spent most of my time at home in the bed perfecting my ninja senses and thinking of new ways to rule the earth. At times like these I come up with my infamous Bloody Good Ideas® (Helvetin Hyvät Ideat®). Usually these ideas involve controlling music or video in some unorthodox ways. Most of them never get done because I’m just too lazy to ever finish what I’ve started or because the ideas are just insanely stupid. Newest additions to this collection of Bloody Good Ideas® are:
Bloody Good Idea® #347
Bloody Good Idea® #348
We’re going to use Phidgets for a university project pretty soon, so I tried to come up with a way to control Quartz Composer with the Phidget sensors. Hiroaki has done Accelerometer and RFID custom patches that you can find here, but I want to use the Interface Kit 8/8/8 and be able to use all the different sensors.
I’m not smart enough to program my own patches for QC, but I was able to build a Cocoa application that sends the data from the sensors to the QC composition. I got a little help from the Phidget Interface Kit -sample code that you can download here and from the instructions found from the Phidgets forum. The code on the forum post didn’t work for me so here’s a small tutorial that shows you how build a Cocoa app that will control your Quartz Composer composition with Phidgets sensors.
What do you need?
- A computer running Mac OSX 10.4 with the developer tools installed
- Phidgets Interface Kit 8/8/8 + some sensors
- Download and install the Mac OSX Framework 21 from Phidgets website. This will also include the source code that you need for this tutorial.
Open the CocoaIFKit Xcode project from the /Examples/Source Code/CocoaIFKit folder.
First we need to modify the project so that we can import and use a Quartz Composer Composition. These next steps are explained with more detail in the Quartz Composer programming guide by Apple and I recommend that you try the tutorials first, but I’ll go through the important stuff quickly.
- First, choose Project > Add to Project.
- Navigate to System/Library/Frameworks/Quartz.framework and add it to the project.
- Drag the Quartz.Framework to your Frameworks folder in the Groups & Files list
- Double click the MainMenu.nib file and Interface Builder launches.
- If you haven’t done this before, you have to install the Quart Composer palette to Interface Builder. Choose Tools > Palettes > Palette Preferences and click add.
- Navigate to /Developer/Extras/Palettes/ and add QuartzComposer.palette.
- Now your palette window should show the Quartz Composer palette. The blue thing is QCView and the green thing is QCPatchController.
- Drag the QCPatchController from the Palette window to the Instances tab in the MainMenu.nib window
- Go to the Cocoa Windows tab in the Palette window and drag a window to the Instances tab also. A new window appears.
- Your MainMenu.nib window should look something like this
- Select the new window and go to Tools > Show Inspector. In the Attributes section, make sure that the “Visible at launch time” is checked for the new window
- Now drag a QCView from the palette to the new window and resize the QCView the way you like it.
- Select the QCView and then open the Bindings pane of the Inspector window. Click the small triangle where it says patch.
- Choose QCPatchController from the “Bind to” pop-up menu. Enter patch in the Controller Key text field.
OK. Now we need a QC Composition to use with our app. I won’t go to any details about using Quartz Composer. There’s plenty of info for that available and this tutorial is already becoming too long.
What you need to do is to create any kind of composition that has a published input with the name of sensorZero. I just used an Image With String connected to a Sprite and published the String input with the name sensorZero. Save the .qtz file to the CocoaIFKit folder. I used the name phidgets.qtz.
Back in Xcode, drag phidgets.qtz to the Resources folder in the Groups & Files list. In Interface Builder, select the QCPatchCotroller from the MainMenu.nib window and select the Attributes pane of the Inspector and click “Load from Composition File…” Navigate to your phidgets.qtz file. Choose File > Test Interface. You should see your composition in the window. The sensors won’t work in the testing mode.
Now the application shows our composition, but we want to change the published value with the sensors. Read on and I’ll tell you how to do just that.
- Select the blue PhidgetInterfaceKitController from the instances tab. Then select the classes tab.
- Choose Classes > Add Outlet to PhidgetInterfaceKitController.
- Name the new outlet theController
- In the Instances tab, ctrl-click and drag from the PhidgetInterfaceKitController to the QCPatchController
- Choose Connect to connect the outlet.
- Save and go to Xcode again.
Now we need to change the code so that the data goes from the sensors to the QC composition
- Double-click the PhidgetInterfaceKitController.h file.
- Add this to the list of outlets:
IBOutlet id theController;
- Close the window and double-click the PhidgetInterfaceKitController.m file.
- Find the SensorChange section and add this code there:
// sensors to Quartz Composer
[theController setValue:[NSNumber numberWithInt:(int)Value] forKeyPath:@”patch.sensorZero.value”];
[theController setValue:[NSNumber numberWithInt:(int)Value] forKeyPath:@”patch.sensorOne.value”];
[theController setValue:[NSNumber numberWithInt:(int)Value] forKeyPath:@”patch.sensorTwo.value”];
[theController setValue:[NSNumber numberWithInt:(int)Value] forKeyPath:@”patch.sensorThree.value”];
[theController setValue:[NSNumber numberWithInt:(int)Value] forKeyPath:@”patch.sensorFour.value”];
[theController setValue:[NSNumber numberWithInt:(int)Value] forKeyPath:@”patch.sensorFive.value”];
[theController setValue:[NSNumber numberWithInt:(int)Value] forKeyPath:@”patch.sensorSix.value”];
[theController setValue:[NSNumber numberWithInt:(int)Value] forKeyPath:@”patch.sensorSeven.value”];
- We only published the sensorZero from QC, but this code works with all the 8 analog inputs in the Interface Kit (Index numbers 0-7). So you can publish more values from QC. Just name them correctly: sensorZero, sensorOne, sensorTwo…
- Note! I’m a total amateur when it comes to Cocoa, so this code might not be the best way to do this but it works.
That’s it. Save. Then choose Build and Go to see if it works.
If you want to change the QC composition, you need to reload the composition to the QCPatchController in Interface Builder and rebuild the app.
Pheew! This is the first tutorial I’ve ever written. I hope it’s useful to someone.
OK. I’ll have to think of something else than this blog for Koala. I’m coming up with small improvements and new versions all the time.
Here’s Koala 0.5.1
- Keyboard shortcuts for video triggering
- Changed the buttons for the effects
- Fixed a bug with the audio sensitivity. It used to default to zero, now the default value is 1
A new version. Koala 0.5 (I’m not sure what the last version was. I’ll just start numbering from here)
Photo from Flickr
- Camera input (4:3 and 16:9 anamorphic)
- More video triggers
- More effects
- More blend and fade modes
- Improved interface
- Real fullscreen + preview window
- Better file handling and triggering for the videos.
- MIDI + keyboard shortcuts
- Lots of other things…
Download Koala 0.5.1
Mac OSX 10.4. –>
I’ve been working on a custom VJ-software for a couple of weeks and now I have something to show you guys. Meet Koala.
Picture from Flickr
Pretty simple app really. Made with Quartz Composer and Interface Builder. There’s no fullscreen option, yet. I’m working on it. The keyer is based on Sam Kass’s composition.
This a very early version. Things are not looking or working right, but you can test it if you want to. This should be pretty stable, but I take no responsibility in what might happen if you use this. So, if your computer explodes, turns into dust or starts wearing skirts, don’t blame me. I don’t have any time for manuals or such. It should be fairly straightforward, but if you have any questions, comments or bug reports you can contact me via email: matti.niinimaki “at” gmail dot com
Works only on Mac OSX 10.4 ->
Download Koala 0.5.1
I ended up taking a really long walk around the town today. I came home with from that walk with a Wiimote in my bag. Is there a better way to get your mind off of bad things than playing with a new toy? I’m sure there are, but this worked today.
I don’t have a Wii console, but the reason why I got a Wiimote was because I wanted to hook it up with my iBook and use it as a controller for some VJ stuff. Here’s the first experiment. Using the Wiimote as a videoscratching device. The Y-axis motion sensor controls the scrubbing of the video back and forth. Pressing the A or B button changes the videoclip.
The QC patch for Wii was developed by Hiroaki He hasn’t released the patch officially because it’s unstable (QC crashes everytime you close a composition with a DarwiinRemotePatch), but you can find it here. Hiroaki is too busy right now to improve this patch, but if there’s some Cocoa-guru out there reading this. Please, try to make a more stable patch using the newest WiiRemote framework. I’d appreciate it.