praecentor 0.1.0__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.

Potentially problematic release.


This version of praecentor might be problematic. Click here for more details.

Files changed (79) hide show
  1. praecentor-0.1.0/MANIFEST.in +5 -0
  2. praecentor-0.1.0/PKG-INFO +411 -0
  3. praecentor-0.1.0/README.md +398 -0
  4. praecentor-0.1.0/praecentor/.DS_Store +0 -0
  5. praecentor-0.1.0/praecentor/__init__.py +4 -0
  6. praecentor-0.1.0/praecentor/__main__.py +4 -0
  7. praecentor-0.1.0/praecentor/__pycache__/__init__.cpython-314.pyc +0 -0
  8. praecentor-0.1.0/praecentor/__pycache__/api.cpython-314.pyc +0 -0
  9. praecentor-0.1.0/praecentor/__pycache__/cli.cpython-314.pyc +0 -0
  10. praecentor-0.1.0/praecentor/api.py +95 -0
  11. praecentor-0.1.0/praecentor/assets/loop.svg +4 -0
  12. praecentor-0.1.0/praecentor/assets/warning.svg +4 -0
  13. praecentor-0.1.0/praecentor/assets/wash.png +0 -0
  14. praecentor-0.1.0/praecentor/audio/__init__.py +13 -0
  15. praecentor-0.1.0/praecentor/audio/__pycache__/__init__.cpython-314.pyc +0 -0
  16. praecentor-0.1.0/praecentor/audio/__pycache__/beat_analysis.cpython-314.pyc +0 -0
  17. praecentor-0.1.0/praecentor/audio/beat_analysis.py +376 -0
  18. praecentor-0.1.0/praecentor/cli.py +44 -0
  19. praecentor-0.1.0/praecentor/commands/__init__.py +1 -0
  20. praecentor-0.1.0/praecentor/commands/__pycache__/__init__.cpython-314.pyc +0 -0
  21. praecentor-0.1.0/praecentor/commands/__pycache__/convert.cpython-314.pyc +0 -0
  22. praecentor-0.1.0/praecentor/commands/__pycache__/diagnose.cpython-314.pyc +0 -0
  23. praecentor-0.1.0/praecentor/commands/__pycache__/render.cpython-314.pyc +0 -0
  24. praecentor-0.1.0/praecentor/commands/__pycache__/tap.cpython-314.pyc +0 -0
  25. praecentor-0.1.0/praecentor/commands/__pycache__/timeline.cpython-314.pyc +0 -0
  26. praecentor-0.1.0/praecentor/commands/__pycache__/validate.cpython-314.pyc +0 -0
  27. praecentor-0.1.0/praecentor/commands/convert.py +111 -0
  28. praecentor-0.1.0/praecentor/commands/diagnose.py +96 -0
  29. praecentor-0.1.0/praecentor/commands/render.py +195 -0
  30. praecentor-0.1.0/praecentor/commands/tap.py +113 -0
  31. praecentor-0.1.0/praecentor/commands/timeline.py +15 -0
  32. praecentor-0.1.0/praecentor/commands/validate.py +19 -0
  33. praecentor-0.1.0/praecentor/controllers/__init__.py +6 -0
  34. praecentor-0.1.0/praecentor/controllers/__pycache__/__init__.cpython-314.pyc +0 -0
  35. praecentor-0.1.0/praecentor/controllers/__pycache__/conversion.cpython-314.pyc +0 -0
  36. praecentor-0.1.0/praecentor/controllers/__pycache__/diagnostics.cpython-314.pyc +0 -0
  37. praecentor-0.1.0/praecentor/controllers/__pycache__/errors.cpython-314.pyc +0 -0
  38. praecentor-0.1.0/praecentor/controllers/__pycache__/rendering.cpython-314.pyc +0 -0
  39. praecentor-0.1.0/praecentor/controllers/__pycache__/tapping.cpython-314.pyc +0 -0
  40. praecentor-0.1.0/praecentor/controllers/__pycache__/timeline.cpython-314.pyc +0 -0
  41. praecentor-0.1.0/praecentor/controllers/__pycache__/validation.cpython-314.pyc +0 -0
  42. praecentor-0.1.0/praecentor/controllers/conversion.py +457 -0
  43. praecentor-0.1.0/praecentor/controllers/diagnostics.py +215 -0
  44. praecentor-0.1.0/praecentor/controllers/errors.py +2 -0
  45. praecentor-0.1.0/praecentor/controllers/rendering.py +3681 -0
  46. praecentor-0.1.0/praecentor/controllers/tapping.py +407 -0
  47. praecentor-0.1.0/praecentor/controllers/timeline.py +11 -0
  48. praecentor-0.1.0/praecentor/controllers/validation.py +25 -0
  49. praecentor-0.1.0/praecentor/io/__init__.py +1 -0
  50. praecentor-0.1.0/praecentor/io/__pycache__/__init__.cpython-314.pyc +0 -0
  51. praecentor-0.1.0/praecentor/io/__pycache__/layout.cpython-314.pyc +0 -0
  52. praecentor-0.1.0/praecentor/io/__pycache__/song.cpython-314.pyc +0 -0
  53. praecentor-0.1.0/praecentor/io/__pycache__/tap_map.cpython-314.pyc +0 -0
  54. praecentor-0.1.0/praecentor/io/layout.py +32 -0
  55. praecentor-0.1.0/praecentor/io/song.py +180 -0
  56. praecentor-0.1.0/praecentor/io/tap_map.py +189 -0
  57. praecentor-0.1.0/praecentor/models/__init__.py +17 -0
  58. praecentor-0.1.0/praecentor/models/__pycache__/__init__.cpython-314.pyc +0 -0
  59. praecentor-0.1.0/praecentor/models/__pycache__/requests.cpython-314.pyc +0 -0
  60. praecentor-0.1.0/praecentor/models/requests.py +60 -0
  61. praecentor-0.1.0/praecentor/render/__init__.py +1 -0
  62. praecentor-0.1.0/praecentor/render/__pycache__/__init__.cpython-314.pyc +0 -0
  63. praecentor-0.1.0/praecentor/render/__pycache__/background_layers.cpython-314.pyc +0 -0
  64. praecentor-0.1.0/praecentor/render/__pycache__/cue_frames.cpython-314.pyc +0 -0
  65. praecentor-0.1.0/praecentor/render/__pycache__/title_card.cpython-314.pyc +0 -0
  66. praecentor-0.1.0/praecentor/render/background_layers.py +320 -0
  67. praecentor-0.1.0/praecentor/render/cue_frames.py +4225 -0
  68. praecentor-0.1.0/praecentor/render/title_card.py +788 -0
  69. praecentor-0.1.0/praecentor.egg-info/PKG-INFO +411 -0
  70. praecentor-0.1.0/praecentor.egg-info/SOURCES.txt +78 -0
  71. praecentor-0.1.0/praecentor.egg-info/dependency_links.txt +1 -0
  72. praecentor-0.1.0/praecentor.egg-info/entry_points.txt +2 -0
  73. praecentor-0.1.0/praecentor.egg-info/not-zip-safe +1 -0
  74. praecentor-0.1.0/praecentor.egg-info/requires.txt +5 -0
  75. praecentor-0.1.0/praecentor.egg-info/top_level.txt +1 -0
  76. praecentor-0.1.0/pyproject.toml +31 -0
  77. praecentor-0.1.0/requirements.txt +5 -0
  78. praecentor-0.1.0/setup.cfg +7 -0
  79. praecentor-0.1.0/setup.py +39 -0
