B4) Flags and Decremental Weights

Dynamic Control

What if a grammar could count, remember, and exhaust itself?

Where does this article fit in?

Previous articles laid the groundwork: B1 for controlled randomness, B2 for building blocks, B3 for the five modes. But all of this remains static: weights don’t change, rules apply blindly. This article introduces the two mechanisms that make BP3 (Bol Processor 3, I2) truly dynamic: flags (conditional counters) and decremental weights. These are what allow modeling the exhaustion of a musical idea, the gradual end of a development, or the conditional execution of a passage. The formalization relies on the configurations and inference rules of L6.


Why is this important?

Imagine a musician improvising on an Indian raga (a melodic framework prescribing the notes, ornaments, and atmosphere of a piece). They explore a melodic motif, repeat it, vary it — then let it die out naturally to move on to something else. This isn’t random: the musician mentally counts, decides when a motif has been sufficiently explored, and controls the transition. It is precisely this type of dynamic control that Bernard Bel and James Kippen sought to model by creating BP3’s flags and weights [BelKippen1992a], based on their observation of tabla masters from the Lucknow gharānā [Kippen1988].

A classic probabilistic grammar (B1Probabilistic Context-Free Grammar) cannot do this. Its probabilities are fixed: the same rule always has the same chance of being chosen, whether it’s the first or the hundredth time. It’s like an ordinary die: it has no memory.

BP3 solves this problem with two complementary mechanisms:

  • Flags: named counters that can be tested, incremented, or decremented. They allow saying “apply this rule only if the avart (remaining cycles) counter is greater than 0, and decrement it.”
  • Decremental weights: weights that decrease with each use. They allow saying “this rule is very probable at first, but gradually exhausts itself.”

Flags are logical guards (yes/no), decremental weights are probabilistic guards (increasingly improbable). Together, they give BP3 an expressiveness that far exceeds classic grammars.

The idea in one sentence

Flags are conditional counters that control rule applicability, and decremental weights are probabilities that erode with each use, allowing BP3 to model the gradual exhaustion of a musical motif.


Let’s explain step by step

1. Flags: conditional counters

What is a flag?

A flag is a named variable, attached to a grammar rule, that serves two purposes: to condition the application of the rule and to modify the system’s state after application.

Sidebar: The restaurant counter analogy

Imagine a restaurant offering a special menu: “first 20 orders half price.” The waiter keeps a counter:

  • At the start: counter = 20
  • For each special order: counter = counter – 1
  • When counter = 0: “sorry, the offer is over”

BP3 flags work exactly like this. The avart counter starts at 4 (number of tāla cycles to play), each cycle decrements it, and when it reaches 0, the variations stop.

BP3 Syntax

Flags appear between slashes / in the rules:

 

gram#1[1] /avart=4/ |S| --> |A| |S|
gram#1[2]           |S| --> -
gram#1[3] /avart/   |A| --> dha dhin dhin dha /avart-1/
gram#1[4]           |A| --> tin ta -

 

This grammar plays 4 cycles (āvart) of the tintāl theka (dha dhin dhin dha), then stops. When the cycles are exhausted, only the dry motif (tin ta -) remains available. Let’s break down the flags:

  • /avart=4/: initializes the avart flag to 4 (number of remaining cycles)
  • /avart/: tests that the avart flag is non-zero (> 0)
  • /avart-1/: decrements the avart flag by 1 after each cycle

The six operators

BP3 offers six operators to manipulate flags:

Operator BP3 Syntax Meaning Example
(empty) /avart/ Tests if the flag is non-zero (> 0) Guard: apply only if avart > 0
= /avart=4/ Assigns a value Initialization or reset
+ /cycle+1/ Increments Increases the counter
- /avart-1/ Decrements Decreases the counter
> /avart>2/ Tests if strictly greater than Conditional guard
< /phase<5/ Tests if strictly less than Conditional guard

Operators are divided into two categories:

  • Guards (conditions): "" (non-zero test), >, < — they decide if the rule can apply
  • Effects (operations): = , +, - — they modify the state after application

The Flag AST node

