Arduino to MIDI implemented !

Posted in Arduino, MIDI, VJing on December 8, 2011 by bochovj

Hi,

I have finally reached one of the objectives I have had for a long time since I have started this blog: converting physical signals captured by Arduino into MIDI messages that I could use in some program on my laptop (like Resolume for VJing).

First of all I would like to tell you what DID NOT work for me.

I have seen on many blogs that what usually people do is a operating system-level trick: they install a serial to midi driver that reads the serial port and generates midi messages as it was a midi device connected to the system.
This is the way it is actually done by many midi devices manifacturers, and actually the trick just consists in downloading and installing one of their drivers.
The most famous one is the Roland serial midi driver, which is seems not available on some operating systems (e.g. Windows 7). A much more interesting driver is offered by Yamaha on this site, but I have tried it and it wouldn’t install either.

So in the end I thought: why don’t I just create a Java application myself that reads the serial port and routes the MIDI messages to some midi device?

The first problem was finding a reasonable solution for reading serial ports in Java.
You would think “hey! this is pre-history of computer science!”, or at least this is what I thought, but being Java anti-low-level-stuff it doesn’t have a “normal” way for doing it.
There is a standard API, the Java Communications API, that was once created by SUN and then discontinued. Actually the standard implementation, which used to work also on Windows, is now only available for some Unixes. Fortunately some guys created the RTXT library which is an alternative implementation of the same API, and which offers support for all operating systems. So I have adopted this last one and made it sniff my Arduino messages.

Then I had to implement a protocol to send midi messages from Arduino. I could have used the MIDI itself, but it was then difficult to separate messages one from another as there is no standard separator, so I just made an extremely simple protocol myself.

The protocol follows these rules:

  • one message per line (i.e. packets are separated by a carriage return)
  • Control changes are represented as: cc ch 10 ctrl 12 val 130 (where ch stands for channel, ctrl stands for control and val for value)
  • Notes ON are represented as: non ch 10 key 12 vel 120
  • Notes OFF are represented as: noff ch 10 key 14 vel 120
  • Aftertouches are represented as: at ch 10 key 14 tch 100

Then I created an utility that interprets these packets and sends them back to some MIDI interface you may have on your computer.
If the objective is to use these messages in some program, like in my case, then you would also need some MIDI “router” that receives messages and sends them back to another interface. For this objective I have used the LoopBe1 free tool, which works on my Windows 7 64 bits (i.e. it is updated). For other operating systems I am sure there are similar alternatives.

The result is some code for both Java and Arduino.

Let’s see the example for Arduino first:


void setup() {
Serial.begin(9600);
}

void loop() {
float sensorValue = analogRead(0);
int intValue = (sensorValue / 1023) * 127;
String value = intValue;
Serial.println("cc ch 10 ctrl 12 val "+value);
delay(10);
}

As you may see, it is just a simple example that reads the value of pin 0 and sends it as a control change on channel 10, control number 12. The value is normalised to 0-127 (as the MIDI standard requires) and then put into the string.

More interesting may be the Java code, which can be seen here.

I have also resumed the functionalities in the wiki page.

In order to make it simple to use I have created a GUI for it. It lets you choose the midi output, the serial port and then it has just a start/stop button to activate/deactivate it.

In order to work, the proper native library of RTXT must be put into the Libraries folder when compiling it from Eclipse (see the original instructions here). The current native library is for Windows 64 bits.
If you have any problem don’t hesitate to contact me.

So, the proof of the concept is completed, now there are thousands of ideas that come to my mind on how to improve/generalise this.

Here you can see a demonstration that I am not lying:

Any comment is welcome !

Astonishing video mapping + synthesis + dance

Posted in Uncategorized with tags on November 19, 2011 by bochovj

impressive.

First video of the album: Lluvia

Posted in VJing on November 7, 2011 by bochovj

This is the official video of the song Lluvia (rain) of the group Nöno.
You can listen to the entire album here.

I created it using Resolume, which, unfortunately, drops many frames while recording and produces a stream which is not fluid and really difficult to synchronize with the audio

The video as well as the song are distributed under the creative commons license: Attribution-NonCommercial-ShareAlike 2.5 Generic

This video is a collection of samples of videos downloaded from the net. All the source material is public domain or creative commons.
I sincerely thank all the contributors who make their videos available for modification and artistic use.
The list of sources is the following:

source: http://www.archive.org/details/Rain_4
author: Josh Leo
license: NA

source: http://www.archive.org/details/CEPriceAutumnSkies
author: C. E. Price
license: Creative Commons license: Attribution-NonCommercial-ShareAlike

source: http://www.archive.org/details/AutumnImpressions
author: Raff Fluri
license: Creative Commons license: Attribution-NonCommercial-ShareAlike 2.5

source: http://www.archive.org/details/IntheBeg1937
author: U.S. Department of Agriculture, Bureau of Dairy Industry, Extension Service, Division of Motion Pictures
license: Public Domain

source: http://www.archive.org/details/CapeCodMarshClouds
author: Tracey Jaquith
license: Public Domain

source: http://www.archive.org/details/IMB_SF_R32_C10
author: Ivan Bridgewater
license: Creative commons Attribution 3.0 Unported (CC BY 3.0)

source: http://www.archive.org/details/CEP366, http://www.archive.org/details/CEP464, http://www.archive.org/details/CEP453, http://www.archive.org/details/CEP_00_008_WS, http://www.archive.org/details/CEP_00_078_WS
author: C. E. Price
license: Public Domain

