-hard plAYer- is an 8 bit tunes hardware player, which allows you to listen to the same melodies you could listen to in some of the 80's home computers and videogame consoles. In next versions It will also work as MIDI synthesizer. It's audio sound generator porcessor is the General Instruments AY-3891X the same one that was used in vintage computers like the Atari ST, Amstrad CPC, Spectrum ZX, MSX, Oric, or Colour Genie, and consoles like the Intellivision or Vectrex. The YM-2149 was a Yamaha's licensed version of this processor. It can play songs saved in .YM file format on a standard SD or MMC card. These .YM files can be obtained wiht most part of Amstrad CPC, Spectrum ZX or Atari ST emulators. Other vintage computers audio file formats can also be converted to .YM standard. So you only have to capture the melody of your favorite videogame, or demo with one of these emulators save it into the memory card, and play it with -hard plAYer-. You can also use one of the many trackers that exist for these computers to compose your song with the emulator. It has a graphical interface wich allows you to control it's different options and also to explore the content of the card to select the song you want to play.



If you are interested on building one, and have skills on electronics, in this page you will find the hardware schematics, the firmware, and the most important steps I followed to build one ( remember that t is not a "buy components and solder" project! ). I'm also planning to make a new improved PCB, and probably I will sell some finished units to those people really interested on having one.



Remember that downloading or using any information here exposed implies accepting the project conditions. These are some of the features of this audio player:



-music is played by a real AY-38912 Programable Sound Generator

-nearly everything is controlled through a monochrome 128x64 LCD graphical display with a 4 push-buttons interface

-can play unpacked and deinterleaved YM files, stored in a SD or MMC card formatted in FAT32

-has a tiny file explorer to move through the folders to select the song to play

-simple audio looping options

-playing speed can be adjusted

-the independent channel volume knobs allow the user to control the A,B,C channels volume

-a MIDI input port is available to use the board as MIDI synthesizer ( it has also a MIDI output port )

-stereo RCA or stereo mini jack output connectors hard plAYer intro hard plAYer overview video The first step before starting to build anything was thinking about the objective of the project. The aim was to build a MIDI synthesizer based on the AY-38912 PSG, but I thought that probaly would be better to start with an easier project: I would develope the whole hardware, but instead of programming the MIDI synthesizer firmware, I would start developing an YM files player, this would also allow me to check the board possibilites. The YM player had to be an easy to use device, able to play 80's computers tunes. It also had to allow the user to control some basic audio features of the melodies, like the speed, channels volume... to let him play a bit with the sounds. The tunes should be stored in a standard non volatile memory support in an easy way for the user. Once the most important features were defined, it was time to start to design the system. I would need:



-the AY-38912 Programable Sound Generator:

I obtained it from an old not working Amstrad CPC 464. I decided to use the PSG with an 1Mhz oscillator, the same used in the Amstrad CPC computers. Atari ST used an 2Mhz xtal, and ZX Spectrum a 1,7734Mhz xtal. The only consecuence of this election is that Atari ST or Spectrum ZX songs sound a bit lower than usual, nothing more. Replacing it by a 2Mhz or 1,7Mhz xtal would be enough to make the PSG sound exactly the same than in an Atari ST or a ZX Spectrum.



-the non volatile memory to store the audio files:

There were a lot of options, but probably the most practical for the user would be to use a standard comercial memory card like Compact Flash, Memory Stick or SD. Finally I decided for SD or MMC cards, due to the fact that they are very extended, cheap, and quite easy to interface.



-the graphical interface and push-buttons to allow the user to interact with the system:

After looking for diferent models, and check their prices and features I decided for a gaphical 128x64 LCD display based on the Samsung S6B0725 contoller, It would take some I/O ports of the microcontroller but It seemed to me easy to work with it. About the push buttons, as there are a lot of different models, and as they can be easily found in all electronics stores, I decided to use the buttons that came mounted on the LCD board, and replace them latter by better ones.



-a MIDI interface:

To implement the MIDI input I would use a 6N137 optocoupler conected to one of the microcontroller's USARTs. This IC is for adapting the MIDI singal levels to the microcontroller's TTL standard.



-an RS-232 interface for console and debugging purposes:

For the RS-232 channel I would only need to connect the Tx and Rx lines to one of the microcontroller's UARTs using a standard MAX-232 transciver to adapt the RS-232 signals to TTL.



-a microcontroller with enough RAM, program memory, and I/O ports:

I would have lliked to use a powerfull 32 bits microcontroller to work without resources constraints, but It was difficult to me to get units of these microcontrollers and the tools to work with them. So I had to decide for one of the most extended 8 bit microcontrollers families: PIC or ATmega (8 bits, off course!!!). It is quite easy to find units of this micros and there are, also, a lot of free programming tools on the Internet. Both of them would have been usefull for the purpose of this project, but I finally decided for the ATmega family because I have a good know-how of this family devices. The choosen model was the ATMega64. I did a first estimation of the resources I would need, and found that this microcontroller had all what I needed:



- 64Kb of program memory

- 4Kb of RAM memory ( not too much, but enough )

- 2 USARTs ( one for the RS232 and the other for the MIDI)

- 1 SPI to interface the memory card

- and enough IO ports to interface other elements like the graphical LCD or push buttons



-the power supply and regulators to power all the elements:

All the choosen electronic components worked at 3.3 V except the AY-38912 which needed 5V. This made me add 2 power supply circuits, one for the 5V and the other for the 3.3V. There is an 3.3V ATmega64 version, but as I would have to add the 5V power supply, and it was easier for me to get the 5V version I decided for that one.



