.ORG file structure

Dec 8, 2012 at 1:33 AM
Senior Member
"This is the greatest handgun ever made! You have to ask yourself, do I feel lucky?"
Join Date: Jun 12, 2011
Location: 0x00000000 0xC00E0FF0 0xFFFFEFD4 0xC0000000
Posts: 108
Does anyone know the file structure of .ORG music files? I would like to know, and perhaps someday I'll try to make another utility for making such.
 
Dec 8, 2012 at 1:59 AM
In my body, in my head
Forum Moderator
"Life begins and ends with Nu."
Join Date: Aug 28, 2009
Location: The Purple Zone
Posts: 5998
This is probably the best description of the format that there is
although, if I remember correctly when I made my org2ptcop converter, there may be an error in it

it is left as an exercise to the reader
 
Dec 8, 2012 at 2:07 AM
Senior Member
"This is the greatest handgun ever made! You have to ask yourself, do I feel lucky?"
Join Date: Jun 12, 2011
Location: 0x00000000 0xC00E0FF0 0xFFFFEFD4 0xC0000000
Posts: 108
Thanks. I'll get to it.
 
Dec 8, 2012 at 4:58 AM
Not anymore
"Run, rabbit run. Dig that hole, forget the sun."
Join Date: Jan 28, 2010
Location: Internet
Posts: 1369
Age: 34
You can read the source code for programs that manipulate Organya files.

http://www.cavestory.org/forums/threads/4142/
For the above, open any file that has the extension ".mint" with Notepad or any text editor and you can see it.

I'm not sure how much you're into reading source code. If you know Python then skimming a Mint file is pretty easy.
Another good idea is to look at WoC's Java ORG player and read the source. Obviously that one has to decode ORGs and then play the notes in order.
 
Dec 8, 2012 at 5:02 AM
Senior Member
"This is the greatest handgun ever made! You have to ask yourself, do I feel lucky?"
Join Date: Jul 11, 2009
Location: Texas, USA
Posts: 90
This is probably the best description of the format that there is
although, if I remember correctly when I made my org2ptcop converter, there may be an error in it
Wedge of Cheese's ORG file format description looks correct to me, and I think I prefer that description to older ones I used. Noxid, perhaps you're remembering the four posts starting here? If so, Wedge of Cheese edited the original post with the corrections discussed.

Here are some thoughts about Wedge of Cheese's ORG file format description:

The minimum volume level is still audible so it might be better if it said "0=min" instead of "0=silent".

What Wedge of Cheese calls a "resource" I like to think of as an "event". (Similar to how a MIDI file consists of events stored at certain times.) In an ORG file, a single event can store any combination of the following: a note (pitch and duration), a volume value, and a pan value. That is, each event has fields for note information (pitch and duration), volume value, and pan value. Unused fields are set to the "no change" value.
 
Last edited by a moderator:
Dec 8, 2012 at 12:14 PM
Administrator
Forum Administrator
"Life begins and ends with Nu."
Join Date: Jul 15, 2007
Location: Australia
Posts: 6211
Age: 38
Here it is:
Code:
-=============================================================================-
                     ORG File Format Description Ver 1.0
                                  by Moose
-=============================================================================-

.---------------------------.
|Table of Contents          |
|---------------------------|
| I.Foreward                |
|                           |
| II.Specs                  |
|  |--A.Header              |
|  |  |--1.File Properties  |
|  |  |--2.Instruments      |
|  |                        |
|  |--B.Song                |
|     |--1.Note Positions   |
|     |--2.Note Properties  |
|        |--a.Note          |
|        |--b.Length        |
|        |--c.Volume        |
|        |--d.Panning       |
|                           |
| III.Credits               |
*---------------------------*




I. Foreward

        This document is basically a summarized, more organized version of my 
