MOD-player 2

>>>> WARNING: very poor translation!!! <<<<

   This project is extended MOD-player 1. I've added IDE interface for IDE P-ATA HDDs or CF cards instead of external EEPROM. HDD (or CF) works in LBA mode and maximum usable capacity for songs is some 128MB (it's around 255 0.5MB songs). It can store up to 255 songs received via COM port or virtual USB-COM with FT232. With FT232 the transfer speed is about 1.25Mbit/sec.

Basic parameters

Sampling-rate: 22321.42 Hz
Channels: 4 (mixed into stereo)
Instruments: 15 or 31
Reasampling mode: linear interpolation
Max. songs in file system: 255 and less than 128MB


   At first I want to use ATmega64 instead of ATmega32, but there is enough pins for IDE interface on ATmega32. Only 16 pins for data, 3 pins for addressing and 2 pins for clocking (RD/WR). I'm using 16-bit communication mode, because old 8-bit IDE transfer mode is almost not supproted. Data pins D0-D7 are connected directly to portc, higher 8 data pins are connected to porta. 3 addressing pins for IDE device register selection are connected to extension buffer IC3. SRAM is connected just like in old version - the lower 8 addressing bits are connected directly to porta, higher 8 bits are connected via extension buffer IC2 and the highest bits are connected together with HDD address pins via buffer IC3.

   FT232 is connected in standard mode (don't forget to install drivers from FTDI). You can use standard COM, but you have to change baudrate in MCU FW. You can choose 2 kinds of D/A converters. First is standard I2S bus (TDA1543). It has bigger power consumtion and noise. The second one is something called "Japanese standard bus" (TDA1545). Actualy it's I2S with WS signal delayed by one clock and it's simpler to emulate this via SPI.


   After the power is connected, LCD shows IDE identifier, CHS and expected capacity. If there is no IDE drive, the player works only in USB/COM mode. It means that you can upload file into RAM and play it. If the IDE device is connected at first time, the player will ask you for formatting. You can choose "Format" (create allocation table (not FAT12/16/32 - it's only my experimental format)) or "Znovu" (try to load FAT again) or "Bez HDD/CF" (no IDE device). Every time the FAT is initialized, the FAT is send via COM to the PC. If formatting/nothing is done, the LCD displays songs count and their size. After that, player waiting for data or starts playing the first song.
   If you want to upload new song, you have to press "COM" button and then send file via USB/COM. Data transfer have to start in 2 seconds after "COM" has been pressed. If the upload is done, the song is stored in SRAM and it start playing. If you want to store the song on the HDD press "SAVE". If there is enought space, the song is stored in the first gap in FAT. If there is not enought space, the LCD dislpays why.
   There is also erase function - if you want to erase song, press "MAZAT". Player will ask you to the action. "Skladbu" means that player will erase the current song. "Vse" means that player will erase all songs. "Inf" will display some capacity info and "Nic" will do nic ... I mean nothing. :-)
   Buttons "SKLADBA +/-" are used for selecting song. "LIST +/-" is for fast FWD/REW. "PAUSE" stops playing.

Firmware for MCU

   The FW is written in assembler and it is about 4600 lines long and only 9,5kB in size. File system is only experimental. Every file start address and end of file is defined by the two 16-bit values in the FAT coll. FAT begins by the "Tab0" identifier. there is nothing like fragmentation, so if you erase file, there is gap in the data and if new song is bigger, the gap will be there forever.
source code for this player (for TDA1545 and TDA1543).

Effects and formats

   This player can play old MOD files with 15 or 31 instruments and 4 channels. 31 instruments file has identifier "M.K.", "M!K!" or "FLT4" at offset 1080. Other formats are incorrectly identified as 15 instruments and the player can not play it (it will play ... who knows what).

Supported effects
0 Arpeggio full support
1 Portamento up usually full support
2 Portamento down usually full support
3 Tone-portamento full support
4 Vibrato full support
5 Tone-portamneto + Volume slide full support
6 Vibrato + Volume slide Vibrato no, Volume slide full support
7 Tremolo no
8 Panning no
9 Sample ostart offset full support
A Volume slide full support
B Jump to other pattern no
C Set volume full support
D Jump in the pattern yes, byt only breaks pattern
E0 Set filter I don't know what the hell is this
E1 Portamento up slowly full support, but not exactly
E2 Portamento down slowly full support, but not exactly
E3 Glissandro no and never will be!
E4 Vibrato waveform no
E5 Fine-tune no
E6 Pattern loop no
E7 Tremolo waveform no
E9 Retrig note no, because it's a bit complicated
EA Volume slide up slowly full support
EB Volume slide down slowly full support
EC Cut note no
ED Note delay no
EE Pattern delay no
EF Invert loop hell no
F Set speed/tempo full support

Here are a few sample records from MOD-player

   There is recorded sound in MP3 and original file in each zip.

(c) 2006-2007, Stanislav Mašláň - All rights reserved.

Last update: 7.11.2007