Nöno’s first album, Juguetes, published online!

Posted in VJing on October 19, 2011 by bochovj

The group I was VJing before it broke up, Nöno, published its first (and sadly last) album online.

http://www.jamendo.com/en/album/100484

All the music is free (creative commons).

Now I have to create the official videos and publish them ASAP!

 

Stay tuned…

 

10 Cool sources for free VJ loops

Posted in VJing on October 11, 2011 by bochovj

Hi,

I usually prepare my loops from downloaded videos on the Internet. For ethical reasons I always try to get “free” material, in the sense of having open source-style licenses like creative commons.

Here there is a list of cool webstes where to get good stuff:

1) Archive.org

This is my favorite one, all the material is free, you can choose different media types and there is a very cool library of vintage videos called Prelinger collection: http://www.archive.org/details/prelinger with a lot of 50′s and 60s commercials and documentaries. Perfect for nice, old looking loops!

Another interesting library is the Ephemeral: http://www.archive.org/details/ephemera, with mostly old educational videos.

Almost all videos have open licenses (creative commons, public domain etc.) but be careful and read the License box before usign them!

2) Beeple

A really nice source of VJ loops. All loops are under Creative Commons license. It’s not really my kind of style, but they are objectively nice.

3) AVGeeks

Really cool videos from the past, all their collection is also on archive.org but licensing is not very clear. They sell videos in high quality but regarding low quality previews on the web it is not very clear how you can use the material (I have sent them an email, let’s see).

UPDATE: I have sent them an email and their answer is pretty clear:

Hi Dario,

Thanks for the inquiry.

If you use the material that is already online, it’s free and clear. We’d love a donation if the film clips were helpful to you and you’d like to support our effort to get more films online. (http://www.avgeeks.com/wp2/donate/) Even a couple of dollars will help – maybe buy us a beer or two..

We also have started an Adopt-a-film program where you can put money towards digitizing other films in our collection: http://www.avgeeks.com/wp2/adopt-a-film/

Skip Elsheimer

A/V Geeks LLC

4) Vidtionary

The perfect idea for the VJ who looks for specific semantics in the loop. You put the word and search. The website contains mostly links to other sources, and the licensing is not always clear, so be careful and read the details of the movie clearly!

5) Creative Commons Videos

checkout the blog from the official creative commons webiste, sometimes really nice stuff are published there, and you won’t have doubts about the license.

6) Wikimedia

whatever is here is with free license, many weird videos, sometimes even too weird.

7) Edison Motion Pictures

Beautiful old videos. And these are really ooold ones. Since industry has not obtained an infinite life extension of copyright yet (give them few years still), these movies are completely public domain.

8) U.S. Department of Energy Historical Test Films

Do you want the bomb? Here’s a nice collection about experiments with nuclear bombs. All the material is of public domain. A little bit repetitive though.

9) Creative commons search engine

The creative commons site has a list of links to other search engines that allow creative commons content. Among them, there is a link to Youtube, which already supports CC as an official licensing scheme, the pity is that the site doesn’t really allow filtering per license and thus you have to pay attention at what the results are. In any case you can use this website also for looking for pictures and types of content.

10) Google

If you go to the advanced settings, you can choose the type of license the content you are looking for should have. Then, back on the search page, you can select Videos as the type of content. I have to say that I have found more stuff on Archive than on Google, their searching algorithms are still not very good at selecting licenses.

MidiWii released !

Posted in MIDI, Wii with tags , on July 3, 2011 by bochovj

MidiWii is a small program written in Java that translates the messages sent by a WiiMote into MIDI messages.
I have released the source code in my repository and also a downloadable executable jar here.

Things you can do with MidiWii:

- control some of your Resolume commands with the wii mote
- play some notes with the wii mote
- control some effects on audio and/or video by moving the wii mote

And here a couple of screenshots:

Robot alien box

Posted in Uncategorized on June 19, 2011 by bochovj

Today I’ve spent a couple of hours creating this new alien box:

Originally it was a box inside some doll that laughed when pressing it. I have substituted the pitch resistance with two springs, the original button with a new one and added a plug for earphones.

And this is what it does:

Minia library for Java

Posted in Minia with tags , , on June 10, 2011 by bochovj

After quite a big effort I have managed to use my Minia in Java.
Unfortunately there is no native support for HID devices in the JVM so one has to map some native library of the OS using JNI or JNA or map some third party library like the HIDApi that is esactly what I did.
This library claims to be compatible with Windows, Linux and MacOSX.
I have compiled it for Windows, and after some useless attempts I have managed to import in java using JNA.

After this I created a little abstraction for the device and a little GUI for testing it.
As usual the code is available in my repository here.

I have also created a small wiki page here and here.

Have fun.

A simple GUI for testing the Minia

More from the Nosmis Experience

Posted in Uncategorized with tags on May 11, 2011 by bochovj

A friend of mine published another video of the Nosmis show where I performed as VJ, you can see it here:

My last show, the Nosmis Experience

Posted in VJing on April 7, 2011 by bochovj

Hi,

this is a short movie from the last show I have been involved in:

The event has its own little blog here

I have given support to the show of Loren y el Mago by projecting their own image to the background and adding some effects and the electronic group Fuga de freón by showing some vintage loops taken from old adverts.

Follow

Get every new post delivered to your Inbox.