canturia 0.2.0__tar.gz → 0.2.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {canturia-0.2.0 → canturia-0.2.2}/CLAUDE.md +5 -1
- {canturia-0.2.0 → canturia-0.2.2}/PKG-INFO +9 -2
- {canturia-0.2.0 → canturia-0.2.2}/README.md +8 -1
- {canturia-0.2.0 → canturia-0.2.2}/SPEC.md +7 -1
- {canturia-0.2.0 → canturia-0.2.2}/pyproject.toml +1 -1
- {canturia-0.2.0 → canturia-0.2.2}/src/canturia/__init__.py +1 -1
- {canturia-0.2.0 → canturia-0.2.2}/src/canturia/cli.py +5 -0
- {canturia-0.2.0 → canturia-0.2.2}/src/canturia/core.py +18 -1
- canturia-0.2.2/src/canturia/languages.py +21 -0
- {canturia-0.2.0 → canturia-0.2.2}/src/canturia/providers/ollama.py +4 -15
- {canturia-0.2.0 → canturia-0.2.2}/src/canturia/serve_page.html +6 -4
- {canturia-0.2.0 → canturia-0.2.2}/tests/test_core.py +21 -1
- {canturia-0.2.0 → canturia-0.2.2}/uv.lock +1 -1
- {canturia-0.2.0 → canturia-0.2.2}/.gitignore +0 -0
- {canturia-0.2.0 → canturia-0.2.2}/LICENSE +0 -0
- {canturia-0.2.0 → canturia-0.2.2}/src/canturia/__main__.py +0 -0
- {canturia-0.2.0 → canturia-0.2.2}/src/canturia/config.py +0 -0
- {canturia-0.2.0 → canturia-0.2.2}/src/canturia/providers/__init__.py +0 -0
- {canturia-0.2.0 → canturia-0.2.2}/src/canturia/providers/acestep.py +0 -0
- {canturia-0.2.0 → canturia-0.2.2}/src/canturia/serve.py +0 -0
- {canturia-0.2.0 → canturia-0.2.2}/tests/test_acestep.py +0 -0
- {canturia-0.2.0 → canturia-0.2.2}/tests/test_cli.py +0 -0
- {canturia-0.2.0 → canturia-0.2.2}/tests/test_config.py +0 -0
- {canturia-0.2.0 → canturia-0.2.2}/tests/test_ollama.py +0 -0
- {canturia-0.2.0 → canturia-0.2.2}/tests/test_serve.py +0 -0
|
@@ -61,7 +61,11 @@ uv run --no-sync canturia "[Verse]\nMorning light" -g folk -t 10 -o /tmp/x.mp3 \
|
|
|
61
61
|
- `batch_size` defaults to 2; Canturía always sends 1.
|
|
62
62
|
- `thinking: true` + `vocal_language` are sent explicitly on the reliable paths.
|
|
63
63
|
- ACE-Step's `sample_mode`/`sample_query` (Surprise) is a chaos knob; duration
|
|
64
|
-
and language are not reliable there.
|
|
64
|
+
and language are not reliable there. `vocal_language` is ignored in that
|
|
65
|
+
path. Canturía appends "with lyrics in English and English vocals, about N
|
|
66
|
+
seconds long" to the description; it is the only lever that moved language
|
|
67
|
+
(Vietnamese → Danish → Swedish → English across four runs). Length still
|
|
68
|
+
came back 144–188 s for 30–45 s requests.
|
|
65
69
|
- `/format_input` honours duration/language but may return `[Instrumental]` for
|
|
66
70
|
sung vocals; do not use it as the topic path.
|
|
67
71
|
- First cold request loads/downloads ~8 GB of weights; default timeout is 900 s.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: canturia
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.2
|
|
4
4
|
Summary: A small, privacy-first text-to-song tool: lyrics or a topic plus a genre, rendered by your own ACE-Step server.
|
|
5
5
|
Project-URL: Homepage, https://github.com/michael-borck/canturia
|
|
6
6
|
Project-URL: Repository, https://github.com/michael-borck/canturia
|
|
@@ -177,6 +177,13 @@ lyrics first, and ACE-Step receives explicit lyrics, `audio_duration`,
|
|
|
177
177
|
`vocal_language: en`, and `thinking: true`. A 30 s request came back at exactly
|
|
178
178
|
30.000 s.
|
|
179
179
|
|
|
180
|
+
For the raw **Surprise me** path, Canturía appends "with lyrics in English and
|
|
181
|
+
English vocals, about N seconds long" to the description, because putting the
|
|
182
|
+
language in the words is the only lever that moved the 5Hz LM in testing. It is
|
|
183
|
+
still best-effort: the same prompt produced Vietnamese, Danish, Swedish, and
|
|
184
|
+
English across four runs, and 30–45 s requests came back at 144–188 s. Treat
|
|
185
|
+
Surprise as a novelty, not a contract.
|
|
186
|
+
|
|
180
187
|
`resident: true` still earns its VRAM: `thinking: true` improves audio and
|
|
181
188
|
metadata backfill, and the raw Surprise path stays available. The server's own
|
|
182
189
|
lyrics writer is never used by the topic box.
|
|
@@ -206,7 +213,7 @@ cargo install tauri-cli --locked
|
|
|
206
213
|
cd desktop && cargo tauri dev
|
|
207
214
|
```
|
|
208
215
|
|
|
209
|
-
The sidecar installs `canturia[serve]==0.2.
|
|
216
|
+
The sidecar installs `canturia[serve]==0.2.2` from PyPI. For local Python
|
|
210
217
|
changes, set `CANTURIA_DEV_PATH="$PWD"` to install the repo in editable mode
|
|
211
218
|
instead.
|
|
212
219
|
|
|
@@ -144,6 +144,13 @@ lyrics first, and ACE-Step receives explicit lyrics, `audio_duration`,
|
|
|
144
144
|
`vocal_language: en`, and `thinking: true`. A 30 s request came back at exactly
|
|
145
145
|
30.000 s.
|
|
146
146
|
|
|
147
|
+
For the raw **Surprise me** path, Canturía appends "with lyrics in English and
|
|
148
|
+
English vocals, about N seconds long" to the description, because putting the
|
|
149
|
+
language in the words is the only lever that moved the 5Hz LM in testing. It is
|
|
150
|
+
still best-effort: the same prompt produced Vietnamese, Danish, Swedish, and
|
|
151
|
+
English across four runs, and 30–45 s requests came back at 144–188 s. Treat
|
|
152
|
+
Surprise as a novelty, not a contract.
|
|
153
|
+
|
|
147
154
|
`resident: true` still earns its VRAM: `thinking: true` improves audio and
|
|
148
155
|
metadata backfill, and the raw Surprise path stays available. The server's own
|
|
149
156
|
lyrics writer is never used by the topic box.
|
|
@@ -173,7 +180,7 @@ cargo install tauri-cli --locked
|
|
|
173
180
|
cd desktop && cargo tauri dev
|
|
174
181
|
```
|
|
175
182
|
|
|
176
|
-
The sidecar installs `canturia[serve]==0.2.
|
|
183
|
+
The sidecar installs `canturia[serve]==0.2.2` from PyPI. For local Python
|
|
177
184
|
changes, set `CANTURIA_DEV_PATH="$PWD"` to install the repo in editable mode
|
|
178
185
|
instead.
|
|
179
186
|
|
|
@@ -89,7 +89,7 @@ on the Mac App Store (runtime-download rules).
|
|
|
89
89
|
|---|---|---|---|
|
|
90
90
|
| `topic` *(default)* | Topic / theme / sentence | Ollama writes lyrics → ACE-Step `prompt` + `lyrics` + exact `audio_duration` + `vocal_language` + `thinking` | Yes |
|
|
91
91
|
| `lyrics` | Lyrics with `[Verse]` / `[Chorus]` tags | Same ACE-Step path; words pass through | Yes |
|
|
92
|
-
| `describe` | Topic / sentence | ACE-Step `sample_mode: true` + `sample_query` | No — experimental |
|
|
92
|
+
| `describe` | Topic / sentence | ACE-Step `sample_mode: true` + `sample_query` with an appended English + length hint | No — experimental |
|
|
93
93
|
|
|
94
94
|
`prompt` is built from the genre preset plus optional style details, e.g.
|
|
95
95
|
`gentle acoustic folk, warm vocals, fingerpicked guitar, close mic`.
|
|
@@ -101,6 +101,12 @@ writes the lyrics locally in one call; ACE-Step receives explicit lyrics, an
|
|
|
101
101
|
exact duration, English vocals, and `thinking: true`. A 30 s request returned
|
|
102
102
|
30.000 s.
|
|
103
103
|
|
|
104
|
+
For Surprise/describe, the language demand is put into the description itself
|
|
105
|
+
("with lyrics in English and English vocals, about N seconds long"), because
|
|
106
|
+
`vocal_language` is ignored in sample mode. This is a strong suggestion, not a
|
|
107
|
+
contract: testing produced Vietnamese, Danish, Swedish, and English from the
|
|
108
|
+
same English prompt, and 30–45 s requests returned 144–188 s.
|
|
109
|
+
|
|
104
110
|
The web UI reads `/health` and `/api/ollama`, disables the topic box when Ollama
|
|
105
111
|
is offline, and disables Surprise when ACE-Step's own LM is off
|
|
106
112
|
(`llm_initialized: false`). `resident: true` stays useful for `thinking: true`,
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "canturia"
|
|
7
|
-
version = "0.2.
|
|
7
|
+
version = "0.2.2"
|
|
8
8
|
description = "A small, privacy-first text-to-song tool: lyrics or a topic plus a genre, rendered by your own ACE-Step server."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = { text = "MIT" }
|
|
@@ -358,6 +358,11 @@ def describe(
|
|
|
358
358
|
For the reliable topic path, use `canturia topic`.
|
|
359
359
|
"""
|
|
360
360
|
try:
|
|
361
|
+
console.print(
|
|
362
|
+
"[yellow]Describe is best-effort: Canturía asks for English and "
|
|
363
|
+
"the chosen length, but ACE-Step may ignore both. Use "
|
|
364
|
+
"`canturia topic` or supply lyrics for guarantees.[/yellow]"
|
|
365
|
+
)
|
|
361
366
|
_run_generate(
|
|
362
367
|
"describe",
|
|
363
368
|
topic,
|
|
@@ -10,6 +10,7 @@ from pathlib import Path
|
|
|
10
10
|
from typing import Any
|
|
11
11
|
|
|
12
12
|
from canturia.config import resolve_ollama_settings
|
|
13
|
+
from canturia.languages import language_name
|
|
13
14
|
from canturia.providers import (
|
|
14
15
|
AceStepClient,
|
|
15
16
|
OllamaClient,
|
|
@@ -119,10 +120,26 @@ def build_request(
|
|
|
119
120
|
seconds = validate_duration(duration)
|
|
120
121
|
prompt = genre_prompt(genre, style)
|
|
121
122
|
if mode == "describe":
|
|
123
|
+
language = language_name(vocal_language)
|
|
124
|
+
# The 5Hz LM ignores vocal_language in sample mode. The only lever
|
|
125
|
+
# that moved it in testing was putting the language in the description
|
|
126
|
+
# itself. This is still best-effort, not a contract.
|
|
127
|
+
lower = source.lower()
|
|
128
|
+
already_asks = (
|
|
129
|
+
f"in {language.lower()}" in lower
|
|
130
|
+
or f"{language.lower()} lyrics" in lower
|
|
131
|
+
)
|
|
132
|
+
if already_asks:
|
|
133
|
+
sample_query = f"{source}, about {seconds:g} seconds long"
|
|
134
|
+
else:
|
|
135
|
+
sample_query = (
|
|
136
|
+
f"{source}, with lyrics in {language} and {language} vocals, "
|
|
137
|
+
f"about {seconds:g} seconds long"
|
|
138
|
+
)
|
|
122
139
|
return SongRequest(
|
|
123
140
|
prompt=prompt,
|
|
124
141
|
duration=seconds,
|
|
125
|
-
sample_query=
|
|
142
|
+
sample_query=sample_query,
|
|
126
143
|
model=model,
|
|
127
144
|
thinking=thinking,
|
|
128
145
|
vocal_language=vocal_language,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"""Small language-code to display-name map for prompts."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
LANGUAGE_NAMES = {
|
|
6
|
+
"en": "English",
|
|
7
|
+
"es": "Spanish",
|
|
8
|
+
"fr": "French",
|
|
9
|
+
"de": "German",
|
|
10
|
+
"it": "Italian",
|
|
11
|
+
"pt": "Portuguese",
|
|
12
|
+
"nl": "Dutch",
|
|
13
|
+
"ja": "Japanese",
|
|
14
|
+
"ko": "Korean",
|
|
15
|
+
"zh": "Chinese",
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def language_name(code: str | None) -> str:
|
|
20
|
+
value = (code or "en").strip().lower()
|
|
21
|
+
return LANGUAGE_NAMES.get(value, value or "English")
|
|
@@ -13,6 +13,8 @@ from typing import Any
|
|
|
13
13
|
|
|
14
14
|
import requests
|
|
15
15
|
|
|
16
|
+
from canturia.languages import language_name
|
|
17
|
+
|
|
16
18
|
# Prefer models that follow a "return only the lyrics" instruction. qwen3 (not
|
|
17
19
|
# 3.5) tends to put its planning in `content` even with think=false; keep it as
|
|
18
20
|
# a last resort.
|
|
@@ -27,19 +29,6 @@ PREFERRED_MODELS = (
|
|
|
27
29
|
"qwen3",
|
|
28
30
|
)
|
|
29
31
|
|
|
30
|
-
_LANGUAGE_NAMES = {
|
|
31
|
-
"en": "English",
|
|
32
|
-
"es": "Spanish",
|
|
33
|
-
"fr": "French",
|
|
34
|
-
"de": "German",
|
|
35
|
-
"it": "Italian",
|
|
36
|
-
"pt": "Portuguese",
|
|
37
|
-
"nl": "Dutch",
|
|
38
|
-
"ja": "Japanese",
|
|
39
|
-
"ko": "Korean",
|
|
40
|
-
"zh": "Chinese",
|
|
41
|
-
}
|
|
42
|
-
|
|
43
32
|
_TAG_RE = re.compile(
|
|
44
33
|
r"^\s*\[(Verse|Chorus|Bridge|Intro|Outro|Pre-Chorus)", re.IGNORECASE
|
|
45
34
|
)
|
|
@@ -166,12 +155,12 @@ class OllamaClient:
|
|
|
166
155
|
raise OllamaError("Give me a topic or a few words to write about.")
|
|
167
156
|
|
|
168
157
|
model = self.resolve_model()
|
|
169
|
-
|
|
158
|
+
language_text = language_name(language)
|
|
170
159
|
line_target = max(4, min(16, round(float(duration) / 5)))
|
|
171
160
|
style_text = (style or "").strip()
|
|
172
161
|
style_line = f"\nStyle details: {style_text}." if style_text else ""
|
|
173
162
|
user = (
|
|
174
|
-
f"Write original {genre} song lyrics in {
|
|
163
|
+
f"Write original {genre} song lyrics in {language_text} about: "
|
|
175
164
|
f"{subject}\n"
|
|
176
165
|
f"Aim for about {int(duration)} seconds of music, roughly "
|
|
177
166
|
f"{line_target} lyric lines across the sections."
|
|
@@ -231,7 +231,7 @@
|
|
|
231
231
|
<div class="bar">
|
|
232
232
|
<button class="primary" id="go" type="button">Generate</button>
|
|
233
233
|
<button class="secondary" id="surprise" type="button"
|
|
234
|
-
title="Let ACE-Step invent the lyrics.
|
|
234
|
+
title="Let ACE-Step invent the lyrics. Canturía asks for English, but length and language are best-effort.">
|
|
235
235
|
Surprise me
|
|
236
236
|
</button>
|
|
237
237
|
<span class="hint">⌘⏎ / Ctrl⏎ to generate</span>
|
|
@@ -254,9 +254,11 @@
|
|
|
254
254
|
help the singer. Your lyrics go straight to ACE-Step; length is honoured
|
|
255
255
|
exactly.</p>
|
|
256
256
|
<h3>Surprise me</h3>
|
|
257
|
-
<p>ACE-Step invents the lyrics itself from your words.
|
|
258
|
-
|
|
259
|
-
|
|
257
|
+
<p>ACE-Step invents the lyrics itself from your words. Canturía adds
|
|
258
|
+
“with lyrics in English” to the prompt, because that is the only
|
|
259
|
+
lever that moved the language in testing. Even then, length and language are
|
|
260
|
+
best-effort, and the result may wander. Use it when you want a happy
|
|
261
|
+
accident.</p>
|
|
260
262
|
<h3>Nothing leaves your box</h3>
|
|
261
263
|
<p>Ollama runs locally; ACE-Step is the server you configured. There is no
|
|
262
264
|
account, no telemetry, and no hosted service.</p>
|
|
@@ -50,9 +50,29 @@ def test_build_request_lyrics_and_describe() -> None:
|
|
|
50
50
|
assert lyrics.vocal_language == "en"
|
|
51
51
|
|
|
52
52
|
described = build_request("describe", "a song about rain", "indie", "", 45)
|
|
53
|
-
assert described.sample_query
|
|
53
|
+
assert described.sample_query is not None
|
|
54
|
+
assert "a song about rain" in described.sample_query
|
|
55
|
+
assert "English" in described.sample_query
|
|
56
|
+
assert "45" in described.sample_query
|
|
54
57
|
assert described.lyrics == ""
|
|
55
58
|
assert described.prompt.startswith("indie folk-pop")
|
|
59
|
+
assert described.vocal_language == "en"
|
|
60
|
+
|
|
61
|
+
spanish = build_request(
|
|
62
|
+
"describe", "a song about rain", "indie", "", 30, vocal_language="es"
|
|
63
|
+
)
|
|
64
|
+
assert spanish.sample_query is not None
|
|
65
|
+
assert "Spanish" in spanish.sample_query
|
|
66
|
+
|
|
67
|
+
already = build_request(
|
|
68
|
+
"describe",
|
|
69
|
+
"a song about rain, with lyrics in English",
|
|
70
|
+
"indie",
|
|
71
|
+
"",
|
|
72
|
+
30,
|
|
73
|
+
)
|
|
74
|
+
assert already.sample_query is not None
|
|
75
|
+
assert already.sample_query.lower().count("in english") == 1
|
|
56
76
|
|
|
57
77
|
|
|
58
78
|
def test_build_request_rejects_empty_and_bad_mode() -> None:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|