@@ -0,0 +1,5 @@
1
+ include README.md
2
+ include requirements.txt
3
+ recursive-include praecentor/assets *.svg *.png
4
+ prune praecentor/assets/fonts
5
+ recursive-include praecentor *
@@ -0,0 +1,411 @@
1
+ Metadata-Version: 2.4
2
+ Name: praecentor
3
+ Version: 0.1.0
4
+ Summary: Praecentor package
5
+ Requires-Python: >=3.8
6
+ Description-Content-Type: text/markdown
7
+ Requires-Dist: cairosvg==2.9.1
8
+ Requires-Dist: Click==8.5.0
9
+ Requires-Dist: librosa==1.0.0
10
+ Requires-Dist: pillow==12.3.0
11
+ Requires-Dist: PyYAML==6.0.3
12
+ Dynamic: requires-python
13
+
14
+ # Praecentor
15
+
16
+ Praecentor is a Python tool for building rehearsal and performance videos from song YAML definitions. It's designed around the way I work at the piano: a backing track, a visible lead sheet, chord or riff prompts, a countdown and beat grid, and lyrics that scroll with the song.
17
+
18
+ It's especially useful for live rehearsal and group work, where the video needs to show:
19
+
20
+ - the backing track and timing reference
21
+ - the current and upcoming chord or riff
22
+ - the lyric lines as they arrive
23
+ - the beat and bar structure for piano timing
24
+ - different output mixes for practice, performance, and session use
25
+
26
+ ---
27
+
28
+ ## What Praecentor does
29
+
30
+ Praecentor turns a structured YAML description of a song into a rendered video with:
31
+
32
+ - scrolling lyrics
33
+ - current chord or riff display
34
+ - next-chord lookahead
35
+ - beat/bar visual indicator (the “beat pie”)
36
+ - a progress bar or intro countdown during long breaks
37
+ - optional title card and countdown sequence before the track starts
38
+ - rendered output variants for different needs
39
+
40
+ Typical outputs include:
41
+
42
+ - Practice video: base track + guide vocals
43
+ - Performance video: backing and piano guide, without guide vocals
44
+ - Session video: only the backing mix, so the pianist can play over it live
45
+
46
+ ---
47
+
48
+ ## Project workflow
49
+
50
+ Praecentor expects a song to be defined in YAML and then rendered into a video. In practice the workflow is:
51
+
52
+ 1. Author the song in a YAML file, including events, timing, and output layout.
53
+ 2. Optionally add a timing map file for lyric/chord alignment.
54
+ 3. Use the tap workflow to capture lyric and beat timing if needed.
55
+ 4. Validate the song definition.
56
+ 5. Render the final video(s).
57
+
58
+ The project supports both automatic timing and tap-based timing workflows, and it can use layout YAML overrides to control rendering details.
59
+
60
+ ---
61
+
62
+ ## Installation
63
+
64
+ Requirements:
65
+
66
+ - Python 3.8+
67
+ - ffmpeg installed and available on your PATH for video rendering
68
+ - Inter font files downloaded locally for rendering
69
+
70
+ Praecentor does not bundle the Inter font files in the repository. Before running a render, download Inter and place the `.ttf` files in a local fonts directory that is accessible to your machine, for example:
71
+
72
+ ```bash
73
+ ~/Library/Fonts/Inter/
74
+ ```
75
+
76
+ or any directory you choose, then point Praecentor at it with either:
77
+
78
+ ```bash
79
+ export PRAECENTOR_FONTS_DIR="$HOME/Library/Fonts/Inter"
80
+ ```
81
+
82
+ or in the render/layout config:
83
+
84
+ ```yaml
85
+ render:
86
+ font_dir: "/Users/you/Library/Fonts/Inter"
87
+ ```
88
+
89
+ Install from the repository:
90
+
91
+ ```bash
92
+ cd /path/to/praecentor
93
+ python -m pip install -r requirements.txt
94
+ python -m pip install -e .
95
+ ```
96
+
97
+ After installation, the CLI is available as:
98
+
99
+ ```bash
100
+ praecentor --help
101
+ ```
102
+
103
+ ---
104
+
105
+ ## CLI overview
106
+
107
+ Praecentor exposes the following commands:
108
+
109
+ ```bash
110
+ praecentor validate SONG.yaml
111
+ praecentor tap lyrics SONG.yaml
112
+ praecentor tap beats SONG.yaml
113
+ praecentor timeline SONG.yaml
114
+ praecentor diagnose beats SONG.yaml
115
+ praecentor render SONG.yaml
116
+ praecentor convert lyrics
117
+ praecentor convert riff
118
+ ```
119
+
120
+ The `render` command is also the default action when the CLI is invoked without a subcommand.
121
+
122
+ ### Main commands
123
+
124
+ - `validate`: checks whether a song file is structurally valid
125
+ - `tap lyrics`: interactive lyric timing capture using the Enter key
126
+ - `tap beats`: interactive beat capture for timing and tempo analysis
127
+ - `timeline`: prints or inspects the cue timeline
128
+ - `diagnose beats`: helps inspect beat detection and timing issues
129
+ - `render`: generates MP4 output from the song definition
130
+ - `convert lyrics`: converts plain text into YAML events for lyric structure
131
+ - `convert riff`: converts note notation into riff strings
132
+
133
+ ---
134
+
135
+ ## Song YAML structure
136
+
137
+ A Praecentor song file is a single YAML document with a root structure similar to this:
138
+
139
+ ```yaml
140
+ version: 1
141
+
142
+ meta:
143
+ title: "Feed My Frankenstein"
144
+ artist: "Alice Cooper"
145
+ key: "D minor"
146
+
147
+ audio:
148
+ stems:
149
+ - group: "backing"
150
+ label: "Music"
151
+ volume: .9
152
+ tracks:
153
+ - name: "base"
154
+ file: "Bounces/Backing.mp3"
155
+ label: "Backing"
156
+ - name: "guitar"
157
+ file: "Bounces/Guitar.mp3"
158
+ - group: "vocals"
159
+ modal: true
160
+ tracks:
161
+ - name: "a"
162
+ file: "Bounces/A Part.mp3"
163
+ label: "A part"
164
+
165
+ video:
166
+ layout:
167
+ file: "/path/to/layout.yaml"
168
+ output:
169
+ - file: "Video/Performance.mp4"
170
+ tracks:
171
+ - backing.base
172
+
173
+ maestro:
174
+ output:
175
+ file: "Maestro.zip"
176
+
177
+ hot_start: true
178
+
179
+ timing:
180
+ lyrics:
181
+ source: tap
182
+ map_file: "Bounces/Lyrics.yaml"
183
+ base_offset_seconds: -.6
184
+ max_line_chars: 36
185
+ lead_in_beats: 2
186
+ beats:
187
+ source: auto
188
+ beat_offset: -4
189
+ quantize_factor: .25
190
+ auto_dynamic_tempo: true
191
+ auto_dynamic_tempo_sensitivity: .1
192
+ click_track:
193
+ file: "Bounces/Click.mp3"
194
+ countdown_beats: 8
195
+
196
+ riffs:
197
+ chorus1: "D1 F1 G0.5 F0.5 D1 D0.5 D0.5 F0.5 A0.5 G1 A1"
198
+
199
+ chords:
200
+ verse: "Dm"
201
+ prechorus: "Am"
202
+
203
+ events:
204
+ - marker: "Verse 1"
205
+ lyric: |
206
+ Well, I ain't evil, I'm just
207
+ good lookin'
208
+ chords: "@verse"
209
+ ```
210
+
211
+ ### Key sections
212
+
213
+ - `meta`: title, artist, key, and other metadata
214
+ - `audio`: backing and vocal stems, with groups and track mappings
215
+ - `video`: output definitions and optional layout override
216
+ - `maestro`: export configuration for a zipped Maestro package
217
+ - `timing`: how lyrics and beats are measured and timed
218
+ - `riffs`: reusable riff patterns
219
+ - `chords`: reusable chord labels
220
+ - `events`: the actual song structure, including lyric lines, riffs, markers, and chord changes
221
+
222
+ ### Event model
223
+
224
+ Each entry inside `events` is a single musical event. Typical fields include:
225
+
226
+ - `marker`: section label such as `Verse 1` or `Chorus`
227
+ - `lyric`: text to display for that section
228
+ - `riff`: a riff string to show and play
229
+ - `chords`: chord label or lookup reference like `@verse`
230
+ - `instruction`: a special action / section instruction when no lyric text is shown
231
+ - `root`: optional override for the root note used when interpreting a riff
232
+
233
+ A line may use lyric and riff together, or a separate instruction event may trigger a riff-only section.
234
+
235
+ ---
236
+
237
+ ## Timing and lyric map files
238
+
239
+ Lyrics and chord timing are usually tied to a timing file separate from the song YAML. The `timing.lyrics.map_file` entry tells Praecentor where to find the alignment data:
240
+
241
+ ```yaml
242
+ timing:
243
+ lyrics:
244
+ source: tap
245
+ map_file: "Bounces/Lyrics.yaml"
246
+ base_offset_seconds: -.6
247
+ max_line_chars: 36
248
+ lead_in_beats: 2
249
+ ```
250
+
251
+ This separate map is used to sync lyric phrases, section boundaries, and chord transitions with the audio track. In many songs, the lyrics and chords are connected in the event stream and adjusted together.
252
+
253
+ ---
254
+
255
+ ## Beat and lyric tapping
256
+
257
+ The tap workflow is designed for live alignment. It plays the song and lets you press Enter at each chord change or lyric boundary, creating a map that Praecentor can use to render the final timing.
258
+
259
+ ```bash
260
+ praecentor tap lyrics Praecentor.yaml
261
+ praecentor tap beats Praecentor.yaml
262
+ ```
263
+
264
+ This is especially useful when you are working at the keyboard and do not want to hand-edit all timing offsets. The CLI accepts optional overrides such as `--audio` and `--autosave-every`, and the `--dry-run` mode validates paths and config without starting capture.
265
+
266
+ A typical beat/lyrics flow is:
267
+
268
+ 1. open the song file
269
+ 2. play the backing track
270
+ 3. tap when the next chord change or lyric event occurs
271
+ 4. save the map and adjust the offsets if needed
272
+ 5. render the final video
273
+
274
+ ---
275
+
276
+ ## Layout overrides
277
+
278
+ Praecentor can accept an optional layout YAML file that overrides rendering details for the video output. This is useful when you want custom styling, sizing, or behavior without rewriting the song structure.
279
+
280
+ ```yaml
281
+ video:
282
+ layout:
283
+ file: "/path/to/layout.yaml"
284
+ ```
285
+
286
+ The layout file is optional, and if provided it may override advanced rendering settings such as the visual layout, title card presentation, and common video display options. This allows the same song file to be rendered in different visual styles for different contexts.
287
+
288
+ ---
289
+
290
+ ## Rendering videos
291
+
292
+ Render a song into its configured outputs:
293
+
294
+ ```bash
295
+ praecentor render Praecentor.yaml
296
+ ```
297
+
298
+ Optional render flags:
299
+
300
+ ```bash
301
+ praecentor render Praecentor.yaml \
302
+ --layout /path/to/layout.yaml \
303
+ --output-video /path/to/output.mp4 \
304
+ --from-seconds 00:30 \
305
+ --to-seconds 03:45
306
+ ```
307
+
308
+ Useful rendering options include:
309
+
310
+ - `--layout`: provide a layout override file
311
+ - `--beat-seconds`: override beat duration for title-card countdown timing
312
+ - `--countdown-beats`: set how many beats are shown before the backing starts
313
+ - `--maestro-only`: write the Maestro zip without muxing full video output
314
+ - `--video-encoder`: choose the FFmpeg encoder
315
+ - `--video-preset`, `--video-crf`, `--video-bitrate`: tweak output quality
316
+ - `--ignore-stem-length-mismatch`: skip audio stem validation if needed
317
+
318
+ ---
319
+
320
+ ## Output variants
321
+
322
+ The song configuration can describe multiple outputs. A common pattern is:
323
+
324
+ - session output: just the backing track
325
+ - practice output: base parts + guide vocals
326
+ - performance output: backing/music plus piano arrangement, no guide vocals
327
+
328
+ This is controlled by the `video.output` section and the chosen stem groups and tracks.
329
+
330
+ Example:
331
+
332
+ ```yaml
333
+ video:
334
+ output:
335
+ - file: "Video/Session.mp4"
336
+ tracks:
337
+ - backing.base
338
+ - file: "Video/Performance.mp4"
339
+ tracks:
340
+ - backing.*
341
+ - file: "Video/Practice.mp4"
342
+ tracks:
343
+ - backing.base
344
+ - vocals.*
345
+ ```
346
+
347
+ This gives you multiple ready-to-use mixes from one song definition without duplicating the musical content.
348
+
349
+ ---
350
+
351
+ ## Validation and debugging
352
+
353
+ Before rendering, it helps to validate the song file:
354
+
355
+ ```bash
356
+ praecentor validate Praecentor.yaml
357
+ ```
358
+
359
+ Inspect and debug the timeline:
360
+
361
+ ```bash
362
+ praecentor timeline Praecentor.yaml
363
+ praecentor diagnose beats Praecentor.yaml
364
+ ```
365
+
366
+ These inspections help check that the event structure, timing offsets, and beat detection look sane before video generation begins.
367
+
368
+ ---
369
+
370
+ ## Example: working with the attached song file
371
+
372
+ The provided example is a real-world use case: a song defined with backing stems, vocal stems, event-based lyric structure, dynamic timing, and multiple output videos.
373
+
374
+ It includes all the major ingredients:
375
+
376
+ - `audio.stems` for track groupings
377
+ - `video.output` for exporting several versions
378
+ - `timing.lyrics` and `timing.beats` for tempo and lyric alignment
379
+ - `riffs` and `chords` for reusable musical components
380
+ - `events` for section markers, lyric lines, and riffs
381
+
382
+ This is the core authoring model Praecentor is built around.
383
+
384
+ ---
385
+
386
+ ## Typical use case
387
+
388
+ Praecentor is ideal for any live music setup where the pianist or accompanist needs:
389
+
390
+ - a clear visual timeline
391
+ - chord and riff prompts
392
+ - lyric synchronisation
393
+ - rehearsal-ready backing tracks
394
+ - multiple audience- and practice-specific render modes
395
+
396
+ It's designed to support the workflow of a singer/pianist or small ensemble rehearsing a song in real time, with the visual output serving as a conductor, lyric prompter, and timing guide.
397
+
398
+ ---
399
+
400
+ ## Notes
401
+
402
+ - Song authoring is YAML-based and intentionally structured for fast iteration.
403
+ - Timing can be either automatic or captured interactively by tapping.
404
+ - Rendering depends on ffmpeg and working media file paths.
405
+ - The project is best used as a local tool for rehearsal and performance prep.
406
+
407
+ ---
408
+
409
+ ## License
410
+
411
+ This project is intended for local music production and rehearsal use. Please check the repository for the current license details before redistributing or publishing generated media.