AGI Sound Tutorial - Scripting

From AGI Wiki
Revision as of 20:54, 24 December 2013 by Andrew Branscom (talk | contribs)
Jump to navigationJump to search

Tutorials Table of Contents
AGI Sound Tutorial Index

Page: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13


Sound Scripting
by Nick Sonneveld

 

Originally with the AGI sound files there was no way to manually edit a particular part of a song or change the length without having to convert to a MIDI file to edit it. One tool to do this now is the "agi2scr" and "scr2agi" tools by um.. me (Nick Sonneveld). 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.

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:

  1. Type, frequency_count, attenuation, duration
  2. 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

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 attenuation of it to 15 or define the freq_count to 0. Both is good too.

 

Page: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13

 

Tutorials Table of Contents
AGI Sound Tutorial Index

< Previous: MergingNext: Visual Editors >