posts at the Cave Story Fansite Forums. They were all made in the same day, 
while I was working on the specs. It wasn't really too hard to figure out the
format, especially since I was familiar with the different attributes that 
OrgMaker gave its notes. Hopefully this document will help those working in
the Cave Story community to create their own ORG-editing programs, or perhaps,
hopefully, an ORG-to-MIDI or MIDI-to-ORG converter. Even if no one reads this,
it was fun for me to make, so I hope you enjoy it.

        A few things to note: I will be signifying all offsets using the 0x
precursor, but in cases where I need to define a hex value, I will be ordering
from left to right. Keep in mind that the file itself stores these values
backwards, such that 7D0 would be the two-byte value D0 07 in the file.

        In addition, there are no buffers between sections - one goes right
into the next.




II.Specs

  A.Header
        The header of an ORG file is 114 bytes long and contains several
  different pieces of information about the file itself, as well as the 
  instruments used within the music. The header begins with the string, 
  "Org-02," followed by several different file settings. After the settings 
  are a set of  bytes defining the instruments used in the file.

    1.File Properties
            Below is a list of offsets between 0x06 and 0x11 and what 
    properties they correspond to, as well as their value ranges:

    Offset     Length        Property           Range(Hex)
    0x06       2 bytes       Tempo              01 to 7D0
    0x08       1 byte        Steps per Bar      Predef*
    0x09       1 byte        Beats per Step     Predef*
    0x0A       4 bytes       Loop Beginning**   0 to FFFFFFFF
    0x0E       4 bytes       Loop End**         0 to FFFFFFFF

    *Steps and Beats per bar cannot be set by the user - OrgMaker limits the 
     values to 8 combinations(Steps/Beats): 4/4, 3/4, 4/3, 3/3, 6/4, 6/3, 2/4,
     and 8/4. The results of any other cominations is unknown and not
     recommended for compatibility.
    **OrgMaker restricts the user to only selecting which bar to begin and end
     looping - the marker will be placed at the beginning of the bar specified.
     this, however, is dependant on the steps and beats per bar settings. 
     Values that do not begin on the first beat of a bar *will* play correctly,
     however. 

    2.Instruments
            The instruments settings of the header takes up the remaining 96
    bytes of the header. There are 16 instruments in total: 8 sounds and 8 
    drums can be used. Each instrument is represented by a 6-byte long entry 
    defining several properties. The offsets in the table below are for the 
    first instrument - simply repeat these six bytes until all 16 instruments 
    are accounted for.

    Offset     Length        Property           Range(Hex)
    0x12       2 bytes       Pitch              64 to 76C
    0x14       1 byte        Instrument         00 to 63 OR 00 to 0B*
    0x15       1 byte        "Pi"**             00 to 01
    0x16       2 bytes       Number of Notes*** 00 to 100

    *The first range is for sounds, the second range is for drums - drum
     offsets begin at 0x42.
    **Pi is a true or false value that, if true, disables sustaining notes,
     playing them only on the first beat of the note.
    ***Total number of notes in the entire file for specific instrument.
     Sustained notes are counted as one note.

  B.Song
            The rest of an ORG file is where the actual notes are stored. Notes
    are first seperated by instrument - only instruments that play any notes 
    are included. Instruments without notes do not have a section in this 
    block. Each instrument is divided into two sections: Note Positions and 
    Note Properties.

    1.Note Positions
            The Note Positions section contains a block of data whose length is
    defined by the "Number of Notes" property for the instrument - each note 
    has a 4-byte value defining the exact beat it begins on. For example, a 
    note placed on the fourth beat in the first bar of a song has a value of
    00000004 in the Note Positions block.

            Note Positions are placed in sequential order - a note with a 
    smaller value is placed before another with a larger value. Thus the note
    at 000001CD is placed before the note at 000002FF. The limit for a note 
    position is FFFFFFFF, although OrgMaker cannot display this far depending
    on it's display.

    2.Note Properties
            The Note Properties section contains four blocks of data whose
    length is defined by the "Number of Notes" property for the instrument - 
    each note has a 1-byte value in each block. Each block is arranged
    sequentially in a similar way to the Note Positions section. The first
    block defines the note itself, the second block note length, the third
    block volume, and the fourth block panning.

    NOTE: OrgMaker limits each channel so that only one note can be played on
          a single instrument at any time. Note CANNOT overlap if they are on
          the same instrument. This affects note length and position.

        a.Note
                The first block contains the actual note to be played. Each
        byte corresponds to a single note that has already been defined in the
        Note Positions section. Each byte can range from between 00 and 5F. 00
        corresponds to the C key on a very low octave, and adding 1 moves up a 
        key on the piano, including black keys.

        b.Length
                The second block contains the values corresponding to the
        length of each note in steps. A value of 00 will display a note but it
        will not be played. The range of safe values is 00 to FF.

        c.Volume
                The third block defines the volume of each note. The range is
        00 to F8, with 00 being barely audible and F8 being decently loud. 
        Values larger than F8 will play louder once, and then play at the F8.
        They will not be displayed in OrgMaker.

        d.Panning
                The fourth and final block contains the panning value for each
        note. Values can be between 00 and 0C, with 00 being full left pan, 06
        being centered, and 0C being full right.