In the AST (Abstract Syntax Tree — see L4) of the BP2SC (Bol Processor to I3) transpiler (source-to-source compiler — see B7), a flag is represented by the node:

 

@dataclass
class Flag:
    name: str                    # "avart", "phrase", "reprise"
    op: str = ""                 # "", "=", "+", "-", ">", "<"
    value: str | None = None     # "20", "1", None (for simple test)

 

The op field is an empty string for the non-zero test (the /avart/ case without an explicit operator). The value field is None when no value is needed (simple test).

SOS Rule: Flag-Cond

The formal semantics of flags are expressed as an inference rule in L6. A configuration now includes a flag environment φ (phi) that associates each flag name with its current integer value.

Sidebar: SOS Reminder

In Structural Operational Semantics (L6), program behavior is described by inference rules of the form:

    premise(s)
─────────────────── (Rule-Name)
    conclusion

The conclusion applies only if all premises are satisfied. Configurations (σ, φ, t) represent: the working string σ (sigma), the flag environment φ, and time t.

Here is the Flag-Cond rule for a conditional flag with decrement:

 

φ(avart) > 0    r = (/avart/ A → β /avart-1/)
─────────────────────────────────────────────────────── (Flag-Cond)
(σ₁ . A . σ₂, φ, t) ⟹ (σ₁ . β . σ₂, φ[avart ↦ φ(avart) - 1], t)

 

Reading this rule:

  • Premise 1: the current value of the avart flag in environment φ is strictly positive
  • Premise 2: there exists a rule r that has /avart/ as a guard and /avart-1/ as an effect
  • Conclusion: A is replaced by β (beta, the right-hand side of the rule) in the working string, and the environment is updated by decrementing avart by 1

The notation φ[avart ↦ φ(avart) - 1] means “the same environment φ, except that the value of avart is replaced by its current value minus 1.” This is a functional update: the old environment is not modified, a new one is created.

What happens when the flag reaches 0?

The premise φ(avart) > 0 is no longer satisfied. The rule can no longer apply. If another rule for the same non-terminal (symbol that can still be derived, denoted between bars |A| in BP3 — see B2) exists without a guard (like rule 4 in our example), it takes over. Otherwise, the derivation blocks.


2. Decremental weights

What is a decremental weight?

A decremental weight is a rule weight (like those seen in B1) that decreases each time the rule is chosen. The BP3 notation is <N-M>: initial weight N, decremented by M with each use.

Sidebar: The analogy of the soloist getting tired

Imagine a jam session. At first, a musician raises their hand every turn to take a solo — they are enthusiastic, almost certain to be chosen (high probability). But with each solo played, their desire diminishes: they raise their hand less often (low probability), then eventually stay seated (zero probability). The musician is still there, and if chosen, would play as well as before — but they no longer volunteer.

This is exactly what a decremental weight does: the rule always produces the same result when chosen, but its probability of being chosen decreases until it reaches zero.

BP3 Syntax

 

gram#1[1] |S| --> <50-12> |A| |S|
gram#1[2] |S| --> <1> fin

 

  • <50-12>: initial weight 50, decremented by 12 with each use
  • <1>: fixed weight 1 (no decrement)

The Weight AST node

 

@dataclass
class Weight:
    value: int                   # 50 (initial weight)
    decrement: int | None = None # 12 (decrement per use), None if fixed

 

When decrement is None, the weight is static (as in a classic PCFG). When it is defined, the weight evolves dynamically.

SOS Rule: Weight-Dec

Let’s formalize the semantics of decremental weights. The configuration is enriched with a weight function w that associates each rule with its current weight:

 

