agi2scr & scr2agi v1.0
By Nick Sonneveld
about:
These two tools are used to decompile agi sound objects into user-editable
scripts and then recompiled again. Handy to have if you want to edit
an agi sound file, but don't want to fiddle around with hex editors.
You can also increase, decrease the length of songs, add a silence at the
end.. whatever you want really.
The hope, later on, is for converters to just output a script file and it
will be later on compiled to the agi format. Saves the hassle of the
converter actually writing an agi file.
to use:
compiling a script:
scr2agi -i larry-edited.ass -o larry-edited.aso
decompiling a sound object:
agi2scr -i original_snd.aso -o original_snd.ass
options:
- -i, -input = input object name
- -o, -output = output script name
- -t, -type = type of info to represent notes (not implemented yet.. only with agi2scr)
- -h, -help = print the help message
- -v, -verbose = print interesting messages that correspond with the current activity.
script format:
The script format used these tools is fairly simple. Comments start with
a '#' and are subsequently ignored by the compiler. Each channel starts
with either "tone" or "noise, allocation of the actually channel number is
automatic at the moment. After the definition of a channel, it will
continue reading note information until it reaches another "tone"/"noise".
Notes are defined in the two following formats:
- type, frequency_count, attenuation, duration
- frequency_count, attenuation, duration
Typically, you should define the type in the first note, so the following
notes will be in the same format. If the type isn't defined, it will
assume it's AGI's freq count format. Notes are read in as a floating
point number. So you could enter notes with several decimal points
if you wanted to.
- The different types are:
- a = agi freq_count (freq = 111860 / freq_count)
- n = note.. not defined yet
- f = actual frequency
- w = white noise (freq=0,1,2)
- p = periodic noise (freq=0,1,2)
Attenuation is the volume subtracted from the maximum volume. If you
can wrap your head around that, 0 means the max volume and 15 means absolute
silence.
Duration, for agi sounds is defined as 1 equals 1/60 of a second. So
if you set the duration of a note to 60, it will play for 1 second.
If you want to define a note that is silent, you can either set the attentuation
of it to 15 or define the freq_count to 0. Both is good too.
example:
# tone 1 @ 0x00000008
tone
a, 0, 15, 20
170, 0, 21
160, 0, 22
151, 0, 21
143, 0, 15
127, 0, 7
0, 15, 1
170, 0, 14
143, 0, 13
0, 15, 9
127, 0, 13
0, 15, 8
170, 0, 7
# tone 2 @ 0x0000078F
tone
a, 0, 15, 86
428, 2, 16
0, 15, 5
339, 2, 6
noise
w, 1, 5, 3
1, 4, 9
0, 0, 12
0, 1, 3
0, 5, 12
0, 6, 9
0, 7, 9
0, 11, 15
0, 12, 12
0, 15, 12
grand scheme:
The current agi development tools aren't exactly in rapid development. Whilst
people are out trying to make games (and I have no problem with this), very
little is being done with the core tools used to make games. Sound
has always been a problem, consisting of a handful of converters (that sometimes
works), a partial editor (that sometimes works), and very little support
in AGI Studio. Picture editing is still handled by an external dos
editor (which would be fine if it was still be updated). Logics are
marred by the fact that code can quickly become a mess of variable numbers.
I don't want to rewrite everything. In fact, I don't want to do it
all by myself. I want to encourage other people to help and finish
off the current tools. I want everything to be modularised into separate
programs so people can easily replace something they don't like. Don't
like how the current compiler in AGI Studio doesn't support some commands?
Wouldn't it be great if you could swap it for another compiler without
having to delve into AGI Studio's code?
Right now I'm concentrating on the sound utils, but I'll soon work on other
tools. I still want AGI Studio to stay around. I don't want to
fall into the trap of reinventing the wheel. (look at Mozilla. it's
great but it's taken years)
These are the tools I believe we'll need for sound:
- converters from AGI, MIDI, Rol, IT and other formats to the scripting format
- scripting compiler
- agi sound player
- agi sound information (number of channels, length)
All these tools could be called from AGI Studio or another GUI to help people
who don't want to fiddle around with the command prompt.
Later on I want to work on:
- volume compiler (glue) (suggest your own disks, lzw compression, rebuild only if necessary)
- compiler that supports switch statements, the "unknown" commands and is less picky.
- a website for the AGI developer.
The idea:
Small tools, wrapped up in a GUI *later* on.
The goal:
A full development suite for AGI. To encourage more developers and to stop other developers from getting discouraged.
source license:
I release the source for these programs into the public domain. It
does not have any implied warranties or guarantees however.
I would appreciate it if you:
- emailed me any patches
- gave me credit for any programs based on this code
- notified me of any programs that used this code
but I do not require this. At all. Enjoy the code.
contact:
If you've got patches, suggestions, bug fixes.. by all means send something over.
sonneveld@hotmail.com
http://members.dingoblue.net.au/~sonneveld/