The Oric computers are equiped with a AY-3-8912 sound chip.

This component can be found in multiple variants in many other systems such as the MSX, Amstrad CPC, Atari ST, some of the Sinclair Spectrum machines, among other.

It is an unfortunate fact that only very few Oric games had music back in the 80ies, but this can be fortunately fixed today thanks to the huge catalog of available musics on the other machines!
YM Files
The YM file format was originally designed by Arnaud Carré as a way to record Atari ST musics to make them replayable on a PC.

Technically a YM file is simply a register dump of the music: A program captured 50 times per second the content of the values sent to the YM chip. With 14 registers to record, 50 times per second, it means that one second of music takes 700 bytes, so roughly 42kbytes per minute of music.

The chosen solution was to store the data sorted by register number, and then compress the whole file with the LHA compressor, which typically reduces the music files to less than 10kb even for very long musics.

Unfortunatelly this means that the music file must be entirelly decompressed before it can be used, which makes it unusable on 8bit machines. That's where the MYM format comes in.
MYM Files
The MYM files are basically YM files that have been uncompressed and recompressed in a way that allows for partial decompression over time. The efficiency is not as good, but at least it works.

Ym2MYm can be used to perform this conversion. It will work only on YM files that do not use special timer effects such as digidrums or sid.
There are multiple machines using variants of the AY or YM soudchip, but they don't all use the same clock frequency: If you attempt at replaying a music made originally for another machine, and if it had a different clock, the resulting music will play at a different frequency than the original.

If you want to preserve the original sound of the music, it is necessary to retune the register values so they compensate for the difference in frequency. In YM2MYM this is simply achieved by declaring the frequency of the source machine (using -r) and the one of the target machine (using -t).

Originally the tool was made to play Atari ST musics on the Oric computers, so by default, the tool will assume a 2MHz source clock and 1MHz target clock, but you can specify any arbitrary value.

For reference, here is the known clock speed of a few machines:
  • Oric: 1 MHz
  • Amstrad CPC: 1 MHz
  • ZX Uno: 1.75000 Mhz
  • Pentagon: 1.75000 Mhz
  • Timex TS2068: 1.764 MHz
  • Sinclair Spectrum 128: 1.77345 MHz
  • MSX: 1.7897725 Mhz
  • Atari ST: 2 MHz

Due to the fact that the soundchip registers have a specific range of valid values (from 0 to 4095 for the notes, from 0 to 65535 for the enveloppe duration and from 0 to 31 for the noise frequency), it is possible that the retuning results in a value being out of range, which obviously will also impact how the music sounds.

When this happen, the tool will display some warning message indicating how often the truncation happened, and how bad the truncation was. If you are lucky you will not notice, but the tool will also indicate at which position the worse case happened, so you can eventually tweak the tune.


Found some clamping issues when retuning "data\Great Giana Sisters 1 - title.ym"'s 
frequency from 1MHz to 1.7734MHz at 50fps:

