Flash Midi Server

Flash Midi Server v0.1

Lawrie Cape 2010
Download from the Google Projects Page.

WHAT IS IT?

Flash Midi Server is method for sending MIDI data out of Flash. Using an Actionscript 3 class and a Processing application, you can create generative,

dynamic, fun audio tools in Flash.

WHY?

Mainly just for fun. Flash Midi Server (FMS) started as an experiment to test communication between Processing and Flash. From there it developed into a

class I played around with a lot – seeing what fun things I could use it for.

As FMS is built in Flash, it allows developers to rapidly prototype audio tools, experiment with new input methods and acess to a huge public code base to

build on top of. There’s a huge amount of technical skill and creativity in the Flash scene and hopefully some of it will be applied to creating innovative

new audio apps using FMS.

HOW DOES IT WORK –

FMS sends data from Flash to the FMS server – which then sends the data as a Midi signal.

Firstly run the FMS app in the “Server App” folder.
Then run one of the Flash or Air apps. Note – you cannot run .swf files as they do not have the security permissions to access the midi server, unless you

set the permissions here – http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html

You can set which Midi Channel the audio is played through via the drop down on the FMS app.
Windows XP has “Microsoft Midi Mapper” which plays the notes back over the soundcard. Mac OSX has a similar default Midi Playback setting.

To use FMS with other audio apps, you must install virtual midi softward. For example – LoopBe http://nerds.de/en/loopbe1.html
These channels will then show up in the FMS settings drop down.

HOW DO I USE THE CLASS MYSELF? –

Place the uk.co.lawriecape.midi folder structure in you classes folder.
You can then check out the .Fla sources in the “Example FLAs” folder.
A basic setup can be seen below –

In flash –

//Import the Flash Midi Server class.
import uk.co.lawriecape.midi.flashMidiServer;
//Create an instance of the class.
var MS: flashMidiServer = new flashMidiServer();
//Add event listeners for the various Server events - (optional)
	MS.addEventListener("FLASH_MIDI_SERVER_ESTABLISHED", connectionEstablishedHandler);
	MS.addEventListener("FLASH_MIDI_SERVER_LOST",        connectionLostHandler);
	MS.addEventListener("FLASH_MIDI_SERVER_NOT_FOUND",   connectionNotFoundHandler);

function connectionEstablishedHandler(e:Event):void{
	trace("Flash midi server connected.");
	trace("You can start sending data now!");
	MS.sendNote(50);
	//or
	//MS.sendCC(50);
}

function connectionLostHandler(e:Event):void{
	trace("Flash midi server disconnected.");
}


function connectionNotFoundHandler(e:Event):void{
	trace("Flash midi server not found, please check the program is running and try again.");
}

WHAT COMES NEXT? –

There are quite a few limitations to the current system, which I’ll be trying to address in future releases. These include –
The ability to send CC data on specified CC numbers.
The ability to have audio output on multiple midi channels at once – to controll multiple instruments from a single server instance.
The ability to send multiple notes at once – eg. Chords or simultaneous drum hits.

If you have any suggestions, or make anything using FMS, please get in touch with me.
Cheers.
Lawrie.

Lawrie at LawrieCape.co.uk

See also –

Flash Midi Server – Sonar reproduction. from Lawrie Cape on Vimeo.

Download the source code for Sonar from the Google Projects Page.

Flash Midi Server – Processing + Flash + Webcam Instrument from Lawrie Cape on Vimeo.

13 thoughts on “Flash Midi Server”

  1. HI!
    You left a msg in my openprocessing sketch Color to Midi notes visualID=4121

    This “Webcam Midi Thing” is very intresting!
    I don’t understand which data you get from the webcam frames and then convert to Midi…
    Did you tryed to send this data to a sintethizer?
    I think that if you could use the data to variate parameters of a continuous sound it could be more natural. The periodic midi notes makes me imagine a compulsive pianist jajaja :)

    I’d like to keep in touch to know more about this “Thing”
    If u want to share ideas, send me mail!
    [email protected]

  2. Hi ZVUHO – every time you catch an image from the webcam – the image get divided into grid segments – each of these segments is then analysed to find the dominant colour in it – and then this colour is mapped into the Midi range – with black being midi note 0 and white being midi note 127 – and all other colours in between.

    Yeah – I bet it would sound nicer to use CC’s to modulate a sound as opposed to sending individual notes – it does too often sound like a compulsive pianist.

    If you’d like to have a play with the app – it’s an Air app bundled in with the Flash Midi Server stuff, which you can get at the google code page –
    http://code.google.com/p/flash-midi-server/downloads/list

  3. Great software, this really opens up a huge lot of possibilities!
    How complicated would it be to have FMS sync to the Midi clock of a device? if possible at all…
    cheers,
    Hannes

  4. Hi Alfonso,
    Yep, it is possible to do that using a very similar set up. I had a rough demo working when I started work on this a few years ago. I’ll try and remake an input/output version – and I’ll post the files.

  5. hi, ive been working on getting my head round a midi interface for my setup(keyboards) , done the graphic shell and now im confused….

    can you help me out in development of a flash interface for midi, just need program change messages, bank control and midi channel control messages to work from my flash shell.

    any help would be great. rob

  6. But the problem of your flash midi server is:
    Don’t receive other than your sendNote and sendCC or what? Because I want to send a CC with a Number of CC,Value and MIDI channel…
    If the Your FMS receive all data you want I’ll try to write a function with all the data. OK? thx a lot

Leave a Reply

Your email address will not be published.