Echo
Echo is a new sound-engine for the Mega Drive created by Sik. It's Zilog Z80-based and allows full control over the sound hardware. Its purpose is to provide a free, open-source possibility to implement music and sound effects in programs, demos or games developed for the system. It is currently in beta state, albeit functional for the most part. Echo's current version number is 0.8 beta.
It was used and tested in a few projects already, such as:
- MDEM's first (Mega Drive Demo)
- Used Echo v0.3
- In A Hall (32kb executable music release)
- Used Echo v0.3
- Project MD (homebrew Jump'n'run game for the Mega Drive)
- Currently using Echo v0.8 beta
Contents
Specifications and features
- Supports background music and sound effects at the same time
- Sound effects do channel locking, meaning when they play, SFXs have priority above BGMs (channels unused by the SFX will continue to play normally in the BGM)
- Support for all FM and PSG channels
- All PSG Noise types supported
- PSG volume envelopes supported (similar format to SMPS's PSG envelopes, but Echo's support looping)
- PCM support
- PCM playback rate is precisely 10.650 KHz -- The 2Hz difference between PAL and NTSC can be ignored.
- Locking and Unlocking of FM 6 is automatically managed. PCM has priority.
- FM Stereo support
- Supports looping and non-looping BGMs, with a custom loop point
- Variable tempo mid-sfx or mid-bgm, as a delay command can have any amount of tics.
Echo Formats
Echo Stream Format (ESF)
The Echo Stream Format (ESF) ìs a headerless music and sound effect format used by Echo. It contains commands and instructions that are read by Echo and passed onto the sound hardware. It has an extensive amount of commands / instructions, and thereby has its own article describing it.
Echo Waveform Format (EWF)
The Echo Waveform Format (EWF) is the format used by PCM samples. There isn't much to it, as PCM data is stored as unsigned 8-bit, at 10650Hz mono. The bytes specifying the waveform data contain values ranging from $00 to $FE. A byte with the value of $FF indicates the end of the PCM sample.
Echo Instrument Format (EIF)
The Echo Instrument Format is the format used for FM instruments in Echo. EIF instruments are essentially raw dumps of the YM2612 registers. They consist of 29 bytes, where each byte belongs to a different YM2612 register. The registers are stored in the following order (assuming the first FM channel):
$B4 -- Algorithm and feedback $30, $34, $38, $3C -- Multiplier and detune $40, $44, $48, $4C -- Total level $50, $54, $58, $5C -- Attack rate $60, $64, $68, $6C -- Decay rate $70, $74, $78, $7C -- Sustain rate $80, $84, $88, $8C -- Release rate and sustain level $90, $94, $98, $9C -- SSG-EG
Some bits are unused and ignored by the YM2612. In an EIF instrument, they *must* be 0, since Echo will rely on this for optimization purposes.
Echo Envelope Format (EEF)
The Echo Envelope Format (EEF) is the format used to describe volume envelopes for the PSG channels in Echo. This format was kind of an afterthought. Later it may be improved to provide at least some kind of RLE-like compression, but for now, this is it.
EEF instruments consist of a list of volume levels. Each byte represents a different volume level, and the value ranges from $00 (loudest) to $0F (quietest). Each byte represents one tick (i.e. 1/60th of a second), and looping is possible. The start of the loop is marked by a byte with value $FE, while the end of the loop is marked by a byte with value $FF. There must be at least one volume byte between them or Echo will hang. To make a non-looping PSG instrument, just put the last volume value inside the loop.
Also, since PSG instruments are required to use PSG channels and many people do not want to mess with them at all, here's a flat PSG instrument (i.e. no envelope): <code=asm>
$FE,$00,$FF
</code>
Tools
pcm2ewf
pcm2ewf is a program that converts raw 8-bit mono PCM files to the slightly different format used by Echo (EWF, see above). It can be downloaded from Sik's Tools repository.
tfi2eif
tfi2eif is a program that converts files from the TFM Music Maker FM instrument format to the instrument format used by Echo (EIF). It can be downloaded from Sik's Tools repository.
xm2esf
xm2esf is a program written by Oerg866. At the moment it is the only program available and working that can produce ESF streams. It is, in addition to that, by far the most advanced Mega Drive music tool available today that produces real-time usable output (ESF). To enable the user to enjoy the comfort of any XM tracker he is used to, the program takes XM files as input, and outputs a stream readable by Echo. The tool is very advanced as it supports all major XM effects, such as:
- 0xx (Arpeggio)
- 1xx (Portamento Down)
- 2xx (Portamento Up)
- 3xx (Tone Portamento)
- 4xx (Vibrato)
- 8xx (Set Panning, hint: only left, center or right)
- Axx (Volume Slide)
- Cxx (Set volume, very accurate formulae used to calculate volume for FM and PSG)
- Dxx (Pattern break, always interpreted as D00)
- Fxx (Sets amount of delay per row to the amount specified in xx)
Hint: keep in mind that to make the ticks per row ("speed" in some trackers, default is 6) match Echo tick's length, set "Tempo" to 150!
Xm2esf uses an inputfile called xif. It is short for XM information file. It contains parameters, channels, instrument assignments, channel transposes, channel volumes, noise type, etc. taken into account when converting. Distributed with xm2esf is a program called xm2eifgui. It is a frontend for creating the necessary XIF files for conversion.
To compare: xm2smps, xm3smps and xm4smps were not able to use any XM effects other than Dxx. This is why music can be created much faster and easier with echo than it can be done in any other accessible (be it free or reverse engineered) sound engine today.
For now, this program runs on Microsoft Windows (or Linux and Mac OS with WINE et al) only, however, it is currently being ported to C++. When this is done, native Windows, Linux and Mac OS binaries will be available.
Xm2esf is currently in beta stage at version 0.99.x, and is available from GitHub.
esfopt
Esfopt is a small program written in C++ by Oerg866. It takes an ESF stream as an input file, and outputs an optimized file.
The tool is capable of achieving the following:
- Removes redundant note-on events
- Fusions multiple delay-events into one
- Removes redundant load-instrument events
- etc.
It can be downloaded from GitHub
Links / Download
- GitHub repository for Echo, including docs, source, binaries, etc.
- GitHub repository for xm2esf, including necessary files and tools.