MNS Music Engine


An Introduction To The MNS Music Engine

countersoul-javascript-code

The Generative MNS Music Engine (MNS-ME) is an advanced algorithmic system for creating continuously evolving musical outputs, which form the basis of our creative projects and applications. Since itws development began in late 2021, we have meticulously refined this engine to push the boundaries of real-time music generation.

Two Core Applications Of The MNS Music Engine

The MNS-ME is a web-based music composition system designed to serve diverse creative contexts. It outputs via two distinct modes, an internal audio synthesiser and external MIDI control.

// MIDI Control Platform

This mode allows for external control of external musical instrument hardware and software. This makes it ideal for live performances  or studio settings using MIDI-enabled synthesisers where sonic precision and adaptability are important. The MNS-ME also responds to external MIDI input allowing for interactive control over music generation.

// Web Audio Sound System

Built on the Web Audio API, this mode supports high-quality sound synthesis along with the generative sequencing, directly within modern browsers.
It enables fully interactive generative experiences on virtually any device, without requiring additional software or hardware.

Features and Advantages

Grounded in music theory and built with cutting-edge algorithms, our Generative Music System stands out as a tool for creating original, adaptive, and evolving compositions that transcend traditional sequencing systems.

// Truly Generative Design

Unlike systems that depend on musical sequencing, pre-recorded loops, pre-trained models, or large external datasets, the MNS-ME operates entirely on the principles of music theory and hand-crafted algorithmic creativity. By avoiding reliance on external data, it ensures every musical output is completely original and transparently generated through its processes. This principled approach to music creation eliminates copyright concerns and highlights the system commitment to clarity and innovation, entirely free from the complexities of dataset-dependent systems.

// Endless Creative Potential

The MNS-ME produces high-quality, endlessly evolving musical variations with minimal oversight once started. It is capable of generating unique variations of a work on each generation, or can be fixed to produce a deterministic outcome when desired. Using dynamic algorithms it generates compositions that feel both fluid and engaging. Integrating music theory deeply into its processes, the system ensures that each output is harmonically and structurally sound. This thoughtful balance of complexity and accessibility makes it a robust platform for creating evolving pieces that maintain listener engagement and foster authentic music experiences.

// Evolving and Adaptive

The MNS-ME can respond dynamically to both static and real-time data inputs, enabling responsive adaptation of its musical outputs. Parameters such as rhythm, melody, harmony, and texture can shift and evolve in response to changes in the input data. Whether using predefined static values, algorithmically generated parameter changes, or live-streamed data, the system creates an interconnected musical experience where every detail reflects the input source. This feature ensures an ever-changing, engaging, and highly tailored generative output.

// Efficient and Lightweight

The Music System achieves remarkable efficiency with a total codebase size of just 70KB, eliminating the need for large pre-trained datasets or external models. This compact design ensures smooth performance across devices while providing universal accessibility and minimal resource consumption. With no additional software or downloads required, users can access high-quality generative music directly through their browsers on any modern device, making it both practical and widely inclusive.

Generative Sequencers

The MNS-ME includes five core generative sequencers, each designed to offer distinct approaches to rhythmic, harmonic, and melodic creation.

// walkGen

This sequencer generates stepwise melodies and patterns through a controlled random walk. It leverages pitch quantisation to fit notes into a chosen scale or key, and probabilistic rhythmic models that ensuring musicality while maintaining an element of unpredictability.

// stepGen

Designed for precise control, the Step Generator sequencer allows for static or pre-determined pitch sequences. It’s ideal for creating repeating motifs or intricate, layered patterns that form the backbone of a composition.

// chordGen

The Chord Generator generates dynamic chord formations and progressions by adapting harmonic structures to a given key or mode. It supports custom voicing, rhythmic density, and evolving textures, making it highly versatile for harmonic exploration.

// Euclidean

Employing mathematical algorithms, this sequencer distributes beats evenly across a sequence, enabling intricate rhythmic patterns that balance structure and variety.

// Arpeggiator

The arpeggiator constructs cascading note sequences by traversing chord tones in algorithmic patterns. It employs scale-aware pitch mapping to maintain harmonic coherence, while integrating stochastic timing variations to introduce expressive, evolving rhythmic textures.

Instrument Design

The Music Engine’s instruments offer unparalleled flexibility and creative potential, each featuring:

Multiple Oscillators

Every instrument is composed of two fully assignable pitched oscillators and a noise-based oscillator, enabling a broad range of sound design possibilities.

Subtractive and FM Modes

Instruments can operate using subtractive synthesis, frequency modulation (FM), or physical modelling modes, allowing different synthesis approaches within the same framework.

Sequencer Agnostic


Any instrument can receive input from any generative sequencer, enabling flexible routing between synthesis engines and pattern generators.

Instrument Effects

Each instrument’s voices (with variable voice count per instrument) sum to a dedicated insert point where chorus can be applied directly. The signal then routes through send/return busses, allowing control over delay and convolution reverb levels via auxiliary sends. This routing architecture provides both creative flexibility and efficient CPU usage.

Master Output and Global Effects

The master bus processes all instrument outputs through saturation/soft clipping, three-band equalization, and compression/limiting. This two-tier effects structure allows for instrument-specific processing while maintaining cohesive master-level control.

Scalability

There is no fixed limit to the number of instruments that can be deployed simultaneously, ensuring adaptability for projects of any scale.

Visual Integration

Developed in JavaScript and running directly in the browser, the MNS-ME seamlessly integrates with a wide array of web-based visual frameworks, including P5.js, SVG, and GLSL shaders. It enables deep interconnection between musical and visual parameters, facilitating the creation of intricate generative audiovisual compositions.

This modular approach ensures that the MNS-ME can be tailored to the unique needs of a project, from intricate polyphonic arrangements to dynamic monophonic textures.