Templates
Creating dynamic arrangements with BeatBlocks templates
What Are Templates?
Templates in BeatBlocks are structural blueprints that define how your generative music composition will be arranged. They provide a framework for how stems are selected, combined, and sequenced to create a complete musical piece.
Unlike traditional linear arrangements, BeatBlocks templates allow for dynamic, generative compositions that can create unique but reproducible musical experiences based on seed values and generation rules.
Key Concepts of Templates
- Define the overall structure of your composition
- Specify which types of stems can appear in each section
- Control the density and complexity of arrangements
- Create dynamic variations with consistent musical coherence
- Enable deterministic generation based on seed values
Template Structure
A BeatBlocks template consists of an array of section definitions, each specifying how a particular section of the composition should be generated:
Basic Template Structure
"template": [
{
"length": 4,
"layerCount": 3,
"inclusions": ["drums", "bass"],
"exclusions": ["fx", "vocals"]
},
{
"length": 8,
"layerCount": 5,
"inclusions": ["drums", "bass", "melody", "fx"],
"exclusions": []
},
{
"length": 4,
"layerCount": 2,
"inclusions": ["drums", "fx"],
"exclusions": ["bass", "melody"]
}
]
Section Properties
- length:
Duration of the section in bars (e.g., 4, 8, 16)
- layerCount:
Number of stems to include in this section
- inclusions:
Array of group names that must be included in this section
- exclusions:
Array of group names that must be excluded from this section
Example Section
{
"length": 8,
"layerCount": 5,
"inclusions": ["drums", "bass", "melody"],
"exclusions": ["vocals"]
}
This section will be 8 bars long, contain 5 stems, must include drums, bass, and melody stems, and cannot include any vocal stems.
How Templates Generate Arrangements
When a BeatBlock is initialized with a template and seed value, the generation algorithm follows these steps:
- Section Processing:
For each section in the template, the algorithm selects stems based on the section's requirements.
- Stem Selection:
Stems are chosen based on inclusions, exclusions, and mutex constraints, using the seed value for deterministic randomness.
- Layer Count Enforcement:
The algorithm ensures that exactly the specified number of layers are selected for each section.
- Arrangement Creation:
The final arrangement is created by sequencing the selected stems according to the template structure.
Generated Arrangement Example
"arrangement": [
{
"length": 4,
"layers": [
{
"id": "kick_pattern_1",
"loopLength": 2,
"path": "/content/<INSCRIPTION_ID>",
"loop": true,
"volume": 1,
"alignment": "start"
},
{
"id": "bass_pattern_2",
"loopLength": 4,
"path": "/content/<INSCRIPTION_ID>",
"loop": true,
"volume": 0.9,
"alignment": "start"
},
{
"id": "hi_hat_pattern",
"loopLength": 1,
"path": "/content/<INSCRIPTION_ID>",
"loop": true,
"volume": 0.8,
"alignment": "start"
}
]
},
{
"length": 8,
"layers": [
// Additional sections with their selected layers
]
}
]
This is an example of a generated arrangement based on a template. Each section contains the selected stems with their playback properties.
Template Design Strategies
Common Structural Patterns
- Intro-Verse-Chorus-Outro:
Create a traditional song structure with distinct sections that build and release tension.
[ { "length": 4, "layerCount": 2, "inclusions": ["fx", "ambient"], "exclusions": ["drums", "bass"] }, { "length": 8, "layerCount": 4, "inclusions": ["drums", "bass"], "exclusions": [] }, { "length": 8, "layerCount": 6, "inclusions": ["drums", "bass", "melody"], "exclusions": [] }, { "length": 4, "layerCount": 2, "inclusions": ["fx", "ambient"], "exclusions": ["drums"] } ]
- Build-Drop-Breakdown:
Electronic music structure with tension building, climactic drop, and atmospheric breakdown.
[ { "length": 8, "layerCount": 4, "inclusions": ["drums", "bass", "fx"], "exclusions": ["lead"] }, { "length": 8, "layerCount": 7, "inclusions": ["drums", "bass", "lead"], "exclusions": [] }, { "length": 4, "layerCount": 3, "inclusions": ["ambient", "fx"], "exclusions": ["drums", "bass"] } ]
Advanced Alignment Techniques
One of the most powerful features of BeatBlocks is the ability to precisely control how stems align within bars. By strategically using alignment properties, you can create sophisticated musical effects and transitions.
Alignment Options
- start:
Aligns the stem at the beginning of its allocated time slot (default)
- center:
Centers the stem within its allocated time slot
- end:
Aligns the stem to end exactly at the end of its allocated time slot
Creative Applications
- Use end alignment for risers leading into new sections
- Apply center alignment for impact sounds at section transitions
- Combine different alignments to create complex rhythmic interplay
- Use start alignment for downbeat-focused elements
Example: Creating Transitions with Alignment
// Template section with transition elements
{
"length": 2,
"layerCount": 3,
"inclusions": ["transition", "fx"],
"exclusions": ["drums", "bass", "lead"],
"layers": [
{
"id": "reverse_crash",
"loopLength": 1,
"path": "/content/<INSCRIPTION_ID>",
"volume": 1,
"loop": false,
"alignment": "end", // Will end exactly at the section boundary
"groups": ["fx", "transition"],
"mutex": ["impact"]
},
{
"id": "riser_synth",
"loopLength": 2,
"path": "/content/<INSCRIPTION_ID>",
"volume": 0.8,
"loop": false,
"alignment": "end", // Will build up to the section boundary
"groups": ["fx", "transition"],
"mutex": ["riser"]
},
{
"id": "impact_hit",
"loopLength": 1,
"path": "/content/<INSCRIPTION_ID>",
"volume": 1,
"loop": false,
"alignment": "start", // Will hit exactly at the start of the next section
"groups": ["fx", "impact"],
"mutex": ["impact"]
}
]
}
This example shows how to create a transition section where a reverse crash and riser build up to the section boundary (using "end" alignment), while an impact hit is positioned to land exactly at the start of the next section (using "start" alignment).
Combining Alignment with Loop Properties
For even more control, combine alignment settings with loop properties:
- One-shot effects (loop: false):
Perfect for impacts, hits, and transitional elements. Use with "start" or "end" alignment for precise timing.
- Looping elements with strategic alignment:
Create interesting rhythmic effects by centering looping elements or offsetting them from the grid.
- Offset property:
For even more precise control, combine alignment with the offset property to fine-tune timing.
{ "id": "delayed_clap", "loopLength": 2, "path": "/content/<INSCRIPTION_ID>", "volume": 0.9, "loop": true, "alignment": "start", "offset": 0.5, // Delays by half a beat "groups": ["drums", "percussion"], "mutex": ["clap"] }
Complete Template Example
Here's a complete example of a BeatBlock with a template that creates a dynamic electronic music arrangement:
{
"details": {
"title": "Cosmic Journey",
"author": "BeatBlocks Creator",
"bpm": 128,
"imgId": "<INSCRIPTION_ID>"
},
"generationConfig": {
"seed": "0x3f7a912e",
"groups": ["v1", "v2", "drums", "bass", "lead", "fx", "ambient"],
"mutexes": ["percussion", "basslines", "melodies", "effects"]
},
"template": [
{
"length": 4,
"layerCount": 2,
"inclusions": ["ambient", "fx"],
"exclusions": ["drums", "bass", "lead"]
},
{
"length": 8,
"layerCount": 4,
"inclusions": ["drums", "bass", "v1"],
"exclusions": ["v2", "lead"]
},
{
"length": 8,
"layerCount": 6,
"inclusions": ["drums", "bass", "lead", "v1"],
"exclusions": ["v2", "ambient"]
},
{
"length": 4,
"layerCount": 3,
"inclusions": ["drums", "fx"],
"exclusions": ["bass", "lead"]
},
{
"length": 8,
"layerCount": 6,
"inclusions": ["drums", "bass", "lead", "v2"],
"exclusions": ["v1", "ambient"]
},
{
"length": 4,
"layerCount": 2,
"inclusions": ["ambient", "fx"],
"exclusions": ["drums", "bass", "lead"]
}
],
"layers": [
// Your stem definitions would go here
]
}
This template creates a composition with an ambient intro, a building verse section, a full chorus, a breakdown, a variation of the chorus, and an ambient outro.