Arduino Sewing Machine Guitar Pedal

A few days ago I saw a sewing machine pedal in a charity shop, and wondered if I could turn it into a guitar effects pedal. Through a bit of re-wiring and few lines of Processing, it turns out you can. The hardest bit was getting the pedal apart!

The pedal is basically a spring loaded potentiometer, so I wired it to send the values, through an Arduino to a Processing App, and from there, to the virtual guitar effects software – Guitar Rig.

It’s not a bad start, but it might take me a while to make a full copy of one of these –

Arduino Project + Home Office

So, I’ve been pretty busy lately – back to work, which is great – getting stuck back into interesting Flash development for an awesome client, with some really good people.

But that doesn’t mean I’m falling behind on my other on-going projects. I’ve still got 2 games almost finalised, and my interactive arts project with Josh Sadler is coming on well.

For the arts piece, I’ve recently picked up an Arduino.

What’s an Arduino?

Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware and software. It’s intended for artists, designers, hobbyists, and anyone interested in creating interactive objects or environments.

Sweet! I’ve been interested in HCI, hardware hacking and alternate input devices for a while – so I really should have picked up an Arduino ages ago!

Check out this beaut –

Here’s the kit I bought – complete with LEDs, potentiometers, breadboard and LCD screen. There’s lots of possibilites here. On the day it arrived, Josh and I managed to get it hooked up to some code we’d written (in PureData and Processing respectively).

And as a bonus, just for mentioning it, I get extra added blog cred. Just check out this XKCD –

In other news, the design site Inspiredology recently ran part two of their round up of “INSPIRING WORK ENVIRONMENTS”.

It’s fun to notice how every single one is a mac! I guess mac users are just more stylish. My current “home office” certainly offers no competition –

Yeah, that’s right. I code on a stool.

Constellation – A flocking experiment

This week I saw Flight 404’s “Swarm Behavior” on vimeo –

Swarm behavior from flight404 on Vimeo.

Yet another awesome video from Robert, using his Cinder framework. Cool!
In the description, he mentions the particle’s behavioral rules –

1) If I am far away from my neighbors, move towards them.
2) If I am too close to my neighbors, move away from them.
3) If I am neither too close or too far from my neighbors, move with them.

So I decided to try and implement these rules in Flash. The idea changed a few times, and ended up looking like an interactive constellation app. So here it is! It’s still pretty rough around the edges – but I’m quite pleased with how it’s developing.

See and edit the code over on Wonderfl

CODE

