______ ___ ___
/\ _ \ /\_ \ /\_ \
\ \ \L\ \\//\ \ \//\ \ __ __ ___ ___ __
\ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\ /' __` __`\ /'__`\
\ \ \/\ \ \_\ \_ \_\ \_/\ \L\.\_/\ \L\ \/\ \/\ \/\ \/\ \L\.\_
\ \_\ \_\/\____\/\____\ \__/.\_\ \____ \ \_\ \_\ \_\ \__/.\_\
\/_/\/_/\/____/\/____/\/__/\/_/\/___L\ \/_/\/_/\/_/\/__/\/_/
/\____/
\_/__/
allagma is both:
- A composition project with the title “Allagma” by Adam Łukawski.
- A standalone software tool for generating new compositions with DCN + LLMs.
Demo:
The generator:
- Authenticates to a Decentralised Creative Network server.
- Creates a vocabulary of musical Particles on the Decentralised Creative Network (via OpenAI agent).
- Executes Particles (
/execute) to get scalar streams (time,duration,pitch, etc.). - Schedules runs into one timeline.
- Writes output JSON and auto-generates a MIDI file.
Main script:
generator.py
MIDI tool:
tools/pt2midi.js
- Python 3.10+
- Node.js 18+ (for MIDI export)
- Access to a DCN API endpoint (default:
https://api.decentralised.art) - OpenAI API key
- Open the repo directory:
cd /Users/sunsetsobserver/hypermusic_corp/allagma- Install Python dependencies:
python3 -m pip install -r requirements.txt- Install Node dependencies (for MIDI export):
npm install- Set your OpenAI API key (choose one):
Option A: secrets.py (local file, gitignored):
OPENAI_API_KEY = "sk-..."Option B: environment variable:
export OPENAI_API_KEY="sk-..."- Optional: set a persistent wallet private key:
export PRIVATE_KEY="0x..."If you skip this, the script creates an ephemeral account each run.
Generate a composition with 8 vocabulary elements against the public DCN API:
python3 generator.py 8 --api-base https://api.decentralised.artQuick smoke test (faster):
python3 generator.py 1 --api-base https://api.decentralised.artUse local DCN server:
python3 generator.py 8 --api-base http://localhost:54321After a run, the main outputs are:
vocabulary.jsonphase2_composition.jsonplayer_payload_merged.jsonplayer_payload_merged.mid
Historical example outputs are under Compositions/.
MIDI export runs automatically at the end of generation.
To disable:
NO_MIDI=1 python3 generator.py 8 --api-base https://api.decentralised.artIf MIDI export fails with missing jzz, run:
npm installYou can use this repo as a standalone composition tool by changing the generation prompt and parameters.
Main ways to customize:
- Edit the composition prompt text in
generator.py(the largeuser_promptstring inside the vocabulary loop). - Change vocabulary size (
num_vocabargument). - Change models:
python3 generator.py 8 --feature-model gpt-4.1 --scheduler-model gpt-4o-mini- Change API endpoint (
--api-base) to target your own DCN server.
- Contract/feature names are sanitized automatically to Solidity-safe identifiers.
secrets.pyis ignored by git (.gitignore), but still avoid sharing keys.