To simplify the design I decided to use the very simple and standard powering circuit based on a 5V lineal regulator, and then connect a low drop output second regulator to the output of the first one. Using this kind of components is not the most efficient solution: it would have been more efficient to use any kind of switching regulator, but It was the simplest solution. And as the evice was not going to be used with batteries it wouldn't supose any consumption disadvantage.



Anyway, lineal regulators are still frecuently used in audio aplications due to the fact that they do not add noise in the circuit wich may cause interference in the audio signals quality. So after checking the consumption of the selected components found that the tipical LM7805 and the LM317 would be usfeull to get the 5V and the 3.3V I needed, but despite they could provide much more current that the components would consume, they would need good heat-sinks to avoid overheating.



- signal level adaptors:

Using 5V and 3.3V components made me also add level shiffting latches to adapt the signal levels between elements like the microcontroller and the LCD or the SD/MMC card.



In the "Design and schematichs" section you will find the detailed parts list. General view Top view Bottom view The audio mixer Deatil of the AY-38912 PSG Perspective view of the - hadr plAYer - Front view of the - hard plAYer- Rear view of the - hard plAYer - After had chosen all the components, I did the schematics. Here you have them. I wont post the gerbers I used because they were not correct at all and I had to do some wire wrap corrections at the end. I have to do new ones with these corrections. Anyway, as It is not an "easy project" I prefer you do your own gerbers, because It will mean that you really know what you are doing. Microcontroller, AY-38912 module, SD card and LCD (click over the image to enlarge ) MIDI interface, RS-232 interface and 5V to 3.3V level adapting latches

(click over the images to enlarge ) Audio mixer and power circuit (click over the image to enlarge )

(Download the parts list here) Hadware general view video Completed, being used

The whole firmware was developed with the free development enviroment WinAVR. It includes a lot of usefull tools, the most importants on my opinion: the gcc compiler for the 8 bits Atmel microcontroller family, a good programing IDE named Programmers Notepad , and the programming tool AVRDude which allows you to program the microcontroller in a very fast and easy way through the parallel port ( check the AVRfreaks web, you will find there a lot of tools) . You can download the firmware here. It is organized in diferent modules. Each module includes the necessary functions to control an specficic device or to execute some specific tasks. Each of this modules has a main motor routine which executes the different tasks of the module. This main motors are called from the main motor of the main module. If you take a look to the project files you will find these modules:



- ayfwre: is the main module of the firmware, and is from here where all the other modules are continually polled.

- ay3891x: controls the AY-38912 PSG. Some of it's routines allow the system to reset, or execute read or write operations over the PSG registers. It also takes control of the song stream of bytes comming from the memory card with the YM file information. Those bytes are sent to the PSG when necessary.

- sdc: is the module which interfaces the SD and MMC cards and allows the upper firmware levels to access to these non volatile devices where the songs are stored. It includes all the low level initialization, read and write routines. All these operations are done through the microcontroller's SPI (these cards can be accessed in a SPI mode).

- fat32: implements the Microsoft FAT32 file system over the memory cards. So, this module allows to use the SD or MMC in a standard PC, save the YM files there, and then use it in the -hard player- with it's file explorer. Only FAT32 read operations are implemented.

- interface: with the source code that implements the file explorer and other menú options. It also contains the routines which read the push buttons state, and the debouncing algorithms.

- LCD: includes all the routines necessary to control the LCD graphical display.

- Timers: with the timming control functions.

- UARTO: implements the serial port debugging routines. Click here to downolad the firmware Some LCD display snapshots Video of the user interface



There are a lot of good YM collections in the Internet, but you can also create your own with an emulator. As I am an Amstrad CPC fan, I decided to use, As explained above, the -hard plAYer- plays YM files. The YM file format was designed by Aranud Carre some years ago. There are different versions of it (YM2, YM3, YM4 and YM5) all them are packed and some interleaved. So, to play a file, it has to be unpacked first, and deinterleaved then. This task would take a lot of microcontroller resources, process time, and memory ( ATmega64 only has internal 4Kbs ). So, to avoid overloading the microcontroller, the files have to be saved in the memory card unpacked and deinterleaved. I developed a very simple PC application (YMunde) based on StSoundGPL which takes a standard YM file and unpacks and deinterleaves it. Files generated by this tiniy application are still compatible with most part of YM players like the StSound.There are a lot of good YM collections in the Internet, but you can also create your own with an emulator. As I am an Amstrad CPC fan, I decided to use, CPCE , an Amstrad CPC emulator. It works very well and also has an option to capture it's audio in the YM format. So I loaded my 80's favorite games and saved some songs. I also tested some CPC trackers (StarkOS is the best on my opinon) and composed some tunes. After saving the YM files, I had to use YMunde to unpack and deinterelave them, then they were ready to be saved in the memory card and being played in the -hard plAYer-.

- The 8 bits people music comunity

- Blip Festival 8 bits music festival in New York

- MicroMusic comunity

- MicroBCN, Barcelona's MicroMusic group These are some interesting links related to the 8 bits music and 80's computers scene: Using any information, schematic or source code here exposed means accepting these conditions:

- License: This software and hardware is freeware and any work based on it may be distributed without charge. The copyright and any intellectual property relating to this information remain the property of the author. - Disclaimer of Warranty: Unless required by applicable law or agreed to in writing, author provides this software and hardware on an "AS IS" basis, without warranites or conditions of any kind, either express or implied, including, without limitation, any warranties or conditions of title, non-infringement, merchantability, or fitness for a particular purpose. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. - Limitation of Liability: In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall the author be liable for any damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the software (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if the author has been advised of the possibility of such damages. ... Label, Program & Audiovisuals (c) Tolaemon 2007-2008...