SYNTH ZONE
Visit The Bar For Casual Discussion
Topic Options
#18648 - 02/26/99 07:44 AM Korg X3 .sng file format
heicci Offline
Junior Member

Registered: 02/26/99
Posts: 5
Loc: Oulu
Does anyone know where I can get the .sng
file specs for X3? I've started a lifestyle project that aims in programming my own (X3-)sequencer for Linux. Well, MID format is a considerable alternative, but c'mon... Wouldn't it be great to save the file directly to .sng and get on the road?

Top
#18649 - 03/03/99 07:26 AM Re: Korg X3 .sng file format
Roberto Saralegui Offline
Member

Registered: 01/13/99
Posts: 31
Loc: Zaragoza (Spain)
Yes. I started with that some time ago, when I wanted to filter some MIDI messages in the sequences I loaded from SMFs. I have not made out yet all bits from it, but I was able to write a dirty program in C with which I would filter those messages. I can provide you with the main blocks of the file as soon as I write them in English. I have that information, but in a very disordered way.

At Lord Jonin's Homepage there were some links to information about the PCG format. At the time I last visited it there was nothing about SNG, but it might have changed. You can check it at:

http://www.best.com/~jonin/x3-web.html

Anyway, I'll post you a draft of the format as soon as I have something readable.
_________________________
you can e-mail me at: robertico at europe dot com.

Top
#18650 - 03/03/99 09:04 AM Re: Korg X3 .sng file format
heicci Offline
Junior Member

Registered: 02/26/99
Posts: 5
Loc: Oulu
Wow, thanks!

I checked Jonin's page the other day, but there was nothing related to the sng format.

I began to look at the mid format and got
a *bit* confused. I think I have a fuzzy clue about the variable-length-array, but...

Could you enlighten me about that too? I just
tore the web inside out and found only the same kind of mid-specs everywhere. I really don't get the idea.. Or is it too simple?
The MSB on the first byte is 0 or 1 (don't remember) and the number is marked with the remaining 7 bits. Then the last byte's MSB is the opposite to the one on the 1st bytes and... that's it?

Top
#18651 - 03/03/99 09:59 AM Re: Korg X3 .sng file format
Roberto Saralegui Offline
Member

Registered: 01/13/99
Posts: 31
Loc: Zaragoza (Spain)
Hi again; don't worry about MIDI timing info and variable lengths, it is
much more simple than that. As far as I remember, the main blocks of the
file are:

1. Header, fixed for all files. About 15 or 20 bytes long.

2. Song information. About 3000 bytes. It is divided into ten zones,
one for each song. It contains the song name, tracks initial assignments
(initial program, channel, and all those parameters you can adjust when
EDITing in SEQ mode, page 1: Send C/D, Tune, adjust, velocity window, key
window, etc...). There is something duplicate about MIDI
channels which I did not clear completely yet. They appear on two different
zones, and the one I had to edit with SNGs created from SMFs was just
one of them.

3. Pointer zone. More about this later. Length: 17 tracks x 10 songs x 2 bytes
(yes, 17 tracks: 16 + tempo track). I have to check whether that 2 is
really 2 bytes or four, I don't remember well. Basically, each two (four?)
bytes point
to the beginning of every track of the sequencer. With this zone, you can
tell all tracks from zone 4 apart. That is, you know all track length in
bytes and where it starts in zone 4.

4. All sequencer events. Length: 0 to ca. 128KB. They are stored in this
order:
Song 0: all events from track 1, then all events from track 2, ...
... all events from track 16, all tempo events.
Song 1: Parallel to song 0
...
Song 9: Parallel to song 0.

Each event is coded with four bytes. Events are all MIDI events, new bar,
and track end. Nothing with MIDI clock or tempo here. The tempo track
contains just "new bar" events and "tempo change" events.

Zones 1, 2 and 3 are always present in a SNG file. Zone 4 has a variable
length: 0 to 4 x number of events in the sequencer memory. If you delete
all songs and you then save a SNG file, you'll get only zones 1, 2 and

3 saved. My guess
is that the X3 has 128 KB for sequencer data, so zones 1, 2, 3 and 4 will
sum up to those 128 KB. By the way, I also guess that the SNG file is
a DIRECT dump of the sequencer's memory data into disk. As you'll see in
the future, the codification leaves only 7 bits for data such as Note
Velocity... and the X3 specs say that velocity is rounded up to an even
number, 0 to 126... that is what you get by using just seven bits and
left-shifting the result: bin 11111110 = dec 126, as you all know.

Well, that was all I could tell you from my memory. More about this will
be posted soon (or I will look for an FTP to leave it there). I made all
this out by starting with empty songs, then adding one event and studying
the outcoming SNG files. With a bit of patience, I made out all the data
I needed for the moment. I will recover all this info and continue
investigating about it.

I hope we keep in touch ! Bye

Roberto Saralegui
_________________________
you can e-mail me at: robertico at europe dot com.

Top

Moderator:  Admin 



Help keep Synth Zone Online