Echo Stream Format
From Sega Retro
The Echo Stream Format is the music and sound effect format used in the Echo sound engine on the Sega Mega Drive. It contains commands and instructions that are parsed by Echo and passed on to the sound hardware. To optimize playback process, the format is headerless. While it is not space-optimized, it is performance-optimized because resources when using the Z80 are low.
Event list
Note on
Event | Description |
---|---|
$00nn | Note on FM channel #1 |
$01nn | Note on FM channel #2 |
$02nn | Note on FM channel #3 |
$04nn | Note on FM channel #4 |
$05nn | Note on FM channel #5 |
$06nn | Note on FM channel #6 |
$08nn | Note on PSG channel #1 |
$09nn | Note on PSG channel #2 |
$0Ann | Note on PSG channel #3 |
$0Bnn | Note on PSG channel #4 |
$0Cnn | Note on PCM channel |
For $00 to $06 :
These events do a "note on" at the specified FM channel. The event is followed by a byte, which indicates which note to play. The value is as follows, where "octave" ranges from 0 to 7 and "semitone" ranges from 0 to 11:
32 * octave + 2 * semitone + 1
For $08 to $0A :
These events do a "note on" at the specified square wave PSG channel. The event is followed by a byte, which indicates which note to play. The value is as follows, where "octave" ranges from 0 to 5 and "semitone" ranges from 0 to 11:
24 * octave + 2 * semitone
$0Bnn: Note on PSG channel #4 :
This event does a "note on" at the noise PSG channel. The event is followed by a byte, which indicates what kind of noise to play. The following values are valid:
$00 ... Periodic noise, high pitch $01 ... Periodic noise, medium pitch $02 ... Periodic noise, low pitch $03 ... Periodic noise, PSG3 frequency $04 ... White noise, high pitch $05 ... White noise, medium pitch $06 ... White noise, low pitch $07 ... White noise, PSG3 frequency
When using values $03 and $07, the third square wave PSG channel controls the noise frequency. You can change this frequency using the events to change the frequency of that channel (usually you'd use event type $3A).
$0Cnn: Note on PCM channel :
This event does a "note on" at the PCM channel. More specifically, it starts playback of a PCM sample. This event is followed by a byte, that specifies an index in the pointer list indicating where's the sample data. Samples are stored as EWF (Echo Waveform Format).
NOTE: FM channel #6 will be disabled. That channel will be re-enabled when PCM playback is over (either because the waveform is over or because the channel is stopped explicitly).
Note off
Event | Description |
---|---|
$10 | Note off FM channel #1 |
$11 | Note off FM channel #2 |
$12 | Note off FM channel #3 |
$14 | Note off FM channel #4 |
$15 | Note off FM channel #5 |
$16 | Note off FM channel #6 |
$18 | Note off PSG channel #1 |
$19 | Note off PSG channel #2 |
$1A | Note off PSG channel #3 |
$1B | Note off PSG channel #4 |
$1C | Note off PCM channel |
These events do a "note off" at the specified channel.
$1C: Note off PCM channel :
This event does a "note off" at the PCM channel. This means that any PCM playback is immediately stopped. FM channel #6 is immediately enabled as well.
Set Volume
Event | Description |
---|---|
$20nn | Set volume FM channel #1 |
$21nn | Set volume FM channel #2 |
$22nn | Set volume FM channel #3 |
$24nn | Set volume FM channel #4 |
$25nn | Set volume FM channel #5 |
$26nn | Set volume FM channel #6 |
$28nn | Set volume PSG channel #1 |
$29nn | Set volume PSG channel #2 |
$2Ann | Set volume PSG channel #3 |
$2Bnn | Set volume PSG channel #4 |
For $20 - $26 :
These events set the volume of a specific FM channel. The event is followed by a byte, which indicates the new volume. A value of $00 is the loudest, a value of $7F is the quietest.
For $28 - $2B :
These events set the volume of a specific PSG channel. The event is followed by a byte, which indicates the new volume. A value of $00 is the loudest, a value of $0F is the quietest.
Set Frequency
Event | Description |
---|---|
$30nnnn | Set frequency FM channel #1 |
$31nnnn | Set frequency FM channel #2 |
$32nnnn | Set frequency FM channel #3 |
$34nnnn | Set frequency FM channel #4 |
$35nnnn | Set frequency FM channel #5 |
$36nnnn | Set frequency FM channel #6 |
$38nnnn | Set frequency PSG channel #1 |
$39nnnn | Set frequency PSG channel #2 |
$3Annnn | Set frequency PSG channel #3 |
$3Bnnnn | Set Noise Type PSG channel #4 |
These events set the raw frequency of a specific FM channel, without triggering a new note. Meant for note slides. The following two bytes specify the new frequency in the same format as the YM2612 expects. The first byte is register +$A4, the second byte is register +$A0.
Echo uses the following frequency values for each semitone:
C - 644 | E - 810 | G# - 1021 C# - 681 | F - 858 | A - 1081 D - 722 | F# - 910 | A# - 1146 D# - 765 | G - 964 | B - 1214