PSGTRACKER PSG FILE FORMAT

From MSX MUSIC WIKI
Jump to: navigation, search
                    PSGSTRACKER .PSG FILE FORMAT

ABOUT:
------

This is an analized documentation of ".PSG" file format, which is used in "PSG Tracker" made by Flying Bytes in 1992 and declared as freeware in 2005. Now it downloadable in MSX Resource Center(https://www.msx.org).

Disclaimer:
-----------

This is an "analized documentation", so It means "not official". We can't give no warranties for informations on this document. Use it at your own risk.

This document uses some utf-8 symbols to express sprcific instructions of PSG Tracker.

AUTHOR & CONTACT:
-----------------
KUMO(tw:@kumokosi)

HISTORY:
--------
2019/4/9 Ver 1.0 Initial version(simple text)

-------------------------------------------------------------------------------

FILE SIZE:
----------

10263 bytes(fixed size)
    7 bytes(same as BSAVE header)
    16 bytes(preset data)
    10240 bytes(music data)

BSAVE header[7bytes]:
---------------------
+00h
"FEh" for BSAVE header[1byte]

+01h - 02h
Start Address [2bytes]

+03h - 04h
End Address [2bytes]

+05h - 06h
Execution Address [2bytes]

Preset data:[16bytes]
------------
+07h STEPS per track
 ex:
  10 = 16STEPS
  20 = 20STEPS

+08h - +0Ah VOLUME for channels(Ch1,Ch2,Ch3)[3bytes]
 ex:
  0D 0D 0B ->V13,V13,V11

+0Bh - 0Fh Detune for channels(Ch1,Ch2,Ch3)[2bytes x 3ch = 6bytes]
 ex:
  00 00 ->Detune for Ch1 is 0
  00 00 ->Detune for Ch2 is 0
  FF FF ->Detune for Ch3 is -1

+10h Pattern[1byte]
 ex:
  09h -> Pattern2
  08h -> Pattern1

+11h - 12h Length[2bytes]
 ex:
 00 14 -> Length20(14h)/0

+13h Speed[1byte]
 ex:
  2Dh is Speed 45

+14h - 15h Terminator of preset data?[2bytes]
 "01 00"

Music data:[10240bytes]
------------

Every 4 bytes means instructions for "Ch1 Ch2 Ch3 ChR".
Instructions of Ch1-Ch3 and ChR are different.

10240 bytes of Music data does not have boundary devided by trackes. Maximum track number can be culculated by dividing 10240 with "STEPS per track" in preset data.

 ex:
  10240/16 Steps -> 160 Tracks(0-159)
  10240/20 Steps -> 128 Tracks(0-127)


------------------------
Instructions for Ch1-Ch3
------------------------
Musical Notes:

  C1=01h
  ...
  C2=0Dh
  ...
  C3=19h
  ...
  C4=25h
  ...
  B7=54h

  Note Off= 55h

Volumes:

  V0= 56h
  ...
  V15=65h

  VAR=66h

Pitch bend:

  ↑1=67h
  ...
  ↓1=70h
  ...

  ↕ 0=7Fh

Channel ON/OFF

  CHN=79h (Channel ON)
  CHF=7Ah (Channel OFF)

Detune:

  DT+=7Bh
  DT-=7Ch

Beat ON/OFF

  BTN=7Dh
  BTF=7Eh

--------------------
Instructions for ChR
--------------------
b 7 6 5 4 3 2 1 0
  | | | +-+-+-+-+- "Frequency"
  | +-+----------- "R", volume synchronize channel
  +---------- unknown bit but fixed to 1?
*When R=0, it means like mute or note off.

 ex:
  R1,- =A0h = 1010 0000
  R2,- =C0h = 1100 0000
  R3,- =E0h = 1110 0000
  R0,- =80h = 1000 0000

  R1,FQ01 =A1h = 1010 0001
  R2,FQ08 =C8h = 1100 1000
  R3,FQ16 =F0h = 1111 0000
  R0,FQ31 =9Fh = 1001 1111