Difference between revisions of "AGI Sound Tutorial - Scripting"

From AGI Wiki
Jump to navigationJump to search
 
(8 intermediate revisions by the same user not shown)
Line 1: Line 1:
[[AGI Tutorials|Tutorials Table of Contents]]<br />
+
[[Tutorials and Guides|Tutorials and Guides Table of Contents]]<br />
 
[[AGI Sound Tutorial|AGI Sound Tutorial Index]]
 
[[AGI Sound Tutorial|AGI Sound Tutorial Index]]
  
Line 15: Line 15:
 
[[AGI Sound Tutorial - In the Future|10]] |  
 
[[AGI Sound Tutorial - In the Future|10]] |  
 
[[AGI Sound Tutorial - Location of Tools|11]] |  
 
[[AGI Sound Tutorial - Location of Tools|11]] |  
[[AGI Sound Tutorial - References|12]] |
+
[[AGI Sound Tutorial - References|12]]
[[AGI Sound Tutorial - Revision History|13]]
 
 
</div><br />
 
</div><br />
  
 
<div align="center"><span style="font-size: 22pt">Sound Scripting</span><br />
 
<div align="center"><span style="font-size: 22pt">Sound Scripting</span><br />
''by [[Nick Sonneveld]]''<br /></div>
+
''by [[Nick Sonneveld]]''<br />
 +
''Last Updated 4th March, 2002''</div>
  
 
&nbsp;
 
&nbsp;
  
 +
== <br />Scripting ==
  
 +
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.
 +
 +
&nbsp;
 +
 +
=== compiling a script ===
 +
 +
<blockquote><code>scr2agi -i larry-edited.ass -o larry-edited.aso</code></blockquote>
 +
 +
&nbsp;
 +
=== Decompiling a Sound Object ===
 +
 +
<blockquote>
 +
<code>agi2scr -i original_snd.aso -o original_snd.ass</code></blockquote>
 +
 +
<blockquote>
 +
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.
 +
</blockquote>
 +
 +
&nbsp;
 +
== 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".
 +
 +
<blockquote>
 +
Notes are defined in the two following formats:
 +
 +
# Type, frequency_count, attenuation, duration
 +
# Frequency_count, attenuation, duration
 +
</blockquote>
 +
 +
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.
 +
 +
<blockquote>
 +
* 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)
 +
</blockquote>
 +
 +
&nbsp;
 +
== 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.
 +
 +
<blockquote>
 +
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.<br />
 +
<br />
 +
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.
 +
</blockquote>
  
 
&nbsp;
 
&nbsp;
Line 41: Line 99:
 
[[AGI Sound Tutorial - In the Future|10]] |  
 
[[AGI Sound Tutorial - In the Future|10]] |  
 
[[AGI Sound Tutorial - Location of Tools|11]] |  
 
[[AGI Sound Tutorial - Location of Tools|11]] |  
[[AGI Sound Tutorial - References|12]] |
+
[[AGI Sound Tutorial - References|12]]
[[AGI Sound Tutorial - Revision History|13]]
 
 
</div>
 
</div>
  
 
&nbsp;
 
&nbsp;
  
[[AGI Tutorials|Tutorials Table of Contents]]<br />
+
[[Tutorials and Guides|Tutorials and Guides Table of Contents]]<br />
 
[[AGI Sound Tutorial|AGI Sound Tutorial Index]]
 
[[AGI Sound Tutorial|AGI Sound Tutorial Index]]
  
Line 54: Line 111:
 
&nbsp;
 
&nbsp;
  
[[Category:Sound]]
+
[[Category:AGI Sound Resources]]
 
[[Category:References]]
 
[[Category:References]]
 
[[Category:Tutorials]]
 
[[Category:Tutorials]]
[[Category:Logic]]
+
[[Category:AGI Logic]]

Latest revision as of 13:57, 30 January 2024

Tutorials and Guides Table of Contents
AGI Sound Tutorial Index

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


Sound Scripting

by Nick Sonneveld

Last Updated 4th March, 2002

 


Scripting

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

 

Tutorials and Guides Table of Contents
AGI Sound Tutorial Index

< Previous: MergingNext: Visual Editors >