The Problem
Musicians and hobbyists often need a local tool that turns lyrics and a chosen style into a finished track without relying on cloud services or expensive hardware. They also want to tweak the generated audio, add stems, and edit sections offline. This repo provides a self‑contained workflow that runs entirely on a user’s machine, delivering a browser‑based studio that uses the YuE2 audio engine.
What This Does
The project exposes a web UI (studio/static/index.html) that talks to a Flask server (studio/app.py).
studio/app.pyregisters endpoints for generating music, downloading models, and editing audio.studio/engine.pyorchestrates the YuE2 engine, callingstudio/yue2.pyfor generation andstudio/yue2_edit.pyfor post‑processing.studio/models.pymanages the catalog of available models (config/model-catalog.json).studio/separate.pyimplements stem separation, delegating to theaudio.cppbinary viastudio/audio.py.studio/cli.pyoffers a command‑line wrapper that starts the server or runs the engine directly (./studio.shuses this).
The UI is bundled in studio/static, with app.js handling the REST calls and lux.js providing styling helpers.
How It Is Wired
Entry Point – studio/app.py is imported by the studio.sh bootstrap script, which first runs scripts/setup.sh.
setup.shinstalls Python viauv, resolves dependencies frompyproject.toml, and builds the audio engine (audio.cpp).- Once dependencies are ready,
studio/app.pycreates a Flaskappand registers routes. - A request to
/generatetriggersengine.generate()instudio/engine.py. engine.generate()loads the chosen model fromconfig/model-catalog.json, callsyue2.generate(), and returns a WAV file.- The UI fetches this file and streams it to the browser.
The hub of the system is engine.generate(): it is the single function that all generation flows pass through. A change here affects model selection, audio buffer handling, and error reporting. The cycle between engine.generate() and audio.py ensures that audio rendering and post‑processing remain decoupled but tightly coordinated.
How To Use It
- Setup – Clone the repo: ``
bash git clone https://github.com/moses-y/lux-in-music`Navigate into the folder and run the bootstrap script:`bash ./studio.sh`This installs Python, compiles the audio engine, and starts the Flask server onhttp://127.0.0.1:8000`.
- Configuration – Models are listed in
config/model-catalog.json. To add a new model, append its metadata there and place the model file in themodels/directory.
- Running – The web UI is automatically opened. If it does not, visit
http://127.0.0.1:8000manually. Use the Settings page to choose a model and adjust parameters defined instudio/params.py.
Real‑World Use
A local songwriting workflow could look like this:
# Start the studio
./studio.sh
# In another terminal, generate a track
curl -X POST http://127.0.0.1:8000/generate \
-H "Content-Type: application/json" \
-d '{"lyrics":"We walk alone","style":"electro"}' > track.wav
# Edit the track
python studio/edit.py track.wav --trim 0:30 --loop 5
# Separate stems
python studio/separate.py track.wav --output stems/
The resulting stems/ folder can be imported into any DAW for further production.
Code Health & Issues
- Low (Dependencies) –
pyproject.tomldeclares packages but no lockfile (uv.lock). Non‑reproducible builds may occur if transitive dependencies change. - Low (Missing CI) – GitHub Actions exist (
.github/workflows/*), but tests are limited to 10 files and do not cover UI or audio rendering paths. - Low (Documentation) – While
README.mdcovers installation, the architectural overview (docs/architecture.md) is sparse.
No other static analysis results are available at this time.
The Bottom Line
Lux In Music offers a complete, offline pipeline from lyrics to finished audio, with an approachable web UI and a Python‑based backend. Its modular design lets developers swap out the YuE2 engine or add new models, but the lack of a lockfile and limited test coverage mean caution is advised when integrating into larger systems. This repo is best suited for researchers or hobbyists who need a quick local prototype rather than a production‑grade service.