The print_wave_tempo command has been documented.
[ahxm.git] / doc / language2.txt
blob4c99ab7ad43fc167ba5884f9810c8ceda9d58c59
1 Ann Hell Ex Machina Scripting - II: Extended Commands
2 =====================================================
4  Angel Ortega <angel@triptico.com>
6 Overview
7 --------
9 Those directives that are not pure music instructions or are specific to a
10 given output mode are called extended commands. They are expressed as
11 curly bracket-enclosed blocks of keywords directly followed by their
12 optional, respective arguments. As for the basic commands, formatting and
13 indentation is free-form.
15 Extended commands are interleaved with basic commands, they are inserted
16 exactly where found and can be enclosed in blocks or group structures as
17 well.
19 Software synthesizer commands
20 -----------------------------
22 wav
23 ~~~
25  wav "file.wav" <base note>
26  wav "file.wav" <base note> <min note> <max note>
27  wav "file.wav" <base note> <min note> <max note> <loop start> <loop end>
29 Loads a file containing a PCM wave as a layer for the current instrument.
30 If just the <base note> is specified, a layer will be created for that
31 note only. If <loop start> and <loop end> are not specified, the layer
32 will be accepted as an un-looped one.
34 Supported formats are: .wav (natively), .flac and .mp3 (via external
35 converters).
37 pat
38 ~~~
40  pat "file.pat"
42 Loads a GUS compatible sound patch. All layers defined in it will be
43 added to the current instrument.
45 copy
46 ~~~~
48  copy <track #>
50 Copies all instrument layers in <track #> into the current one. This way, the real
51 (probably memory-expensive) PCM wave data can be shared among many tracks.
53 Example:
55  /* track 0: piano, left hand */
57  /* loads a very big piano patch */
58  { pat "verybigpiano.pat" }
60  /* left hand notes */
61  /* ... */
63  \
65  /* track 1: piano, right hand */
67  /* copies the instrument layers from track # 0 */
68  { copy 0 }
70  /* right hand notes */
71  /* ... */
73 This command is NOT IMPLEMENTED.
75 sustain
76 ~~~~~~~
78  sustain <time>
80 Sets the sustain for subsequent notes to be the specified <time>. Sustain
81 is the time a digital sound will be sounding after being released.
83 vibrato
84 ~~~~~~~
86  vibrato <depth> <frequency>
88 Sets the vibrato for the subsequent notes.
90 Example:
92  /* good depth values range from 0.45 to 0.68 */
93  /* good frequency values are 6hz to 10hz */
94  { vibrato 0.45ms 6 }
96 channel
97 ~~~~~~~
99  channel <channel #> <volume>
101 Sets the <volume> for the specified <channel #>. Usually it's a real number
102 ranging from 0 (total silence) to 1 (full volume), but any value is accepted;
103 numbers bigger than 1 will make the sound to be amplified (though with a
104 risk of saturating), and negative values will negate the amplitude of the
105 sound. By default, only channels 0 and 1 exist (the usual stereo ones);
106 setting a volume for a channel will create it automatically.
108 The 'vol' directive allows volumes for many channels to be specified at a time.
113  vol <volume>
114  vol <volume> <volume>
115  vol <volume> <volume> <volume>
116  vol <volume> <volume> <volume> <volume>
117  vol <volume> <volume> <volume> <volume> <volume> <volume>
119 Sets the volumes for a group of channels at a time. 1, 2, 3, 4 and 6 channels
120 can be specified, corresponding with the following well-known audio systems:
122  * mono: all in one channel
123  * stereo: left and right
124  * 3 channel: left, right and center
125  * quad: front left, front right, rear left and rear right
126  * 4 channel: left, center, right and surround
127  * 6 channel: left center, left, center, right center, right and surround
129 pitch_stretch
130 ~~~~~~~~~~~~~
132  pitch_stretch <note> <length> <volume>
134 Starts playing a special note that will last exactly <length> whole notes,
135 changing its pitch if necessary. The <note> is just specified to locate the
136 desired layer and not as a pitch. This is mainly used to match rhythm loops
137 (that don't have a significative pitch) to the current tempo.
139 Example:
141  /* store three loops in the notes c1, d1 and e1 */
142  { wav "loop1.wav" c1 }
143  { wav "loop2.wav" d1 }
144  { wav "loop3.wav" e1 }
146  /* start loop2.wav lasting two measures */
147  { pitch_stretch d1 2 0.8 }
149 time_stretch
150 ~~~~~~~~~~~~
152  time_stretch <note> <length> <volume>
154 This command is NOT IMPLEMENTED.
156 print_wave_tempo
157 ~~~~~~~~~~~~~~~~
159  print_wave_tempo <note> <number>
161 Prints the optimal tempo for the sample stored in <note> to last exactly
162 <number> whole notes. It does nothing to the output.
165 Digital effect commands
166 -----------------------
168 delay
169 ~~~~~
171  delay <channel> <time>
173 Creates a phase delay in <channel>. Sample output will be delayed by
174 the <time> specification. No further filtering is done.
176 Example:
178  /* add a phase delay of 20 milliseconds in the right channel */
179  { delay 1 20ms }
181 echo
182 ~~~~
184  echo <channel> <time> <gain>
186 Creates an echo effect in <channel>. Sample output will be pass as is,
187 but mixed with the original signal phased by <time> and amplified by
188 <gain>.
190 Example:
192  /* add an 50% echo after 15 milliseconds */
193  { echo 0 15ms 0.5 }
195 comb
196 ~~~~
198  comb <channel> <time> <gain>
200 Creates a comb filter in <channel>. Comb filters are used for implementing
201 reverbs.
203 Example:
205  /* comb filter */
206  { comb 0 1ms 0.4 }
208 allpass
209 ~~~~~~~
211  allpass <channel> <time> <gain>
213 Creates an allpass filter in <channel>. Allpass filters are used for
214 implementing reverbs (see the built-in reverb command).
216 Example:
218  /* allpass filter */
219  { allpass 0 20ms 0.9 }
221 flanger
222 ~~~~~~~
224  flanger <channel> <time> <gain> <depth> <freq> <phase>
226 Creates a flanger effect in <channel>.
228 Example:
230  /* good stereo flanger */
231  { flanger 0 1s 0.9 3.40ms 0.1 0
232    flanger 1 1s 0.9 3.40ms 0.1 0.25 }
234 wobble
235 ~~~~~~
237  wobble <channel> <freq> <phase>
239 Creates a wobble effect in <channel>. Amplitude will have a sine wave
240 applied with a frequency of <freq>, so volume will effectively go from
241 full amplitude to silence twice a period. The initial value for the
242 phase is set in <phase>. The wobble effect can be used to implement
243 tremolos with short frequencies and pan effects with long ones.
245 Examples:
247  /* tremolo (10Hz frequency) */
248  { wobble 0 10 0 }
250  /* long stereo panning: one complete cycle
251     in 4 seconds (0.25Hz), with a 1/4 period
252     phase difference between both channels */
253  { wobble 0 0.25 0
254    wobble 1 0.25 0.25 }
256 square_wobble
257 ~~~~~~~~~~~~~
259  square_wobble <channel> <freq> <phase>
261 Creates a square wobble effect in <channel>. Its behaviour is the same
262 as the wobble command, but applying a square wave instead, so volume
263 will abruptly change from full amplitude to absolute silence twice a
264 period.
266 fader
267 ~~~~~
269  fader <channel> <time> <initial volume> <final volume>
271 Creates a fader effect in <channel>. <Time> is the length that will take
272 the channel volume to change from <initial volume> to <final volume>.
273 After <time> is passed, volume will be filtered to <final volume> until
274 the effect is destroyed.
276 Example:
278  /* a 5 seconds fade-in in left channel */
279  { fader 0 5s 0.0 1.0 }
281 reverb
282 ~~~~~~
284  reverb <channel>
286 Creates simple reverb in <channel>. This reverb is defined as
288  { allpass 0 20ms 0.9
289    allpass 0 36ms 0.9
290    allpass 0 39ms 0.9 }
295  off <channel>
297 This command resets the digital effect chain for <channel>, destroying
298 all possible effects in it. Samples will then pass unmodified.
300 MIDI commands
301 -------------
303 midi_channel
304 ~~~~~~~~~~~~
306  midi_channel <channel #>
308 Sets the MIDI channel for the current track. The <channel #> value must range
309 from 1 to 16.
311 midi_program
312 ~~~~~~~~~~~~
314  midi_program <program #>
316 Adds a MIDI program change event. The <program #> value ranges from 0 to 127.
318 ----
319 Angel Ortega - http://www.triptico.com