Skip to content

Software architecture

Asw1n edited this page Apr 24, 2014 · 1 revision

The robot musicians are controlled via a Midi file. MIDI files do not contain music, the contain the instructions to generate music.

Controller

Heart of the system is a controller running on a PC. The controller uses a Midi sequencer to read the Midi file and to convert this into time based instructions. These instructions are send to the controller who passes it on to two receivers. One is a (software) synthesizer on the PC. The other is the conductor. Later more about the conductor. Sequencers and synthesizers are standard Midi devices. They can be implemented both in hardware and in software. I think every PC has one of both implemented in software. If it had not it would not be able to play Midi. The EV3 hasn't got these devices. The Java sound API has classes to encapsulate both devices turning them into Java objects. The controller is a custom program. Thanks to the Sound API it is just a few lines of code.

Conductor

As said, the sequencer is connected to two receivers. The synthesizer uses the midi instructions to generate sound. The conductor, the band leader, uses it to control the band members. The conductor is custom software. It's job is to distribute the stream of midi instructions to the different band members. For this it uses a mapping table that maps instruments to band members. It also filters out those instructions that are irrelevant to the musicians. The relevant instructions are translated into remote method calls that will be executed on the Bricks. The remote method calls are based on the RMI framework that is part of Java and LeJOS. It runs over Wifi, BT and USB. To the conductor this all transparent.

IM mapping table editor

The instrument/musician mapping table tells which brick will represent which instruments. This table is created and maintained by a third piece of custom software, the IMtable editor. This software has a user interface, the user specifies the mapping. Not all instruments have to be mapped, musicians can play multiple instruments. The IMtable editor is able to scan Midi files to find out which instruments are used and need to be mapped for each song.

Musician interface

On the brick there is one class that implements the methods that the conductor calls. The implementation of this class is different for each musician. But an interface will be provided. It will define methods like Start(), Stop(), NoteOn(note), noteOff(note), SetTempo(BPM) and maybe others. It are these methods that define how a musician will behave on music. You can imagine a guitar player to move it's left arm according to the value of note and it's right arm on NoteOn(). A drummer hits a different drum according to the value of note. As you can see it is rather easy to write the software for a musician. It is just one class having a few methods. You are not bothered with Midi, this is taken care of by the components on the PC that the project provides. You also are not bothered with networking etc. this is taken care of by RMI.

Clone this wiki locally