Zing Forum

Reading

KComplexExplorer: An Interactive Tool for Exploring Musical Set Theory Using Neural Networks

A PWA application combining music theory and machine learning that allows users to explore twelve-tone sets, train personalized neural networks, and generate chord matrices aligned with individual aesthetic preferences.

音乐理论音级集合Forte编号机器学习TensorFlow.js神经网络无调性音乐和弦生成PWAWeb Audio API
Published 2026-06-01 08:12Recent activity 2026-06-01 08:22Estimated read 7 min
KComplexExplorer: An Interactive Tool for Exploring Musical Set Theory Using Neural Networks
1

Section 01

KComplexExplorer: An Interactive Set Exploration Tool Combining Music Theory and Machine Learning

KComplexExplorer is a Progressive Web App (PWA) for music theorists, composers, and researchers. It skillfully combines traditional pitch-class set theory (e.g., the Forte numbering system) with modern machine learning technology (TensorFlow.js), offering functions for in-depth set exploration, personalized preference training, and chord matrix generation. Its core value lies in transforming abstract music theory into an intuitive interactive experience, empowering creative musical activities.

2

Section 02

Background: Pitch-Class Set Theory and the Need for Interactive Tools

Pitch-class set theory is an atonal music analysis system developed after World War II, systematically expounded by Allen Forte in his 1973 work The Structure of Atonal Music. It treats the 12 semitones within an octave as equivalent pitch classes (represented by 0-11, with 0=C) and analyzes pitch relationships mathematically. Traditional learning relies on table symbols, which are abstract and lack intuitive experience. KComplexExplorer aims to address this pain point by providing a visual and audible exploration platform.

3

Section 03

Core Features: Set Analysis and Interactive Experience

Supports pitch-class set analysis for cardinalities 1-12, identified by Forte numbers (e.g., 3-11A) and accompanied by common musical names; uses the ultra-mega-enumerator library for efficient set identification, transposition/inversion transformations, and interval vector calculation; supports subset/superset hierarchy visualization to help understand the internal connections of pitch materials; integrates Web Audio API, offering three playback modes—ascending arpeggio, descending arpeggio, and simultaneous sounding—to intuitively experience acoustic characteristics.

4

Section 04

Machine Learning Module: Personalized Preference Training and Prediction

Integrates a TensorFlow.js neural network; users can emotionally label sets (like +1/neutral 0/dislike -1), and the labeled data plus set features (interval vectors, cardinality, etc.) form the training set; supports CSV export of datasets; the model uses a tanh activation function to output continuous prediction values, which are fuzzified into discrete categories (attract/neutral/reject) via a three-way division method; trained model weights can be exported, and all operations are completed in the browser to ensure privacy.

5

Section 05

Personalized Chord Matrix Generation: Constraints and Parameter Control

Generates chord matrices aligned with user preferences based on the trained model; uses a backtracking search algorithm to ensure that cells, the union of previous row pairs, and column unions are all 'attractive'; provides two key parameters: stiffness (controls the Hamming distance between adjacent chords—higher stiffness means smoother transitions) and rest weight (controls the probability of repeated chords); uses a seeded pseudorandom number generator, so results can be reproduced with the same parameters and seed, facilitating saving and sharing.

6

Section 06

Technical Architecture: Multi-Platform Support and Extensibility

Adopts a PWA architecture, supporting browser access and local installation (offline functionality); provides a Node.js-based CLI tool with subcommands like analyze/identify/list (except MIDI playback); integrates an MCP server, allowing LLM agents to access set analysis functions via standardized interfaces, empowering AI-assisted music creation.

7

Section 07

Application Scenarios: Value for Multiple User Groups

For learners: Lowers the threshold for learning set theory, visualizing and sonifying abstract concepts; for composers: Discovers new harmonic materials and breaks through tonal limitations; for researchers: Batch analysis and data export support academic research; for developers: MCP server integration provides a reference for AI music applications.

8

Section 08

Summary and Outlook: Innovative Directions for the Integration of Music Theory and AI

KComplexExplorer is an innovative attempt at integrating music theory and AI, quantifying subjective aesthetics into trainable models to empower creative fields; its open-source modular design supports community contributions and secondary development; with the development of Web Audio and TensorFlow.js technologies, browser-based AI music tools have great potential in the future.