III.Credits
        A few people who deserve credit for their work:

        -Radical R's Translations - For translating OrgMaker
        -Pixel Studios - For making Org Maker and Cave Story, duh.
        -Aeon Genesis - For translating Cave Story.
        -Cave Story, A Tribute Site (http://www.gameflaws.com/cavestory/) - For
         being a damn good fansite.
        -RuneLancer - For encourangement and inspiration to do this.
 
Dec 8, 2012 at 4:59 PM
Senior Member
"This is the greatest handgun ever made! You have to ask yourself, do I feel lucky?"
Join Date: Jun 12, 2011
Location: 0x00000000 0xC00E0FF0 0xFFFFEFD4 0xC0000000
Posts: 108
Carrotlord said:
You can read the source code for programs that manipulate Organya files.

http://www.cavestory.org/forums/threads/4142/
For the above, open any file that has the extension ".mint" with Notepad or any text editor and you can see it.

I'm not sure how much you're into reading source code. If you know Python then skimming a Mint file is pretty easy.
Another good idea is to look at WoC's Java ORG player and read the source. Obviously that one has to decode ORGs and then play the notes in order.
I saw the ORG2Text converter previously. It's useful, but I don't think I'll need it. I'm currently reading the Java source; just the file description would suffice but the source was of help, too.

I'm planning to do a WinForms application in C# that is pretty much like ORGMaker, but with added features. I'm no-go with Python :toroko2: .

EDIT: Are there any provided audio files for each and every instrument (including drum tracks) available?
 
Dec 8, 2012 at 11:41 PM
In my body, in my head
Forum Moderator
"Life begins and ends with Nu."
Join Date: Aug 28, 2009
Location: The Purple Zone
Posts: 5998
WAV100 is a packed structure of WAVs used by orgmaker that can be accessed with a resource hacker, but it's probably available in a number of other programs such as within the jar of org2ptcop or the in the org2xm program files
 
Dec 8, 2012 at 11:59 PM
Not anymore
"Run, rabbit run. Dig that hole, forget the sun."
Join Date: Jan 28, 2010
Location: Internet
Posts: 1369
Age: 34
Also WoC used WAV100 in his Java Organya Player.

(It's an external file)

Also...
you might want this...

It's a class file written in a psuedo-version of Mint, a language that is similar to Pascal, Ruby, and JavaScript.
http://pastebin.com/L5fkH71F

The class file represents the object Organya (an ORG file's contents).
 
Dec 10, 2012 at 5:23 AM
Senior Member
"This is the greatest handgun ever made! You have to ask yourself, do I feel lucky?"
Join Date: Jun 12, 2011
Location: 0x00000000 0xC00E0FF0 0xFFFFEFD4 0xC0000000
Posts: 108
Thanks, guys. I am pretty overwhelmed.

I shall try to begin doing stuff now.
 
Top