1 Ann Hell Scripting - II: Extended Commands
2 ==========================================
4 Angel Ortega <angel@triptico.com>
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
19 Software synthesizer commands
20 -----------------------------
26 wav "file.wav" <base> <min> <max>
27 wav "file.wav" <base> <min> <max> <loop start> <loop end>
28 wav "file.wav" <base> <min> <max> <loop start> <loop end> <first ch> <skip ch>
30 Loads a file containing a PCM wave as a layer for the current instrument.
31 If just the `base' note is specified, a layer will be created for that
32 note only. If `min' and `max' are specified, they conform the range of notes.
33 If `loop start' and `loop end' are not specified, the layer will be accepted
34 as an un-looped one (so the sound will immediately stop when reaching the end).
35 This non-looping behaviour can be simulated by setting a `loop start' of -1.
36 If `loop end' is negative, it's assumed as the end of the sample (so a loop
37 from 0 to -1 selects the full PCM wave for looping).
39 By default, all wav's channels are mapped sequentially to all channels of the
40 instrument, so that a mono wav file will be spread to all channels, a stereo one
41 to alternating odd/even channels, etc. The `first ch' and `skip ch' arguments
42 can be used to change this. `first ch' specify the first channel the wav will
43 start spreading into (default is 0, the first one), and `skip ch' is the number
44 of channels to skip before spreading to the next (default is 0, don't skip any
47 (New in 1.0.10) If the filename starts with the | (pipe) symbol, it's assumed
48 as a command to be executed. This command should include a %s mark where a
49 temporary file name will be inserted. The command should generate a wav file
50 in that temporary file.
52 Supported formats are: .wav (natively), .flac and .mp3 (via external
57 /* a simple wav with no loop and no range (just on note D1) */
58 { wav "snare1.wav" d1 }
60 /* a wav to be playing in the C3-C4 range, tuned to G4, unlooped */
61 { wav "glockenspiel-g4.wav" g4 c3 c4 }
63 /* another one, but using MIDI note numbers instead of note-octave notation */
64 { wav "xilophone.wav" c5 1 127 }
67 { wav "pad10.wav" f4 f1 b9 150 154056 }
69 /* another one, with a loop to fill the full wave */
70 { wav "hiphop-drumline.wav" c1 c1 c1 0 -1 }
72 /* another way of expressing the first example */
73 { wav "snare1.wav" d1 d1 d1 -1 -1 }
75 /* two looped waves for the same note, but from different wave files;
76 the 'L' one will be on channels 0, 2, 4... and the 'R' one on 1, 3, 5... */
77 { wav "piano1-L.wav" c2 c1 g2 150 146578 0 1 }
78 { wav "piano1-R.wav" c2 c1 g2 175 143254 1 1 }
80 /* this command will call the 'sox' program to generate a temporary
81 filename (replacing the %s mark) and set it to play on C5 */
82 { wav "|sox orig_file.wav %s stretch 6" c5 }
89 Loads a GUS compatible sound patch. All layers defined in it will be
90 added to the current instrument.
97 Sets the sustain for subsequent notes to be the specified `time'. Sustain
98 is the time a digital sound will be sounding after being released.
105 (New in 1.0.9). Sets the attack time for the subsequent notes to be the
106 specified `time'. This is the time that takes a sound to fade-in from
107 silence to full volume. By default, it's zero (sounds start immediately
113 vibrato <depth> <frequency>
115 Sets the vibrato for the subsequent notes.
119 /* good depth values range from 0.45 to 0.68 */
120 /* good frequency values are 6hz to 10hz */
128 (New in 1.0.8). Sets the portamento for subsequent notes. If `factor' is
129 negative, the notes will slide down, or up if positive. Bigger values
130 generate more portamento. The final result depends on the frequency of each
131 note: lower notes will be more affected than higher ones for equal values
132 of `factor'. A `factor' of 0 disables portamento.
137 channel <channel #> <volume>
139 Sets the `volume' for the specified `channel #'. Usually it's a real number
140 ranging from 0 (total silence) to 1 (full volume), but any value is accepted;
141 numbers bigger than 1 will make the sound to be amplified (though with a
142 risk of saturating), and negative values will negate the amplitude of the
143 sound. By default, only channels 0 and 1 exist (the usual stereo ones);
144 setting a volume for a channel will create it automatically.
146 The 'vol' directive allows volumes for many channels to be specified at a time.
152 vol <volume> <volume>
153 vol <volume> <volume> <volume>
154 vol <volume> <volume> <volume> <volume>
155 vol <volume> <volume> <volume> <volume> <volume> <volume>
157 Sets the volumes for a group of channels at a time. 1, 2, 3, 4 and 6 channels
158 can be specified, corresponding with the following well-known audio systems:
160 * mono: all in one channel
161 * stereo: left and right
162 * 3 channel: left, right and center
163 * quad: front left, front right, rear left and rear right
164 * 4 channel: left, center, right and surround
165 * 6 channel: left center, left, center, right center, right and surround
170 pitch_stretch <note> <length> <volume>
172 Starts playing a special note that will last exactly `length' whole notes,
173 changing its pitch if necessary. The `note' is just specified to locate the
174 desired layer and not as a pitch. This is mainly used to match rhythm loops
175 (that don't have a significative pitch) to the current tempo.
179 /* store three loops in the notes c1, d1 and e1 */
180 { wav "loop1.wav" c1 }
181 { wav "loop2.wav" d1 }
182 { wav "loop3.wav" e1 }
184 /* start loop2.wav lasting two measures */
185 { pitch_stretch d1 2 0.8 }
190 time_stretch <note> <length> <volume>
192 This command is NOT IMPLEMENTED.
197 print_wave_tempo <note> <number>
199 Prints the optimal tempo for the sample stored in `note' to last exactly
200 `number' whole notes. It does nothing to the output.
203 Digital effect commands
204 -----------------------
209 delay <channel> <time>
211 Creates a phase delay in `channel'. Sample output will be delayed by
212 the `time' specification. No further filtering is done.
216 /* add a phase delay of 20 milliseconds in the right channel */
222 echo <channel> <time> <gain>
224 Creates an echo effect in `channel'. Sample output will be pass as is,
225 but mixed with the original signal phased by `time' and amplified by
230 /* add an 50% echo after 15 milliseconds */
236 comb <channel> <time> <gain>
238 Creates a comb filter in `channel'. Comb filters are used for implementing
249 allpass <channel> <time> <gain>
251 Creates an allpass filter in `channel'. Allpass filters are used for
252 implementing reverbs (see the built-in reverb command).
257 { allpass 0 20ms 0.9 }
262 flanger <channel> <time> <gain> <depth> <freq> <phase>
264 Creates a flanger effect in `channel'.
268 /* good stereo flanger */
269 { flanger 0 1s 0.9 3.40ms 0.1 0
270 flanger 1 1s 0.9 3.40ms 0.1 0.25 }
275 wobble <channel> <freq> <phase>
276 wobble <channel> <freq> <phase> <gain>
278 Creates a wobble effect in `channel'. Amplitude will have a sine wave
279 applied with a frequency of `freq', so volume will effectively go from
280 full amplitude to silence twice a period. The initial value for the
281 phase is set in `phase'. The wobble effect can be used to implement
282 tremolos with short frequencies and pan effects with long ones.
284 If `gain' is set, it's the ratio of wobbled / unmodified signal, ranging
285 from 1 (full wobbled) to 0 (no effect). If not set, `gain' has a default
286 value of 0.8. This behaviour is new in 1.0.9; previous versions didn't
287 accept the 4th argument and acted as if a gain of 1.0 was given.
291 /* tremolo (10Hz frequency) */
294 /* long stereo panning: one complete cycle
295 in 4 seconds (0.25Hz), with a 1/4 period
296 phase difference between both channels */
303 square_wobble <channel> <freq> <phase>
305 Creates a square wobble effect in `channel'. Its behaviour is the same
306 as the wobble command, but applying a square wave instead, so volume
307 will abruptly change from full amplitude to absolute silence twice a
313 half_wobble <channel> <freq> <phase>
315 (New in 1.0.8). Creates a half wobble effect in `channel'. Its behaviour is
316 the same as the wobble command, but the sine wave is applied to the
317 amplitude only the first half the period and silence the other half.
322 fader <channel> <time> <initial volume> <final volume>
324 Creates a fader effect in `channel'. `Time' is the length that will take
325 the channel volume to change from `initial volume' to `final volume'.
326 After `time' is passed, volume will be filtered to `final volume' until
327 the effect is destroyed.
331 /* a 5 seconds fade-in in left channel */
332 { fader 0 5s 0.0 1.0 }
339 Creates simple reverb in `channel'. This reverb is defined as
348 foldback <channel> <threshold>
350 (New in 1.0.8). Creates a simple distortion waveshaper where each amplitude
351 above `threshold' (range from -1 to 1) is folded back using the following
354 if(input > threshold)
355 output = threshold - (input - threshold);
357 if(input < -threshold)
358 output = -threshold + (-threshold - input);
360 See http://www.musicdsp.org/archive.php?classid=4#203 for more
366 atan <channel> <gain>
368 (New in 1.0.9). Creates a simple distortion waveshaper that applies an
369 atan() function to each input sample. `gain' must be greater than 1.
370 The output from this filter is slightly distorted but a bit quieter.
372 See http://www.musicdsp.org/showArchiveComment.php?ArchiveID=104 for
378 distort <channel> <gain>
380 (New in 1.0.9). Creates a simple distortion waveshaper that applies a
381 simple formula to each input sample. `gain' must be greater than 1.
383 See http://www.musicdsp.org/showArchiveComment.php?ArchiveID=86 for more
389 overdrive <channel> <gain>
391 (New in 1.0.9). Creates a simple distortion waveshaper that applies a
392 simple formula to each input sample. `gain' must be greater than 1. The
393 output from this filter is slightly distorted but a bit louder (it's not
394 a real overdrive, but for same waves it sounds similar).
396 See http://www.musicdsp.org/archive.php?classid=4#41 for more
404 This command resets the digital effect chain for `channel', destroying
405 all possible effects in it. Samples will then pass unmodified.
413 midi_channel <channel #>
415 Sets the MIDI channel for the current track. The `channel #' value must range
421 midi_program <program #>
423 Adds a MIDI program change event. The `program #' value ranges from 0 to 127.
425 Miscellaneous commands
426 ----------------------
431 song_info "Song Author" "Song Name"
433 (New in 1.0.4). This directive is used to set the author and name of the song.
434 These metadata can be used to generate .cue files.
437 Angel Ortega - http://www.triptico.com