Sunday, July 03, 2011

VecM: DIY MIDI Interface for GCE / Milton Bradley Vectrex

Introduction
The VecM is a MIDI interface for the GCE / Milton Bradley Vectrex console. The VecM is made up of two main parts - the interface hardware (which includes a pre-programmed microcontroller) and a custom program for the Vectrex console (which can be put onto a homemade cart or a third-party flash cart). The VecM interface gives the user full control over the sound capabilities of the Vectrex sound chip.



Music Examples
http://lazerscale2010.com/files/little-scale_087_the_harbour.mp3
http://lazerscale2010.com/files/little-scale_066_Happy_Lual.mp3
http://lazerscale2010.com/files/little-scale_065_Commiseration.mp3



Vectrex Sound Capabilities

Unlike most video game consoles, the Vectrex has no direct audio line output and was designed with an internal speaker only. As such, the sound of the Vectrex is always coloured by the physical space in which the console is used. This colouration can be bypassed by modifying a Vectrex console so as to have a direct audio output.

The Vectrex features an AY-3-8912 sound chip – a programmable sound generator made up of three channels. The AY-3-8912 is a sonically identical variant of the AY-3- 8910 sound chip, lacking one of the input / output ports found on the latter. Each channel of the AY-3-8912 can be set to a pitch-enabled mode for which the frequency is selectable. The sound chip also features a noise-enabled mode whereby a global pseudo-random noise source is routed to the output of a given channel. The frequency of the noise source is selectable via a global register. These two modes are not mutually exclusive, as a channel can simultaneously output both pitch and noise material.

The frequency resolution and frequency range of the AY-3-8912 are beyond that of comparable sound chips, such as the Texas Instrument SN76489. However, as with the SN76489, the oscillators of the AY-3- 8912 cannot be adjusted in terms of duty cycle and waveform type. Furthermore, the sound chip features a single amplitude envelope generator that can be used to modulate the volume of a channel. Although all of the features of the AY-3-8912 can, in theory, be used for music composition with the Vectrex, original Vectrex games tended to feature sparse soundtracks that under-utilised the capabilities of the sound chip.



Interface Hardware: Schematic and Notes


9 Pin D-subminiature 1 and 2 refer to controller ports one and two of the Vectrex video game console. IC1 is the ATmega328 microcontroller loaded with an Arduino bootloader and Vectrex Music Interface firmware.

For reference - when considering construction using a pre-built Arduino board:

◦ IC1 Pin 2 = Arduino Digital Pin 0 = PORTD Bit 0
◦ IC1 Pin 3 = Arduino Digital Pin 1 = PORTD Bit 1
◦ IC1 Pin 4 = Arduino Digital Pin 2 = PORTD Bit 2
◦ IC1 Pin 5 = Arduino Digital Pin 3 = PORTD Bit 3
◦ IC1 Pin 6 = Arduino Digital Pin 4 = PORTD Bit 4
◦ IC1 Pin 11 = Arduino Digital Pin 5 = PORTD Bit 5
◦ IC1 Pin 12 = Arduino Digital Pin 6 = PORTD Bit 6
◦ IC1 Pin 13 = Arduino Digital Pin 7 = PORTD Bit 7

◦ IC1 Pin 14 = Arduino Digital Pin 8 = PORTB Bit 0
◦ IC1 Pin 15 = Arduino Digital Pin 9 = PORTB Bit 1
◦ IC1 Pin 16 = Arduino Digital Pin 10 = PORTB Bit 2
◦ IC1 Pin 17 = Arduino Digital Pin 11 = PORTB Bit 3
◦ IC1 Pin 18 = Arduino Digital Pin 12 = PORTB Bit 4
◦ IC1 Pin 19 = Arduino Digital Pin 13 = PORTB Bit 5

◦ IC1 Pin 23 = Arduino analogue Pin 0 = PORTC Bit 0
◦ IC1 Pin 24 = Arduino analogue Pin 0 = PORTC Bit 1
◦ IC1 Pin 25 = Arduino analogue Pin 0 = PORTC Bit 2
◦ IC1 Pin 26 = Arduino analogue Pin 0 = PORTC Bit 3
◦ IC1 Pin 27 = Arduino analogue Pin 0 = PORTC Bit 4
◦ IC1 Pin 28 = Arduino analogue Pin 0 = PORTC Bit 5



Interface Hardware: Minimum Parts List

ICs:
◦ ATmega328 pre-programmed with an Arduino bootloader and the Vectrex Music Interface firmware
◦ 4n28 optocoupler

Resistors:
◦ 220 Ohms
◦ 3.3k Ohms
◦ 10k Ohms
◦ 100k Ohms

Capacitors:
◦ 22pF
◦ 22pF
◦ 0.1uF
◦ 47uF

Miscellaneous:
◦ 16.00 MHz crystal
◦ 1n4148 diode

Connectors:
◦ 5 pin DIN
◦ 9 pin D-Sub
◦ 9 pin D-Sub



Interface Software: Vectrex Software
There are two main software components to VecM - the program for the Vectrex console, and the program for the Arduino platform (or compatible microcontroller).

The ROM for the Vectrex console can be found here:
http://milkcrate.com.au/_other/chipmusic_software/vecm/GCE%20Milton%20Bradley%20Vectrex%20ROM%20for%20Console.bin

The source code for the Vectrex ROM file can be found here. Please note that the source code for the Vectrex ROM file is not required for the VecM:
http://milkcrate.com.au/_other/chipmusic_software/vecm/GCE%20Milton%20Bradley%20Vectrex%20Source%20Code%20for%206809.txt

The source code for the Arduino platform can be found here:
http://milkcrate.com.au/_other/chipmusic_software/vecm/GCE%20Milton%20Bradley%20Vectrex%20Arduino%20Source%20Code.txt

To run the Vectrex ROM file on an actual Vectrex console, a flash cartridge (e.g. http://www.vectrex.biz/) or homemade E/EPROM or similar cartridge is required.

To run the Arduino program, simply copy and paste the source code into a new Arduino sketch, compile and upload to the microcontroller board as per usual.



User Guide
A user guide, covering basic setup, MIDI mapping and control, can be found here:
http://milkcrate.com.au/_other/chipmusic_software/vecm/Vectrex%20Music%20Interface%20User%20Guide.pdf

7 comments:

VectrexMad! said...

Nice, any chance of a youtube video to see it all in action?

Sebastian Tomczak said...

Yes - and I will also be posting a step-by-step guide on how to build / use it :)

VectrexMad! said...

Nice! Any chance of a YouTube video to see it all in action?

Just curious does each connected Vectrex Midi board have a unique ID so multiple Vectrex consoles can be played over Midi?

VectrexMad
http://www.vectrex.co.uk

VectrexMad! said...

can the VecM interface be assigned with different IDs so you could control multiple Vectrex consoles over MIDI?

VectrexMad! said...

can VecM interfaces have different IDs so that you could play multiple Vectrex consoles over MIDI?

Sebastian Tomczak said...

Good question - no, not at the moment, but it would be pretty easy to implement. For example, a given VecM interface could have a user-defineable channel offset for the MIDI data, thereby letting a single port control up to four Vectrexes. Is this something you would be interested in?

Anonymous said...

could be an interesting sound hearing multiple Vectrex consoles!