@jmon/algo
v1.1.1
Published
Algorithmic music composition library with generative algorithms, music theory, and format conversion
Maintainers
Readme
jmon/algo
jmon/algo (jam on studio - algorithms) a JavaScript music composition toolkit for the JMON (JSON Music Object Notation) format.
Quick Start:
- Observable Guide - Get started with Observable Classic & Framework 2.0
- API Reference - Complete API documentation
- Interactive Examples - Live Observable notebooks
Features
Algorithmic Composition
- Music theory: Scales, progressions, harmony, rhythm
- Minimalism: Process-based composition techniques
- Generative algorithms: no deep learning, just you, your imagination and math: random walks, Fractals, cellular automata, genetic algorithms, Gaussian processes
JMON Format Conversion
- Tone: Core format validation and Tone.js integration
- ABC notation: Convert JMON to ABC notation
- MIDI: MIDI file conversion utilities
- Display: Score visualization and playback functions
- SuperCollider: JMON format to SuperCollider code
Analysis & Utilities
- Musical analysis tools (usefull for genetic algorithms)
- Format conversion utilities
- Mathematical utilities for music
Development
Building
deno task build # Build ESM and UMD bundlesJupyter Notebooks
- Install Deno: https://deno.com/manual/getting_started/installation
- Install JupyterLab:
pipx install jupyterlab - Install Deno kernel:
deno jupyter --install - Launch:
jupyter-lab - Create a notebook with the Deno kernel
API Overview
Core Functions
| Function | JSR | npm | Description |
|----------|-----|-----|-------------|
| jm.theory.* | ✓ | ✓ | Scales, chords, progressions, intervals |
| jm.generative.* | ✓ | ✓ | Melodies, walks, fractals, cellular automata |
| jm.analysis.* | ✓ | ✓ | Pitch, rhythm, harmony analysis |
| jm.converters.* | ✓ | ✓ | MIDI, ToneJS, WAV, SuperCollider, VexFlow |
| jm.audio.* | ✓ | ✓ | DSP, synthesis, audio processing |
| jm.score(comp, VF, opts) | ✓ | ✓ | Sheet music (requires VexFlow param) |
| jm.play(comp, opts) | ✗ | ✓ | Audio playback (npm only) |
| jm.render(comp, opts) | ✗ | ✓ | Full UI player (npm only) |
Parameter-Based Dependencies
jmon/algo has zero dependencies in the JSR package. Libraries are passed as parameters:
// VexFlow for notation (both JSR and npm)
const notation = jm.score(composition, vexflowInstance, options);
// Tone.js for audio (npm package only)
const player = jm.play(composition, {Tone: toneInstance});This design allows you to:
- Use any version of VexFlow or Tone.js
- Load libraries from CDN in browsers
- Avoid dependency bloat in Deno/Node
- Pass mocked libraries for testing
License
GPL-3