package{

	[SWF(width="465", height="465", frameRate="50")]

	import flash.events.*;
	import flash.events.KeyboardEvent;
	import flash.display.Bitmap;
	import flash.display.BitmapData;
	import flash.display.DisplayObject;
	import flash.display.MovieClip;
	import flash.display.Stage;
	import flash.geom.Point;
	import flash.filters.BlurFilter;
	import flash.filters.ColorMatrixFilter;
	import flash.filters.ConvolutionFilter;
	import flash.filters.GlowFilter
	import flash.text.TextField;
	import com.bit101.components.*;
	
 	public class BFCWonderfl extends MovieClip {
		
		//Vars - 
		//You can play with these ones - 
		private var numBoids:int=20;
		//Boids closer than this will feel crowded!
		private var minDist:int=90;
		//Boid further away than another than this will be lonely!
		private var maxDist:int=100;
		//This is how fast the boids can move. TOP SPEED!
		private var maxSpeed:Number = 3;
		//This is how much boids influence each other - lower number = more influence
		private var divideBy:int=100;
		//Shall the boids slow down with friction?
		private var enableFriction:Boolean = true;
		private var friction:Number = 0.9;
		//Settle down - if they're not too close and not too far away from their friends - they'll just stop
		private var settleDown:Boolean = false;
		
		private var boidColour:uint = 0xffffff;
		private var lineColour:uint = 0xffffff;
		private var bgColour:uint   = 0x000033;
		
		private var glow:GlowFilter = new GlowFilter();
		private var glowColour:uint = 0x99ffff;

		//But you should probably leave these as is - 
		private var boidArray:Array=[];
		private var menuHeight:Number = 85;
		private var doMidi:Boolean = false;
		private var BMD:BitmapData = new BitmapData(stage.stageWidth,stage.stageHeight-menuHeight, false, bgColour);
		private var BF:BlurFilter = new BlurFilter(5,5,1);
		private var Bit:Bitmap = new Bitmap(BMD);
		private var bitHolder:MovieClip = new MovieClip;
		private var ballHolder:MovieClip = new MovieClip;
		private var isMouseDown:Boolean = false;
		private var TB:TextField = new TextField();
		private var myCheckBox1:CheckBox;
		private var myCheckBox2:CheckBox;
		private var mySlider1:HSlider;
		private var mySlider2:HSlider;
		//Boid Flock Class
		public function BFCWonderfl():void{
			trace("Init!");
			addChild(bitHolder);
			bitHolder.addChild(Bit);
			addChild(ballHolder);
			
			glow.color = glowColour;
			glow.alpha = .5;
			glow.blurX = 5;
			glow.blurY = 5;
			
			ballHolder.filters = [glow];
			
			addChild(TB);
			TB.y = 0;
			TB.width = stage.stageWidth-10;
			TB.height = 75;
			TB.selectable = false;
			TB.text = "Constellation by Lawrie\nhttp://www.LawrieCape.co.uk\nSpace to add a boid at mouse - click to attract - any other key to reset.\n\nADD MINIMAL COMPS HERE - MIN MAX sliders and Friction Settle checkboxes";
			
			myCheckBox1 = new CheckBox(this,5,50,"Friction?",updateVals);
			myCheckBox1.selected = true;
			myCheckBox2 = new CheckBox(this,5,70,"Settle?",updateVals);
			var sLabel:Label  = new Label(this,75,45,"Min size");
			var sLabel2:Label = new Label(this,75,65,"Max size");
				
			mySlider1 = new HSlider(this,125,50,updateVals);
			mySlider2 = new HSlider(this,125,70,updateVals);
			
			mySlider1.setSliderParams(1,200,75);
			mySlider2.setSliderParams(1,200,100);
			
			addChild(myCheckBox1);
			addChild(myCheckBox2);
			
			addChild(mySlider1);
			addChild(mySlider2);	
			
			bitHolder.y = menuHeight;
			ballHolder.y = menuHeight;
			ballHolder.mouseEnabled  = false;
			ballHolder.mouseChildren = false;
			bitHolder.alpha=1;
			
			BMD.fillRect(BMD.rect, bgColour);

			bitHolder.addEventListener(MouseEvent.MOUSE_DOWN, mouseIsDown);
			bitHolder.addEventListener(MouseEvent.MOUSE_UP,   mouseIsNotDown);			
			stage.addEventListener(KeyboardEvent.KEY_UP, makeASingleBoid);

			addEventListener(Event.ENTER_FRAME, updateBoids);
			//makeBoids(numBoids);
		}
		
		private function makeASingleBoid(e:KeyboardEvent):void{
			if(e.keyCode==32){
				makeBoids(1,mouseX,mouseY);
			}
			else{
				reset();
			}
		}
		
		private function mouseIsDown(e:Event):void{
			isMouseDown = true;
		}
		private function mouseIsNotDown(e:Event):void{
			isMouseDown = false;
		}
		
		private function makeBoids(makeXBoids:int, bX:Number = 0, bY:Number = 0):void {
			for (var i:int=0; imaxDist) {
					B.speedX-=B.distToB2X/divideBy;
					B.speedY-=B.distToB2Y/divideBy;
				}
				//2) If I am too close to my neighbors, move away from them.
				else if (B.distToB2stage.stageWidth){
					B.x=stage.stageWidth-B.speedX;
					B.speedX*=-friction;
				}
				else if(B.x<0){
					B.x=-B.speedX;
					B.speedX*=-friction;
				}
				if (B.y>(stage.stageHeight-menuHeight)){
					B.y=(stage.stageHeight-menuHeight)-B.speedY;
					B.speedY*=-friction;
				}
				else if(B.y<0){
					B.y=-B.speedY;
					B.speedY*=-friction;
				}
				
				//Limit them to a top speed - 
				if(B.speedX>maxSpeed){
					B.speedX = maxSpeed;
				}
				else if(B.speedX< -maxSpeed){
					B.speedX=-maxSpeed;
				}
				if(B.speedY>maxSpeed){
					B.speedY = maxSpeed;
				}
				else if(B.speedY< -maxSpeed){
					B.speedY=-maxSpeed;
				}		
				
				//Add friction?
				if(enableFriction){
					B.speedX*=friction;
					B.speedY*=friction;		
				}
				
				//Move them 
				B.x+=B.speedX;
				B.y+=B.speedY;
			
			}
			//Draw into the BMD

			BMD.draw(ballHolder);
			//Apply a blur?
			BMD.applyFilter(BMD,BMD.rect,new Point(0,0),BF);
		}
		
		private function reset():void{
			removeEventListener(Event.ENTER_FRAME, updateBoids);
			for (var i:int=0; i

New project – Arduino, Processing, Generative Audio…

I’m still searching for a nice new Actionscript Developer post, which means I’ve currently got more time for developing some of the personal projects I’ve been planning whilst away. One idea I’ve been keen on for a long time is Generative Systems – for art and music.

Generative Art

Generative art refers to art that has been generated, composed, or constructed in an algorithmic manner through the use of systems defined by computer software algorithms, or similar mathematical or mechanical or randomised autonomous processes.

Generative Audio

Generative music is a term popularized by Brian Eno to describe music that is ever-different and changing, and that is created by a system.

My first steps into this domain, was my Maths Flash Generative Art Animation from about 4 years ago. And I recently picked it up again in my Flash Media Server demos – Sonar and WebCamColours.

So this week I’ve been thinking about technologies other than Flash which could be used for some generative projects. At the minute, I’m looking at Processing, Arduino, Max MSP/PureData/VVVV, Kontakt and OpenFrameworks.

As my musical skills are slightly limited, I’ve teamed up with awesome sound engineer, programmer, musician and artist Josh Sadler. We talked over how to make a generative system sound more musically appealing, batted a few ideas round and left it at that. A few hours later he sent me the track below.

In his own words –

I had a go at making that music generator you were talking about. Here’s the result. You pick the scale hit go and there’s a button to change it up a bit, bring instruments in and out as you like, needs refining. This one was just 3 button clicks, I think it’s more musical although I’ve been listening to it for so long now I’m not sure what music is anymore

I was blown away! See what you think –

Musicgen2 by Catfurnace

I’m really looking forwards to seeing where this goes. Should be fun.
More info as it happens.

Flash Midi Server – Processing + Flash + Webcam Instrument

Right, this has been something I’ve had in development for a while – and I’ve finally decided to put out a video demo. More info, videos, audio and hopefully source coming soon.

Flash Midi Server + Webcam image to audio app

An early test of my Flash Midi Server – used to send Midi notes and controllers from within Flash movies.

This early demo shows the Processing based Midi server (blue app in the bottom left), and also a Flash Webcam based audio tool. The Flash app takes still images from a webcam, and analysies them for 4 colours within them. These colours are then mapped to a range of notes, so for example, a white image will send a high note, whilst a black image wil send a low note. These notes can then be played back using Midi, and the corresponding images are displayed.

As an extra feature – the “activty level” (amount of movement) in the webcam can be monitored, and sent as CC data, to alter any settings. Here it is linked to a paramater of the midi instrument.

More polished versions coming soon.

Hopefully some nicer audio coming soon too : )