Skip to main content

Text-to-Music Prompt Structurer

PyPI version License: MPL 2.0

Turn free-form musical ideas into structured prompts for text-to-music workflows.

The package detects genre, mood, BPM, key, instruments, production details, language, voice type, vocal tone, and vocal technique. It has no runtime dependencies and requires Python 3.10 or later.

Install

python -m pip install text-to-music-prompt-structurer

Command line

text-to-music-prompt "neo soul with piano, warm breathy female alto vocals in Spanish, intimate and melismatic, in d minor, nostalgic, 92 bpm"

Output:

STYLE: Soul / Neo Soul
MOOD: Nostalgic, Warm
BPM: ~92
KEY: D Minor
INSTRUMENTS: Piano
PRODUCTION: Warm tone
VOCALS:
  LANGUAGE: Spanish
  VOICE TYPE: Female Lead, Alto
  TONE: Warm, Breathy, Intimate
  STYLE: Melismatic vocals

Python

from text_to_music_prompt_structurer import MusicPromptEngine, format_prompt

prompt = MusicPromptEngine().process(
    "synthwave with 808, dark and dreamy, female vocals in English"
)

print(format_prompt(prompt))

Output:

STYLE: Synthwave
MOOD: Dark, Dreamy
INSTRUMENTS: 808 Bass
PRODUCTION: Dark tone
VOCALS:
  LANGUAGE: English
  VOICE TYPE: Female Lead
  TONE: Dark

process() returns a MusicPrompt object, so applications can use each detected value directly instead of parsing the formatted text. Its fields cover:

  • Musical direction: genre, subgenre, mood, energy, tempo, bpm, and key.
  • Arrangement and sound: instruments, production, rhythm, structure, and era.
  • Vocal direction: language, voice_type, vocal_tone, and vocal_style.

format_prompt() renders only the detected fields as a ready-to-use structured prompt.

Development

git clone https://github.com/edujbarrios/text-to-music-prompt-structurer.git
cd text-to-music-prompt-structurer
python -m pip install -e ".[dev]"
python -m pytest
ruff check .

See CONTRIBUTING.md to add vocabularies or detection strategies. Release history is available in CHANGELOG.md.

License

Copyright © 2026 Eduardo J. Barrios.

This project is licensed under the Mozilla Public License 2.0. MPL 2.0 is a file-level copyleft license: modifications to covered source files must remain available under MPL 2.0, while those files may be combined with code under other licenses. See NOTICE for attribution details.

Release files for text-to-music-prompt-structurer 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for text-to-music-prompt-structurer 0.1.1
File Size Uploaded
text_to_music_prompt_structurer-0.1.1.tar.gz 31.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for text-to-music-prompt-structurer 0.1.1
File Interpreter ABI Platform
text_to_music_prompt_structurer-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 65.7 kB

Release files / text_to_music_prompt_structurer-0.1.1.tar.gz

Download URL text_to_music_prompt_structurer-0.1.1.tar.gz
Size 31.4 kB
Tags Source
SHA-256 checksum
How to use checksums
58a6508de317ea0fba42fc45336399a06ff41a8764f1e52b87c317aa7bb2390e
BLAKE2b-256 checksum
How to use checksums
e6c082c0ba3ba5904fcb1472677dbe80fbb16df19df1ad1ba143699969de771d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.7

Release files / text_to_music_prompt_structurer-0.1.1-py3-none-any.whl

Download URL text_to_music_prompt_structurer-0.1.1-py3-none-any.whl
Size 34.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9a734d1b2e462c04c1e9a250afdfa378ab79c9f7e8d7e582a83a3acd20b2f0f4
BLAKE2b-256 checksum
How to use checksums
c815202e5183c0a2987b693fc2d84de63f329f84588278673f794e5510a073c4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.7

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page