YM

Often it's difficult for a newbie or not Atari/Amiga/Old PCs literate to find out exactly what file format they are looking at and trying to playback, and the case with YM format is especially relevant. Reading various sources around the net, it looks like there's an ambiguity about the YM file format specs and its file extensions.

In 1997 Nicolas Pomarede (a.k.a. Mr.Styckx) writes an emulator for the YM2149 sound chip - the sound generator chip incorporated in the Atari ST systems, but also on other systems like ZX Spectrum, Amstrad CPC and probably more. "... Amstrad CPC or ZX Spectrum ... computers used the AY version of the chip, which had the same registers, but a different clock speed". His primary goal is porting the original, unmodified Atari ST tunes (just Atari ones) to Amiga. The result is "MYST, The YM2149 ST Emulator". At the same time he builds up the custom format for the sound files targeted for the emulator - YMST. Although the files itself hold the Magic ID of "YMST" at the start (byte offset 0x00), the file prefix/extension given is "YM".

Cite from the emulator's main doc, regarding the file format (although vague):

" MYST also provides a general header interface, useful to store informations about the composer, the number of songs, the replay time, ... as well as a general mechanism to init and play absolute addressing replay or music with replay and data in different files. This header can be used on both Amiga and ST, so you should be able to play all the musics included on Atari ST also (see YMST.format for possible restrictions on musics using timer). Since the header allows for hardware abstraction, this could also be a good way of playing these tunes on PC (you would need a 68000, but you wouldn't have to care about hardware addressing specific to the ST).

The header allows 3 types of music files : - internal replay : replay and data are stored in the same file. - external replay : the file is only a replay, used to play specific data file. Useful for musics sharing the same replay. - music data : only the data. The file contains the name of the required replay (should be in the same directory).

The goal of MYST is to provide a suitable interface to collect and play all available songs, thus creating the biggest ST musics collection ever. All musics are stored in their original format (that is exactly the same as what the author wrote) to ensure the maximum respect of the author's work ; all patching and relocating occur after. This means that if you don't like MYST at all, you can extract the original replay and music data from the MYST file, and you will obtain absolutely the same data that was in the game or demo the music comes from (so it should always be possible to play the music on ST in case the header doesn't work). "

Although the mentioned "YMST.format" (or should it now be "format.YMST", as files on Amiga system actually use a prefix extension as opposed to the extension suffix on the more modern systems) is nowhere to be found (as of April 2016), thus the format details being somewhat unclear, the format is referred to as "MYST ST-YM" format. However, from the aforementioned cite it's obvious that the YMST format share similarities with the SNDH (Atari SoundHeader) format: it consists of sound data, code (initialization routines, play routines etc.) and header (meta info, song index etc.) all in one file.

It's unknown when Arnaud Carré (a.k.a Leonard) also creates an emulator for the YM2149 sound chip. It's called "ST-Sound". And he also creates some different, custom chip sound file format for the files, targeted for this emulator - YM. He just wants to provide a way of transferring the music taken from the source system, be it Atari, Amstrad, Spectrum or whatever other hardware system, which happens to be equipped with Yamaha YM2149 sound chip. The target system of the emulation is MS Windows on any PC compatible hardware. Unfortunately (or maybe not?) the extension given for this "new" file format is the same - "YM", although internally the files begin with Magic ID of "YM0" .. "YM6", "MIX" or "YMT" at the start (byte offset 0x00). The same extension only adds to the confusion of determining the exact format and the required players/libs for play back/processing, because of which such files as well as format itself are referred to as "ST-Sound YM" files/format.

Cite from the author's site, regarding the ST-Sound YM file format:

" YM6 Chiptune format

... YM is only an YM2149 Chip emulator, not a true MC68000 emulator. YM files does not contain any 68000 code routine. A music-file is composed of YM2149 registers dump generated by the original play-routine (from the original machine: ATARI, AMSTRAD, SPECTRUM and all kind of machine with an Yamaha YM2149 sound chip)... So YM6 is just a register dump file. In chip music, sound registers are usually updated once per frame. A frame is generally updated at 50Hz. An YM6 file frame is a 16 bytes lenght frame. So just imagine you have a 6 minutes songs, in wich registers are updated at 50Hz (let's call this the "frame rate" now), you need 288000 bytes (282Kb) to store all YM registers. Quite big for a soundchip format don't you think ? Yes, but data are "interleaved" in the file, then packed with a packer. Finally, if you look at all the YM file on the internet, you'll see that YM file is generally from 1 to 10Kb... "

Therefore two big differences are obvious in regard to the MYST YM format: 1. The ST-Sound YM format file, resultant from such process (namely registry value dumping at play-time) does not preserve the original binary music data as well as the data's original structure/layout - it converts to a rendered stream of music data which is then recorded (dumped) and simply laid out (namely interleave + compress) in a different form, eliminating the chance of preserving and distributing the primary binary content driving the chip tune, essentially making it no-data-preserving format, but instead a data-conversion format. 2. The ST-Sound YM format file does not need to store additional code routines in the file for the purpose of playing the music content as all the music content is already dumped in a streamed form, making it suitable for direct rendering.

The sameness of the filename prefix/suffix of the two different formats is probably the cause of change of the MYST YM format files extension to ".ymst" on some popular web sources, adding an "-st" suffix to the initial ".ym" suffix, while ST-Sound YM format files retain their ".ym" suffix unchanged. (although the article's author is not sure about the later statement truth)

Software

 * zxtune
 * UADE

Sample files

 * https://telparia.com/fileFormatSamples/music/ym/
 * https://telparia.com/fileFormatSamples/music/ymst/

Information

 * ST-Sound YM file format
 * YM2149 emulator MYST v1.0, by Nicolas Pomarede