Let w be the weight function, initially w(r) = 50
Rule r chosen according to categorical distribution on w
────────────────────────────────────────────────────── (Weight-Dec)
(σ, φ, t, w) ⟹ (σ', φ, t, w[r ↦ max(0, w(r) - 12)])

 

Reading:

  • Rule r is chosen according to a categorical distribution (weighted draw) based on the current weights
  • After application, the weight of r is decreased by 12, with a floor of 0 (the weight never becomes negative)
  • Flags φ and time t are not affected

Sidebar: Categorical Distribution

A categorical distribution (also called a discrete Gibbs distribution) is the generalization of rolling a die to any number of faces with arbitrary probabilities. If we have three rules with weights [50, 10, 1], the probabilities are:

  • P(rule 1) = 50 / (50 + 10 + 1) = 82%
  • P(rule 2) = 10 / 61 = 16%
  • P(rule 3) = 1 / 61 = 2%

The key point: probabilities are recalculated at each step, because the weights change. This is not a one-time calculation, but a continuous recalculation. It is this continuous renormalization that distinguishes decremental weights from a PCFG.

Probability evolution: a concrete example

Let’s take the example again:

 

gram#1[1] |S| --> <50-12> |A| |S|
gram#1[2] |S| --> <1> fin

 

Use Weight of r1 Weight of r2 P(continue) P(finish)
1 50 1 98.0% 2.0%
2 38 1 97.4% 2.6%
3 26 1 96.3% 3.7%
4 14 1 93.3% 6.7%
5 2 1 66.7% 33.3%
6 0 1 0.0% 100.0%

Let’s observe the profile: the first four uses are almost certain (the recursive rule largely dominates). Then the fifth use shifts abruptly — the probability of continuing drops to 67%. And by the sixth, the recursive rule is dead: the weight has fallen to 0.

Convergence and guaranteed termination: unlike a pure PCFG where recursion can theoretically last indefinitely, decremental weights guarantee termination. In at most ceil(N/M) + 1 uses (here ceil(50/12) + 1 = 6), the recursive rule reaches a weight of 0 and can no longer be chosen. This is a fundamental property for music: the composer knows that their motif will have a bounded length.

Sidebar: Decremental weights vs. flags

Both mechanisms control termination, but in different ways:

Aspect Flags Decremental weights
Type of control Logical (yes/no) Probabilistic (gradual)
Transition Abrupt (active -> inactive) Progressive (from probable to impossible)
Musical analogy “Stop after 20 notes” “The idea fades naturally”
Expressiveness Deterministic structures Organic structures

>
Flags are switches, decremental weights are dimmers.


3. Flag and mode interactions

Flags interact richly with the B3. The two most important combinations are RND + flags and ORD + flags.

RND with flags: the Prout in SuperCollider

In RND mode (weighted random — see the five modes in B3), flags transform random choice into conditional choice: the rule is eligible only if its guards are satisfied.

The BP2SC transpiler translates this combination into a SuperCollider Prout. A Prout is a lazy routine that produces events one by one, allowing imperative logic (tests, counters) to be included within the pattern flow.

Here’s how BP2SC translates a grammar with flags:

BP3 Grammar:

-mo.RND
gram#1[1] /avart=8/ |S| --> |A| |S|
gram#1[2] /avart/   |A| --> dha dhin dhin dha /avart-1/
gram#1[3]           |A| --> tin ta -

 

Generated SuperCollider code:

// --- Flag variables ---
~avart = 8;

Pdef(\S, Prout({ |ev|
    inf.do {
        if((~avart > 0)) {
            ~avart = ~avart - 1;
            // dha dhin dhin dha (resonant motif, theka)
            Pbind(\midinote, Pseq([36, 38, 38, 36])).embedInStream(ev);
        } {
            // tin ta - (dry motif + silence)
            Pbind(\midinote, Pseq([48, 50, \rest])).embedInStream(ev);
        }
    }
}));

 

Let’s break down this code:

  1. ~avart = 8: SC environment variable, initialized to 8 (translates /avart=8/)
  2. Prout({ |ev| ... }): lazy routine that receives the current event ev
  3. inf.do { ... }: infinite loop (the Prout produces events indefinitely)
  4. if((~avart > 0)): guard test (translates /avart/)
  5. ~avart = ~avart - 1: decrement (translates /avart-1/)
  6. .embedInStream(ev): injects the resulting pattern into the stream — this is the SC way to “play” a sub-pattern from a routine

Sidebar: Why Prout and not Pif?

SuperCollider offers Pif for conditional branching in patterns. But Pif evaluates its condition only once at startup. With Prout, the condition is re-evaluated at each iteration, allowing it to reflect the counter’s mutation. This is why BP2SC systematically chooses Prout + embedInStream for flags.

ORD with flags: sequential conditional execution

In ORD mode (sequential), flags allow deterministic control: rules are tried in order, but only if their guards are satisfied. This is the equivalent of a cascade of if/else if/else.

 

-mo.ORD
gram#1[1] /reprise=1/ |S| --> |A| |S|
gram#1[2]             |S| --> -
gram#1[3] /reprise>0/ |A| --> dha dhin /reprise-1/
gram#1[4]             |A| --> tin ta

 

Here, the reprise flag controls whether rule 3 is available. Once reprise is decremented to 0, rule 4 (without a guard) takes over. In ORD mode, this logic is purely sequential and deterministic.

Decremental weights in RND mode: Prout with mutable weights

Decremental weights in RND mode are translated into SC by a Prout with local weight variables and a weighted selection at each iteration:

BP3 Grammar:

-mo.RND
gram#1[1] |S| --> <50-12> |A| |S|
gram#1[2] |S| --> <1> fin

 

Generated SuperCollider code:

Pdef(\S, Prout({ |ev|
    var w0 = 50;  // decrement: 12
    var w1 = 1;
    inf.do {
        var total = w0 + w1;
        var r = total.rand;
        if(r < w0) {
            Pdef(\A).embedInStream(ev);
            Pdef(\S).embedInStream(ev);
            w0 = (w0 - 12).max(0);
        } {
            Pbind(\degree, 0).embedInStream(ev);
        }
    }
}));

 

Let’s observe the mechanism:

  1. Weights w0 and w1 are mutable local variables (not constants)
  2. At each iteration, a random number r is drawn between 0 and the total of the weights
  3. The choice is made by cumulative thresholds: if r < w0, rule 1 is chosen
  4. After use, weight w0 is decremented with .max(0) to avoid negative values
  5. Weight w1 (fixed) never changes: it serves as a “safety net” that eventually dominates

4. Concrete examples

Example 1: Mohanam — the raga with controlled exhaustion

The raga Mohanam is a pentatonic (five-note) Indian raga (Sa Ri Ga Pa Dha) used in many Carnatic compositions (classical tradition of South India). Here’s how BP3 can model the progressive exploration and then exhaustion of a motif:

 

-al.Mohanam
Sa Ri Ga Pa Dha

-mo.RND
gram#1[1] /phrase=20/ |S| --> |Phrase| |S|
gram#1[2]             |S| --> |Cadence|
gram#1[3] /phrase/    |Phrase| --> |Motif| |Motif| /phrase-1/
gram#1[4]             |Phrase| --> |Repos|
gram#1[5]             |Motif|  --> Sa Ri Ga
gram#1[6]             |Motif|  --> Pa Dha Pa
gram#1[7]             |Motif|  --> Ga Ri Sa
gram#1[8]             |Repos|  --> - - -
gram#1[9]             |Cadence| --> Dha Pa Ga Ri Sa

 

Behavior analysis:

  • The phrase flag starts at 20. As long as it’s positive, phrases contain melodic motifs (rule 3). Each phrase decrements phrase by 1.
  • When phrase reaches 0, rule 3 stops applying. Only rule 4 remains: rests.
  • Finally, the recursion of |S| eventually chooses rule 2 (the final cadence).

The musical result: active exploration for about 20 phrases, then a slowdown with silences, then a conclusive cadence. This is a model of the alapana (introductory exploration) of a raga.

Sidebar: Vādi and samvādi — the dominant notes of the raga

In the Mohanam raga (Sa Ri Ga Pa Dha), not all notes have the same weight. The vādi note (dominant note, the most important) is Pa and the samvādi note (sub-dominant note) is Sa. A flag could model this hierarchy:

gram#1[10] /vadi/ |Motif| --> Pa |Ornement| Pa /vadi-1/

The /vadi/ flag would ensure that Pa (the vādi) appears regularly in the melody — exactly as an Indian musician naturally returns to the dominant note of the raga. This structural constraint, impossible in a classic PCFG, is at the heart of what Bel and Kippen sought to formalize [BelKippen1992a].

Sidebar: The ālāp — when flags reach their limits

The ālāp (opening of a raga where notes are introduced progressively: first Sa alone, then Sa-Re, then Sa-Re-Ga…) poses an interesting challenge. Can it be modeled with flags? Yes, but laboriously:

gram#1[1] /phase=1/ |Phrase| --> Sa Sa Sa /phase+1/
gram#1[2] /phase=2/ |Phrase| --> Sa Re Sa Re /phase+1/
gram#1[3] /phase=3/ |Phrase| --> Sa Re Ga Re Sa /phase+1/
gram#1[4] /phase=4/ |Phrase| --> Sa Re Ga Ma Ga Re Sa /phase+1/

This works, but it requires one rule per note introduced — enumerating cases instead of generating them. The ālāp reveals that flags are counters, not accumulators: they know how many notes have been introduced, but not which ones. For a more elegant solution, the context markers of B6 allow writing “play this note only if the previous notes are already present” — an accumulation constraint that only BP3’s context-sensitive extensions can express naturally.

Example 2: Progressive exhaustion with decremental weights

Let’s visualize the evolution of probabilities for a richer grammar:

 

gram#1[1] |S| --> <40-8>  |Thème| |S|
gram#1[2] |S| --> <10-2>  |Variation| |S|
gram#1[3] |S| --> <1>     |Coda|

 

Step w(Theme) w(Variation) w(Coda) P(Theme) P(Variation) P(Coda)
1 40 10 1 78.4% 19.6% 2.0%
2 32 8 1 78.0% 19.5% 2.4%
3 24 6 1 77.4% 19.4% 3.2%
4 16 4 1 76.2% 19.0% 4.8%
5 8 2 1 72.7% 18.2% 9.1%
6 0 0 1 0.0% 0.0% 100.0%

This table reveals expressive behavior:

  1. Exposition phase (steps 1-3): the theme largely dominates, variations are possible but rare, the coda is almost impossible.
  2. Transition phase (steps 4-5): the theme gradually weakens, variations maintain their relative proportion, the coda becomes conceivable.
  3. Conclusion phase (step 6): both recursive rules are dead (weight 0). Only the coda remains: it is forced.

This is a model of the classic musical form Exposition-Development-Conclusion, emerging naturally from decremental weights without any explicit programming of the structure.

Sidebar: The beauty of decremental weights

Note that the two recursive rules exhaust themselves at the same time (step 6), because 40/8 = 10/2 = 5 uses before reaching 0. This is not a coincidence: the composer calibrated the N/M ratios to synchronize the exhaustions. A higher ratio (like <40-4>) would extend the theme’s life to 10 uses, creating a longer piece.

Example 3: Kayda with flag control — tāla cycles

A kayda is a tabla composition structured in cycles (āvart) of tāla. The composer-performer plays a determined number of variation cycles before concluding with a tihāī (cadence). Flags naturally model this cycle counting:

 

-mo.RND
gram#1[1] /avart=4/ |S| --> |Cycle| |S|
gram#1[2]           |S| --> |Tihai|
gram#1[3] /avart/   |Cycle| --> |Variation| |Variation| /avart-1/
gram#1[4]           |Cycle| --> |Theka|
gram#1[5]           |Variation| --> dha tirakita dhin dhin dha
gram#1[6]           |Variation| --> dha dhin tirakita ta tirakita dhin
gram#1[7]           |Theka| --> dha dhin dhin dha dha dhin dhin dha
gram#1[8]           |Tihai| --> dha tirakita dhin - dha tirakita dhin - dha tirakita dhin

 

The /avart=4/ flag allows exactly 4 cycles (āvart) of variations (rule 3). When the counter reaches 0, only rule 4 (simple theka) remains available, then the grammar converges to the tihāī (rule 8). This is a faithful modeling of the structure of a kayda: theme → variations over N cycles → final cadence [BelKippen1992a].

Flag + weight interaction: two-level control

Flags and weights can coexist in the same grammar, offering two levels of control:

 

gram#1[1] /avart=15/ |S| --> <30-6> |A| |S| /avart-1/
gram#1[2]            |S| --> <1> -

 

Here, rule 1 has two guards:

  • The avart flag must be > 0 (logical guard)
  • The decremental weight <30-6> makes the rule less and less probable (probabilistic guard)

The first of the two to exhaust itself stops the recursion. With avart=15 (exhaustion in 15 steps) and <30-6> (exhaustion in 5 steps), the weight wins: the recursion will probably stop around 5 iterations, well before the flag reaches 0.

This dual control allows defining a hard limit (the flag: at most 15 iterations, never more) and a soft tendency (the weight: on average 4-5 iterations, with variation).


5. Expressive power of decremental weights

Decremental weights are linear (<N-M> subtracts M at each step) — there is no exponential or logarithmic decay. But this simple mechanism produces rich behaviors thanks to renormalization and the combinatorial interaction between rules.

Implicit increment by renormalization

The first counter-intuitive observation: decrementing one rule increments the others. If two rules have weights [50, 1] and only the first decrements, the second goes from P = 1/51 = 2% to P = 1/3 = 33% without its weight having moved. Decremental weights thus offer incremental control for free — simply decrement what you want to see disappear.

Single shot: <1-1>

A <1-1> weight cancels itself after a single use. This is a one-time event: the rule can trigger at most once, then disappears. Useful for an introduction, a harmonic surprise, or an ornament that should not be repeated:

 

gram#1[1] |S| --> <1-1> |Surprise| |S|
gram#1[2] |S| --> <5>   |Normal| |S|
gram#1[3] |S| --> <1>   -

 

The surprise has a chance to occur at the beginning (1/7 ≈ 14%), then cannot return.

Immortal anchor: <N> without decrement

A fixed-weight rule never dies. When all others exhaust themselves, it becomes the sole survivor — an attractor towards which the grammar inevitably converges. This is the role of the Coda in the Theme/Variation/Coda example: its <1> weight doesn’t move, but its probability grows to 100%.

Synchronized vs. staggered death

The N/M ratio determines a rule’s lifespan: ceil(N/M) steps. By calibrating the ratios, the temporal form of the piece is controlled:

Strategy Ratios Musical effect
Synchronized death <40-8> and <10-2> (ratio 5 and 5) Theme and variation die together → abrupt coda
Staggered death <40-8> and <50-2> (ratio 5 and 25) Theme dies, variation survives long → gradual transition
Succession <10-5>, <30-3>, <1> (ratio 2, 10, ∞) First motif A dominates, then B takes over, then C inherits

Succession is particularly interesting: it creates a relay form where behaviors pass the torch, without any explicit programming of the temporal structure.

Non-linear relationship between rules

Each weight decrements linearly, but the ratio between two weights evolves non-linearly. If A has <100-10> and B has <50-2>:

Step w(A) w(B) Ratio A/B
1 100 50 2.0
3 80 46 1.7
5 60 42 1.4
7 40 38 1.05
9 20 34 0.59
11 0 30 0.0

The ratio goes from 2.0 to 0 — A dominates first, then B takes over. The ratio curve is non-linear (it accelerates towards the end) even if individual decrements are constant. Two straight lines descending at different speeds produce a curved ratio.

Phase transition

An extreme ratio between weight and decrement creates an abrupt switch rather than a gradual fade:

  • <100-99>: P ≈ 99% for 1 step, then 0% → switch
  • <100-10>: P ≈ 90%+ for 9 steps, then drops → plateau + cliff
  • <100-1>: P decreases very slowly over 100 steps → long fade

The composer chooses the form of the transition by calibrating the N/M ratio.

Limitation: linear profile only

Despite this combinatorial richness, the decline of each individual rule remains strictly linear. A true exponential decline (division by 2 at each step) or logarithmic decline (rapid decline then plateau) is not expressible. This limitation does not change formal expressiveness (an exponential weight remains context-free), but it restricts the palette of temporal profiles available to the composer.


Key takeaways

  • Flags are named conditional counters, manipulated by six operators: test (""), assignment ( = ), increment (+), decrement (-), greater than (>), less than (<).
  • Flags are divided into guards (applicability conditions) and effects (state modifications).
  • Decremental weights <N-M> decrease by M with each use, reaching 0 in ceil(N/M) steps, which guarantees termination of recursions.
  • The categorical distribution is renormalized at each step: probabilities are dynamically recalculated, which fundamentally distinguishes BP3 from PCFGs.
  • In SuperCollider, BP2SC translates flags into Prout with if/else structures and decremental weights into mutable local variables with .max(0).
  • Flags offer logical control (switch), decremental weights offer probabilistic control (dimmer). Combined, they allow two-level control.

To go further

  • BP3 Documentation: Bol Processor — Flags and Conditions
  • Dynamic Weights: Bol Processor — Grammar Control
  • PCFG and beyond: Lari & Young (1990), “The estimation of stochastic context-free grammars using the Inside-Outside algorithm” — to understand why classic PCFGs are not sufficient for dynamic control
  • Non-Markovian stochastic processes: Feller, An Introduction to Probability Theory and Its Applications, vol. 2, chapter on processes with memory
  • Raga and controlled improvisation: Subramanian (2007), “Generative Grammar of Carnatic Music” — a grammatical model of raga improvisation
  • The foundational article: Bel, B. & Kippen, J. (1992), “Modelling Music with Grammars: Formal Language Representation in the Bol Processor” — flags and weights applied to tabla
  • The ethnomusicological context: Kippen, J. (1988), The Tabla of Lucknow: A Cultural Analysis of a Musical Tradition, Cambridge University Press

Glossary

  • Ālāp: Opening of a raga where notes are introduced progressively (Sa, then Sa-Re, then Sa-Re-Ga…). Its accumulative structure exceeds the capabilities of flags (counters) and requires BP3’s context-sensitive extensions (B6).
  • Categorical (distribution): Discrete probability distribution over a finite set of categories, each with its own weight. Generalizes rolling a loaded die to an arbitrary number of faces.
  • Configuration (SOS): Tuple representing the complete state of the system during derivation. For BP3 with flags and weights: (σ, φ, t, w) — working string, flag environment, time, weight function.
  • Āvart: A complete cycle of tāla. A kayda can extend over several āvart before concluding with a tihāī.
  • Convergence: Property of a process that tends towards a final state. Decremental weights converge to 0, forcing termination.
  • Decrement: Decrease in a value. In <50-12>, the decrement is 12: the weight loses 12 with each use.
  • embedInStream: SuperCollider method that injects events from a pattern into the current stream of a Prout. This is the idiomatic way to “play” a sub-pattern from a routine.
  • Flag environment (φ): Function that associates each flag name with its current integer value. Notation: φ(avart) = 4.
  • Flag: Named variable attached to BP3 rules, serving as a conditional counter. Can be tested, assigned, incremented, or decremented.
  • Guard: Condition that must be satisfied for a rule to apply. Flags in test mode (/avart/, /avart>2/) function as guards.
  • Functional update: Operation that creates a new environment identical to the old one except for one variable. Notation: φ[avart ↦ 3] means “φ with avart changed to 3.”
  • Decremental weight: Weight associated with a rule that decreases after each use of that rule. BP3 notation: <N-M> (initial weight N, decrement M).
  • Prout: Lazy routine in SuperCollider. Produces events one by one via yield, allowing imperative logic (loops, conditions) within a pattern flow.
  • Renormalization: Recalculation of probabilities after weight modification. If weights change from [50, 1] to [38, 1], probabilities are recalculated from [98%, 2%] to [97.4%, 2.6%].
  • Kayda: Tabla composition with a fixed theme (mukhra) and systematic variations over several tāla cycles, concluding with a tihāī.
  • Guaranteed termination: Property of a system that necessarily reaches a final state in a finite number of steps. Decremental weights guarantee a maximum of ceil(N/M) + 1 steps.
  • Tihāī: Indian cadence where a motif is repeated exactly three times to land on sam (the first beat of the cycle).
  • Vādi: Dominant note of a raga, the most frequent and important. Its regular presence can be modeled by a BP3 flag.

Prerequisites: B1, B3, L6
Reading time: 12 min
Tags: #flags #weights #control #BP3 #stochastic #SOS