Modular Network
Modular Network
Our small spiking neural network evolves to produce polyphonic music across three voices, each reading from the same pool of 255 neurons. The result was coherent but also a bit uniform, as the voices tended to move together. We wanted independent temporal dynamics between voices while keeping the whole thing musically coherent.
Modules
We attempt to address this using a modular architecture. We partition the network into three contiguous blocks of 85 neurons each. Each voice’s readout is wired exclusively to its own module, hard-masked at the output weights, maintained through mutation and crossover. The entire network still evolves as a single organism under a composite fitness score, and the inter-module connections are shaped by selection.
A single parameter, inter_module_factor, controls the ratio of inter-module to intra-module connection density. At 0.1, modules are sparsely coupled: each has its own dense internal wiring, with only 10% as many connections bridging between them. This creates a structural basis for independence while still allowing influence and entrainment.
Metric Gravity
METRIC_WEIGHTS = np.array([4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0])
With independent voices the compositions became more chaotic. The modules found their own rhythmic patterns, which was the goal, but the music lacked tonal grounding, no sense of downbeat or key center. To fix this without constraining the independent voice movement, we added metric gravity to the fitness function.
Each voice is scored on its tendency to play stable tones — root and fifth (or fourth, for the Iwato scale) — on metrically strong beats. The metric weight pattern above is fractal: beat one gets weight 4, the “and” of beat three gets 3, backbeats get 2, eighth notes get 1, and offbeat sixteenths get 0. The scoring is peaked so that networks landing on stable tones about half the time on strong beats score highest. All root all the time is penalized, as is ignoring meter entirely.
The composite fitness is now multiplicative across four components:
fitness = activity × tonal_gravity × repetition_score × metric_gravity
Each factor independently gates the score. A network that plays interesting rhythms but ignores tonal gravity scores near zero, as does one that hits the root on every downbeat but repeats the same two-note pattern.
Correlation
We track module independence via mean pairwise absolute Pearson correlation of per-module firing rates. With inter_module_factor=0.5, this usually hovers around 0.5, loosely coupled. The metric is not part of fitness; it is a diagnostic. The correlation is largely determined by the network topology rather than evolved, which makes sense, the sparse bridges create a structural coupling floor that selection doesn’t push against.
Observations
The per-voice pitch histogram, added as a diagnostic plot, confirms that evolution is leaning toward root and fifth as intended by metric gravity, without fully exploiting it. The pitch distributions remain broad across the scale, with a gentle emphasis on stable tones. The music sounds more grounded and less chaotic, while the voices retain distinct rhythmic identities.
Mixdown
The final mixes, with the original network on the A side and the modularized version on the B side can be heard at The Psychic Geometries Trio.