- 'Channel A' overflowed 560 times (maximum was 5077 [over 4095] at 
time position 3'17" (frame 9858)

- 'Noise Channel' overflowed 5070 times (maximum was 54 [over 31] at 
time position 0'27" (frame 1376)

As a final note, we'd like to point out that if technically speaking the AY and YM chips are register compatible and behave mostly the same, they are not identical chip, so in practice the same music can sound different depending on how it uses volume changes and enveloppes:

  • Note transitions seem smoother on the YM (thanks to the higher internal accuracy)
  • The output from the AY is louder.
  • The YM output is cleaner

To transform a binary file as a texte file:

%OSDK%\bin\Ym2Mym [switches] source.ym destination.mym [load adress] [header name]
  • -rn Reference Clock
    Sets the reference clock speed used on the machine for which the YM music was originally made for.
    • -r1 => Oric, Amstrad CPC
    • -r1.77345 => ZX Spectrum
    • -r2 => Atari ST [default]

  • -tn Target Clock
    Sets the target clock speed used on the machine for which the MYM music is to be replayed on.
    • -t0 => Use Reference (no retune)
    • -t1.0 => Oric, Amstrad CPC [default]
    • -t1.77345 => ZX Spectrum
    • -t2.0 => Atari ST

  • -vn Verbosity
    Enables or disable the printing of informative messages.
    • -v0 => Silent [default]
    • -v1 => Shows information about what Ym2Mym is doing

  • -hn Header
    Adds a tape compatible header
    • -h0 => No tape header [default]
    • -h1 => Use tape header (requires a start address and a name)

  • -mn Max size
    The MYM replay routine generally is provided with a limited size for the music. Using this switch you can force Ym2Mym to refuse to convert a music and output an error message if the final compressed file gets larger than the specified number.
    • -m0 => No size limit [default]
    • -m1234 => Outputs an error if the exported size is too large

  • -dxn Duration mode
    You can use this flag to force the tool to truncate the music after a specific number of frames (there's 50 frames in a second). Use -dt to truncate, and -df to fade.
    • -dt1234 => Truncate at frame 1234
    • -df1234 => Fade out at frame 1234

Known issues

Reported by Iss the Sun 19th March 2017

Issue #15: Add advanced commands to the format
Details: to add possibility for simple "in-music" commands like "jump to_xxxx-th_vbl_frame" and "loop 3_times_next_xxxx_vbl_frames". Additionally having such "commands" can help for reducing the size of the YM data (See: topic)

Resolved issues

Reported by Mike van der Lee the Fri 17th January 2020
Fixed in OSDK 1.16

Issue #35: Support variable frequency retuning
Details: As the mym format became quite multi-platform with players also available for the ZX Spectrum and MSX, it would be great if Ym2Mym could also be used for those platforms so people with real machines can enjoy the tunes of other machines.The sound chip frequencies differ between machines though and the converter already supports converting between 1000000 Hz for Amstrad CPC and 2000000 Hz for Atari ST (-t0 & -t1 parameters).

It would be fantastic if it could also support those other machines' frequencies; 1773400 Hz for the ZX Spectrum (the MSX one I couldn't find).

The way it works now is that the CPC is assumed as a target by default, with the possibility to override this for the Atari ST to be the target.

I think a flexible way would be if a parameter would be supported with which the f requency of the target machine could be specified.

Thank you very much in advance from everyone :D

Reported by Peacer the Sat 20th December 2014
Fixed in OSDK 1.6

Issue #5: Option to truncate long YM files
Details: Is it possible to make YM2MYM.EXE truncate the data and stop if music is too large?There are some long .YM musics, when converted to TAP file and loaded they reach the screen memory and even character definition.Maybe YM2MYM can produce .TAP file where data is not exceed after #A000.I know there's an option to define file size but this is just for 'not' using big sized files.

comments powered by Disqus
Coverity Scan Build Status
Version 1.8
  • Modified the semantics of the -t flag (now means Target Frequency) and added a -r flag (Reference Frequency) which both accept decimal values (like 1.0, 2.0 or 1.77340)
Version 1.7
  • Added a -f flag that can be used to export the music to WAV format instead of MYM
Version 1.6
  • Added a -d flag that can be used to shorten a music: '-dt' truncates the music, '-df' fades it out. (example: -dt50 will cut the music after 1 second - 50 frames - )
Version 1.5
  • The verbose mode (-v1) now displays the embedded informations such as author name, song name, and extra comments
  • Interleave register format is now also supported
Version 1.4
  • Fixed a stupid bug of signed data added in version 1.2
Version 1.3 (Broken!)
  • Added a -m flag to check if the exported file fits a maximum size
Version 1.2 (Broken!)
  • Added a -v flag to enable/disable verbosity
  • Added a -h flag to add a tape compatible header
Version 1.1
  • FThe tool is now able to extract LHA compressed YM files directly, should make the process much easier :)
Version 1.0
  • Added support for retuning (Atari ST songs are at 2mhz, Amstrad ones at 1mhz)
  • Added rude support for YM6 format (also skips most of the header)
Version 0.2
  • Added a rude YM5 loader. Skips most of the header.
Version 0.1
  • First version by Marq/Lieves!Tuore & Fit (marq@iki.fi)