Learning LoopScript

 

Introduction

LoopScript is a text format which allows you to describe sounds, and then usem in interesting loop patterns to make beats or melodies. You can then combine those loops into longer tracks to create songs. Any sound or pattern you create can be individually played or exported as a sound file. Sounds are created using a simple declarative format. A 1.5 second C note might look like this in LoopScript:

1.5 second C note:
tone introsound duration 1500 note C

This defines a new sound named "introsound". This sound can be referenced by name in other places in the LoopScript to be used as a source for loop patterns or other sound manipulation. When playing around on the website (such as the Playground) or if not specified on the commandline, LoopScript will always just generate the last thing declared. The commandline version lets you specify a sound by name to generate if you just want to test the output of a sound without having to listen to the entire thing every time. The rest of this page can be read/skimmed in order to see all of the features of LoopScript, or used as a reference via the table of contents above.

 

Format

LoopScript is pretty light on punctuation, and relies on line breaks an indents for most of its formatting. As in other formats/languages where indentation is significant, you can choose how much you want to indent each section provided that you are consistent (always use 2 space indents or a single tab indent, etc). Most sounds are a type (such as "tone") followed by your name for it, followed by some indented lines which define its settings. Names cannot contain spaces, but are otherwise pretty loose. Keeping the names simple and terse is best as you'll be referencing them later in your LoopScripts. Any setting you choose can be used outside of a sound declaration to change the default. For example, the bpm setting ("beats per minute") is only meaningful to a loop definition, but you can set it at top of your LoopScript to set the default bpm for any upcoming loops. You can also change it later in a global place and it'll only affect loops that haven't been declared yet. This works for any setting. Comments are made with the hash mark ("#"), and continue to the end of the line. An arrow pointing to the right ("->") can be used an alternative to an indent, and a semicolon and break up multiple settings on the same line. (experimental)

Basic LoopScript format:
tone note1 # Defines a new tone named "note1" duration 250 # Length of tone, in milliseconds octave 4 # Sets the octave for the note (0-8) note C # A-G are regular notes, H-L are the "black keys" tone bass1 # This begins a new tone (note the reset indentation) duration 250 # New indent begins here octave 1 note B loop loop1 # Loop declaration pattern note1 x.......x....... # Uses note1 pattern bass1 ....x.......x... # Uses bass1
 

Tones

A tone is a description of a single waveform:

A tone that uses all defaults:
tone example1

Tones have the following settings:

Here is an example of a more complicated tone:

So complicated!:
tone echosound wave sine duration 800 octave 4 note G adsr 0.005 0.05 0.7 0.05 reverb 250 0.5
 

Samples

Samples are external sound effects, read in from WAV files. Currently, LoopScript only supports 16 bit, 44.1KHz, mono WAV files.

Basic sample:
sample clap src samples/clap.wav

Samples support the following settings:

Pitch correction (compare to the sample above to hear the difference in pitch):
sample clapCtoA src samples/clap.wav srcnote c note a
 

Loops

Loops are mixes of sounds in timed patterns. A loop requires at least one pattern which has the sound it will be repeating and a string of letters which represent the pattern itself. An example:

120 BPM
sample clap src samples/clap.wav loop loop1 pattern clap x...x...x...x...

Pattern strings must always be a multiple of 16 characters, but has no limit to its length (within reason). Loops support the following settings:

 

Tracks

--Soon--

 

Sections

--Soon--

 

Advanced

--Soon--

 

ADSR

--Soon--