feat(example): upgrade demo song package and test suite to songpack v1.0

This commit is contained in:
2026-11-02 12:22:11 +01:00
parent 6d7d88e799
commit af11f507cf
13 changed files with 970 additions and 43 deletions

1
.gitignore vendored
View File

@ -43,6 +43,7 @@ testdata/
# Allow synthetic demo audio # Allow synthetic demo audio
!examples/demo_song/stems/*.wav !examples/demo_song/stems/*.wav
pragmatic_readme_template*.md
# IDE # IDE
.idea/ .idea/

View File

@ -3,24 +3,28 @@
"generated_by": null, "generated_by": null,
"chords": [ "chords": [
{ {
"id": "c_0001",
"source": "auto",
"confidence": 0.9,
"locked": false,
"start_beat": 0.0, "start_beat": 0.0,
"end_beat": 4.0, "end_beat": 4.0,
"label": "Am", "label": "Am",
"root": "A", "root": "A",
"quality": "min", "quality": "min",
"bass": "A", "bass": "A"
"confidence": 0.9,
"source": "auto"
}, },
{ {
"id": "c_0002",
"source": "auto",
"confidence": 0.88,
"locked": false,
"start_beat": 4.0, "start_beat": 4.0,
"end_beat": 6.0, "end_beat": 6.0,
"label": "C", "label": "C",
"root": "C", "root": "C",
"quality": "maj", "quality": "maj",
"bass": "C", "bass": "C"
"confidence": 0.88,
"source": "auto"
} }
] ]
} }

View File

@ -0,0 +1,11 @@
#TITLE:Demo Song
#ARTIST:Synthetic Artist
#MP3:stems/vocals.wav
#BPM:480.00
#GAP:500
#LANGUAGE:en
#GENRE:Demo
: 0 4 -3 Hel
: 4 4 -3 lo
: 8 8 0 world
E

View File

@ -0,0 +1,129 @@
{
"format": "songpack",
"schema_version": "1.0",
"id": "88fa27d4-d39f-4eae-8b15-14585248a1c9",
"created": "2026-11-02T11:16:09.795264+00:00",
"modified": "2026-11-02T11:21:17.734955+00:00",
"generator": {
"name": "songsplit",
"version": "0.1.0"
},
"variant": "full",
"audio_included": true,
"license": null,
"files": [
{
"path": "chords.json",
"role": "chords",
"schema_version": "1.0",
"sha256": "c8c4ae3dbbc89d427ab01b300dcb22c3dabd6293db4bfc16e4b5ac12bd92f38e",
"size": 545,
"stem": null
},
{
"path": "meta.json",
"role": "meta",
"schema_version": "1.0",
"sha256": "aef0e6ea47b66016fe8e79db3f98aa4361743216128ccebc610d210be9252374",
"size": 1611,
"stem": null
},
{
"path": "song.txt",
"role": "meta",
"schema_version": null,
"sha256": "1989999030e4d14bd7feee99899cf0eedc7efd0b2dcd0edbefb529e664230dc4",
"size": 152,
"stem": null
},
{
"path": "strumming.json",
"role": "meta",
"schema_version": "1.0",
"sha256": "23bce336d8207154f53736f8199f8d9eeb83eae067a5e159dfa85cf0f69ad850",
"size": 996,
"stem": null
},
{
"path": "tempo.json",
"role": "tempo",
"schema_version": "1.0",
"sha256": "e38602166d09cf2a88fa96768d6080c19c5f724e1602ed41d935bb8063028187",
"size": 459,
"stem": null
},
{
"path": "vocals.json",
"role": "vocals",
"schema_version": "1.0",
"sha256": "4298bba5f29cf3dca4452aae5f32a90bb44f90ccacbfc8c5b26ea746a1674ad4",
"size": 1191,
"stem": null
},
{
"path": "vocals_f0.json",
"role": "vocals_f0",
"schema_version": "1.0",
"sha256": "3c41341e1b7f1fcc58ab541bb0f47b58a2963fe6c509238ce9e3c9420ad7603d",
"size": 6521,
"stem": null
},
{
"path": "stems/bass.wav",
"role": "stem",
"schema_version": null,
"sha256": "3496df635d266e4cb59b7d7c1109524b84124406b4dbbb4f002319aee0625e77",
"size": 529244,
"stem": "bass"
},
{
"path": "stems/drums.wav",
"role": "stem",
"schema_version": null,
"sha256": "0b22ac43ea6b07df3415968b8fe60a9dce15859acaa6a21ac960cad6b3969013",
"size": 529244,
"stem": "drums"
},
{
"path": "stems/instrumental.wav",
"role": "stem",
"schema_version": null,
"sha256": "d8f805aac78efe4eb7529f7af4033e1e0e1137a02cfc76e7286f102422b2c1ce",
"size": 529244,
"stem": "instrumental"
},
{
"path": "stems/other.wav",
"role": "stem",
"schema_version": null,
"sha256": "ccbb2ccae58e3b9b8d6f73bdb4265eb30ea448acc93ccc6bfdeffffb5262c6d7",
"size": 529244,
"stem": "other"
},
{
"path": "stems/vocals.wav",
"role": "stem",
"schema_version": null,
"sha256": "61727088f8e8b917f83caaaf44212f47d852fe32b411205184ea450176a71d14",
"size": 529244,
"stem": "vocals"
},
{
"path": "tracks/guitar.json",
"role": "track",
"schema_version": "1.0",
"sha256": "64f072e2bb2d17cca3ea18798d3c9448089f204e3ef40b04fab1ab8203b1eeea",
"size": 1091,
"stem": null
},
{
"path": "export/song.txt",
"role": "ultrastar",
"schema_version": null,
"sha256": "1989999030e4d14bd7feee99899cf0eedc7efd0b2dcd0edbefb529e664230dc4",
"size": 152,
"stem": null
}
],
"stages": {}
}

View File

@ -3,15 +3,36 @@
"generated_by": null, "generated_by": null,
"title": "Demo Song", "title": "Demo Song",
"artist": "Synthetic Artist", "artist": "Synthetic Artist",
"album": null,
"year": null,
"language": "en", "language": "en",
"duration_sec": 3.0, "duration_sec": 3.0,
"source_file": { "source": {
"filename": "demo_song.wav",
"path": "examples/demo_song/stems/vocals.wav", "path": "examples/demo_song/stems/vocals.wav",
"kind": "audio",
"sha256": "0000000000000000000000000000000000000000000000000000000000000000", "sha256": "0000000000000000000000000000000000000000000000000000000000000000",
"size_bytes": 529200 "size_bytes": 529200
}, },
"key": "Am", "audio_ref": {
"capo": 0, "duration_sec": 3.0,
"samplerate": 44100,
"pcm_sha256": "1111111111111111111111111111111111111111111111111111111111111111"
},
"audio_offset_sec": 0.0,
"key": {
"tonic": "A",
"mode": "minor",
"confidence": 0.9
},
"capo": null,
"capo_suggestion": {
"capo": 0,
"shapes_in": "Am"
},
"ultrastar": {
"GENRE": "Demo"
},
"models_used": [ "models_used": [
{ {
"stage": "s2_stems", "stage": "s2_stems",
@ -37,9 +58,14 @@
"stage": "s6_chords", "stage": "s6_chords",
"name": "chord-extractor", "name": "chord-extractor",
"version": "0.2" "version": "0.2"
},
{
"stage": "tracks:strumming",
"name": "librosa-onset",
"version": "1.0"
} }
], ],
"created_at": "2026-11-02T12:00:00Z", "created_at": "2026-11-02T12:00:00+01:00",
"stages_done": [ "stages_done": [
"s1_extract", "s1_extract",
"s2_stems", "s2_stems",
@ -47,7 +73,7 @@
"s4_pitch", "s4_pitch",
"s5_tempo", "s5_tempo",
"s6_chords", "s6_chords",
"s7_strumming" "tracks:strumming"
], ],
"stages_failed": {} "stages_failed": {}
} }

View File

@ -4,6 +4,7 @@
#BPM:480.00 #BPM:480.00
#GAP:500 #GAP:500
#LANGUAGE:en #LANGUAGE:en
#GENRE:Demo
: 0 4 -3 Hel : 0 4 -3 Hel
: 4 4 -3 lo : 4 4 -3 lo
: 8 8 0 world : 8 8 0 world

View File

@ -3,40 +3,52 @@
"generated_by": null, "generated_by": null,
"events": [ "events": [
{ {
"id": "e_0001",
"source": "auto",
"confidence": 0.85,
"locked": false,
"beat": 0.0, "beat": 0.0,
"direction": "down", "direction": "down",
"strength": 0.9, "strength": 0.9
"confidence": 0.85,
"source": "auto"
}, },
{ {
"id": "e_0002",
"source": "auto",
"confidence": 0.8,
"locked": false,
"beat": 0.5, "beat": 0.5,
"direction": "up", "direction": "up",
"strength": 0.7, "strength": 0.7
"confidence": 0.8,
"source": "auto"
}, },
{ {
"id": "e_0003",
"source": "auto",
"confidence": 0.85,
"locked": false,
"beat": 1.0, "beat": 1.0,
"direction": "down", "direction": "down",
"strength": 0.85, "strength": 0.85
"confidence": 0.85,
"source": "auto"
}, },
{ {
"id": "e_0004",
"source": "auto",
"confidence": 0.82,
"locked": false,
"beat": 1.5, "beat": 1.5,
"direction": "up", "direction": "up",
"strength": 0.75, "strength": 0.75
"confidence": 0.82,
"source": "auto"
} }
], ],
"patterns": [ "patterns": [
{ {
"id": "p_0001",
"source": "auto",
"confidence": null,
"locked": false,
"start_beat": 0.0, "start_beat": 0.0,
"end_beat": 4.0, "end_beat": 4.0,
"pattern": "D U D U", "grid": "8th",
"grid": "8th" "pattern": "D U D U"
} }
] ]
} }

View File

@ -3,14 +3,25 @@
"generated_by": null, "generated_by": null,
"anchors": [ "anchors": [
{ {
"id": "t_0001",
"source": "auto",
"confidence": 1.0,
"locked": false,
"sec": 0.0, "sec": 0.0,
"beat": 0.0, "beat": 0.0,
"bpm": 120.0 "bpm": 120.0
} }
], ],
"time_signature": { "time_signatures": [
"numerator": 4, {
"denominator": 4 "id": "ts_0001",
}, "source": "auto",
"confidence": null,
"locked": false,
"beat": 0.0,
"numerator": 4,
"denominator": 4
}
],
"downbeat_offset": 0 "downbeat_offset": 0
} }

View File

@ -0,0 +1,58 @@
{
"schema_version": "1.0",
"generated_by": null,
"name": "guitar",
"instrument": "guitar",
"kind": "strumming",
"stem": "instrumental",
"events": [
{
"id": "e_0001",
"source": "auto",
"confidence": 0.85,
"locked": false,
"beat": 0.0,
"direction": "down",
"strength": 0.9
},
{
"id": "e_0002",
"source": "auto",
"confidence": 0.8,
"locked": false,
"beat": 0.5,
"direction": "up",
"strength": 0.7
},
{
"id": "e_0003",
"source": "auto",
"confidence": 0.85,
"locked": false,
"beat": 1.0,
"direction": "down",
"strength": 0.85
},
{
"id": "e_0004",
"source": "auto",
"confidence": 0.82,
"locked": false,
"beat": 1.5,
"direction": "up",
"strength": 0.75
}
],
"patterns": [
{
"id": "p_0001",
"source": "auto",
"confidence": null,
"locked": false,
"start_beat": 0.0,
"end_beat": 4.0,
"grid": "8th",
"pattern": "D U D U"
}
]
}

View File

@ -3,35 +3,52 @@
"generated_by": null, "generated_by": null,
"lines": [ "lines": [
{ {
"id": "l_0001",
"source": "auto",
"confidence": null,
"locked": false,
"voice": 0,
"start": 0.5, "start": 0.5,
"end": 2.5, "end": 2.5,
"syllables": [ "syllables": [
{ {
"id": "s_0001",
"source": "auto",
"confidence": 0.95,
"locked": false,
"text": "Hel", "text": "Hel",
"start": 0.5, "start": 0.5,
"end": 1.0, "end": 1.0,
"midi": 57.0, "midi": 57.0,
"golden": false, "type": "normal",
"confidence": 0.95, "word_end": false,
"source": "auto" "golden": false
}, },
{ {
"text": "lo ", "id": "s_0002",
"source": "auto",
"confidence": 0.92,
"locked": false,
"text": "lo",
"start": 1.0, "start": 1.0,
"end": 1.5, "end": 1.5,
"midi": 57.0, "midi": 57.0,
"golden": false, "type": "normal",
"confidence": 0.92, "word_end": true,
"source": "auto" "golden": false
}, },
{ {
"id": "s_0003",
"source": "auto",
"confidence": 0.98,
"locked": false,
"text": "world", "text": "world",
"start": 1.5, "start": 1.5,
"end": 2.5, "end": 2.5,
"midi": 60.0, "midi": 60.0,
"golden": false, "type": "normal",
"confidence": 0.98, "word_end": true,
"source": "auto" "golden": false
} }
] ]
} }

View File

@ -0,0 +1,610 @@
{
"schema_version": "1.0",
"generated_by": null,
"hop_sec": 0.01,
"start_sec": 0.0,
"hz": [
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
220.0,
220.63,
221.24,
221.84,
222.41,
222.94,
223.42,
223.85,
224.22,
224.52,
224.76,
224.91,
224.99,
224.99,
224.91,
224.76,
224.52,
224.22,
223.85,
223.42,
222.94,
222.41,
221.84,
221.24,
220.63,
220.0,
219.37,
218.76,
218.16,
217.59,
217.06,
216.58,
216.15,
215.78,
215.48,
215.24,
215.09,
215.01,
215.01,
215.09,
215.24,
215.48,
215.78,
216.15,
216.58,
217.06,
217.59,
218.16,
218.76,
219.37,
220.0,
220.63,
221.24,
221.84,
222.41,
222.94,
223.42,
223.85,
224.22,
224.52,
224.76,
224.91,
224.99,
224.99,
224.91,
224.76,
224.52,
224.22,
223.85,
223.42,
222.94,
222.41,
221.84,
221.24,
220.63,
220.0,
219.37,
218.76,
218.16,
217.59,
217.06,
216.58,
216.15,
215.78,
215.48,
215.24,
215.09,
215.01,
215.01,
215.09,
215.24,
215.48,
215.78,
216.15,
216.58,
217.06,
217.59,
218.16,
218.76,
219.37,
220.0,
220.63,
221.24,
221.84,
222.41,
222.94,
223.42,
223.85,
224.22,
224.52,
224.76,
224.91,
224.99,
224.99,
224.91,
224.76,
224.52,
224.22,
223.85,
223.42,
222.94,
222.41,
221.84,
221.24,
220.63,
220.0,
219.37,
218.76,
218.16,
217.59,
217.06,
216.58,
216.15,
215.78,
215.48,
215.24,
215.09,
215.01,
215.01,
215.09,
215.24,
215.48,
215.78,
216.15,
216.58,
217.06,
217.59,
218.16,
218.76,
219.37,
220.0,
220.63,
221.24,
221.84,
222.41,
222.94,
223.42,
223.85,
224.22,
224.52,
224.76,
224.91,
224.99,
224.99,
224.91,
224.76,
224.52,
224.22,
223.85,
223.42,
222.94,
222.41,
221.84,
221.24,
220.63,
220.0,
219.37,
218.76,
218.16,
217.59,
217.06,
216.58,
216.15,
215.78,
215.48,
215.24,
215.09,
215.01,
215.01,
215.09,
215.24,
215.48,
215.78,
216.15,
216.58,
217.06,
217.59,
218.16,
218.76,
219.37,
220.0,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
],
"confidence": [
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.95,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05,
0.05
]
}

View File

@ -1,16 +1,20 @@
"""Test the demo song package in examples/demo_song.""" """Test the demo song package in examples/demo_song according to Songpack spec v1.0."""
import json import json
from pathlib import Path from pathlib import Path
import soundfile as sf import soundfile as sf
from songsplit.container import pack_songpack, unpack_songpack
from songsplit.export.ultrastar import parse_ultrastar from songsplit.export.ultrastar import parse_ultrastar
from songsplit.schema.chords import ChordsDocument from songsplit.schema.chords import ChordsDocument
from songsplit.schema.manifest import ManifestDocument
from songsplit.schema.meta import MetaDocument from songsplit.schema.meta import MetaDocument
from songsplit.schema.strumming import StrummingDocument from songsplit.schema.strumming import StrummingDocument
from songsplit.schema.tempo import TempoDocument from songsplit.schema.tempo import TempoDocument
from songsplit.schema.tracks import TrackDocument
from songsplit.schema.vocals import VocalsDocument from songsplit.schema.vocals import VocalsDocument
from songsplit.schema.vocals_f0 import VocalsF0Document
def test_demo_package_structure(): def test_demo_package_structure():
@ -18,10 +22,14 @@ def test_demo_package_structure():
assert demo_dir.is_dir() assert demo_dir.is_dir()
required_files = [ required_files = [
"manifest.json",
"meta.json", "meta.json",
"tempo.json", "tempo.json",
"vocals.json", "vocals.json",
"vocals_f0.json",
"chords.json", "chords.json",
"tracks/guitar.json",
"export/song.txt",
"strumming.json", "strumming.json",
"song.txt", "song.txt",
] ]
@ -39,12 +47,23 @@ def test_demo_package_structure():
def test_demo_package_schemas(): def test_demo_package_schemas():
demo_dir = Path("examples/demo_song") demo_dir = Path("examples/demo_song")
# Manifest
manifest_raw = json.loads((demo_dir / "manifest.json").read_text(encoding="utf-8"))
manifest = ManifestDocument.model_validate(manifest_raw)
assert manifest.format == "songpack"
assert manifest.schema_version == "1.0"
assert manifest.variant == "full"
assert manifest.audio_included is True
# Meta # Meta
meta_raw = json.loads((demo_dir / "meta.json").read_text(encoding="utf-8")) meta_raw = json.loads((demo_dir / "meta.json").read_text(encoding="utf-8"))
meta = MetaDocument.model_validate(meta_raw) meta = MetaDocument.model_validate(meta_raw)
assert meta.title == "Demo Song" assert meta.title == "Demo Song"
assert meta.schema_version == "1.0" assert meta.schema_version == "1.0"
assert meta.duration_sec > 0 assert meta.duration_sec > 0
assert meta.audio_ref is not None
assert meta.key.tonic == "A"
assert meta.key.mode == "minor"
# Tempo # Tempo
tempo_raw = json.loads((demo_dir / "tempo.json").read_text(encoding="utf-8")) tempo_raw = json.loads((demo_dir / "tempo.json").read_text(encoding="utf-8"))
@ -58,6 +77,14 @@ def test_demo_package_schemas():
vocals = VocalsDocument.model_validate(vocals_raw) vocals = VocalsDocument.model_validate(vocals_raw)
assert len(vocals.lines) >= 1 assert len(vocals.lines) >= 1
assert len(vocals.lines[0].syllables) == 3 assert len(vocals.lines[0].syllables) == 3
assert vocals.lines[0].syllables[0].text == "Hel"
assert vocals.lines[0].syllables[1].word_end is True
# Vocals F0
f0_raw = json.loads((demo_dir / "vocals_f0.json").read_text(encoding="utf-8"))
f0 = VocalsF0Document.model_validate(f0_raw)
assert f0.hop_sec == 0.01
assert len(f0.hz) > 0
# Chords # Chords
chords_raw = json.loads((demo_dir / "chords.json").read_text(encoding="utf-8")) chords_raw = json.loads((demo_dir / "chords.json").read_text(encoding="utf-8"))
@ -65,7 +92,15 @@ def test_demo_package_schemas():
assert len(chords.chords) == 2 assert len(chords.chords) == 2
assert chords.chords[0].label == "Am" assert chords.chords[0].label == "Am"
# Strumming # Tracks (guitar.json)
track_raw = json.loads((demo_dir / "tracks" / "guitar.json").read_text(encoding="utf-8"))
track = TrackDocument.model_validate(track_raw)
assert track.kind == "strumming"
assert track.name == "guitar"
assert len(track.events) == 4
assert len(track.patterns) == 1
# Strumming (backward compat)
strumming_raw = json.loads((demo_dir / "strumming.json").read_text(encoding="utf-8")) strumming_raw = json.loads((demo_dir / "strumming.json").read_text(encoding="utf-8"))
strumming = StrummingDocument.model_validate(strumming_raw) strumming = StrummingDocument.model_validate(strumming_raw)
assert len(strumming.events) == 4 assert len(strumming.events) == 4
@ -86,7 +121,7 @@ def test_demo_package_audio_properties():
def test_demo_package_ultrastar_roundtrip(): def test_demo_package_ultrastar_roundtrip():
demo_dir = Path("examples/demo_song") demo_dir = Path("examples/demo_song")
song_txt = demo_dir / "song.txt" song_txt = demo_dir / "export" / "song.txt"
parsed = parse_ultrastar(song_txt) parsed = parse_ultrastar(song_txt)
assert parsed.title == "Demo Song" assert parsed.title == "Demo Song"
@ -96,3 +131,16 @@ def test_demo_package_ultrastar_roundtrip():
texts = [s.text for s in parsed.lines[0]] texts = [s.text for s in parsed.lines[0]]
assert texts == ["Hel", "lo ", "world"] assert texts == ["Hel", "lo ", "world"]
def test_demo_package_pack_unpack_roundtrip(tmp_path: Path):
demo_dir = Path("examples/demo_song")
archive_out = tmp_path / "demo.songpack"
pack_songpack(demo_dir, archive_out)
assert archive_out.is_file()
unpacked_dir = tmp_path / "demo_unpacked"
unpack_songpack(archive_out, unpacked_dir)
assert (unpacked_dir / "manifest.json").is_file()
assert (unpacked_dir / "tracks" / "guitar.json").is_file()
assert (unpacked_dir / "stems" / "vocals.wav").is_file()

View File

@ -229,4 +229,3 @@ def test_vocals_f0_document():
dumped = json.loads(f0.model_dump_json()) dumped = json.loads(f0.model_dump_json())
assert dumped["hop_sec"] == 0.01 assert dumped["hop_sec"] == 0.01
assert dumped["hz"][2] == 220.0 assert dumped["hz"][2] == 220.0