feat(example): upgrade demo song package and test suite to songpack v1.0
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@ -43,6 +43,7 @@ testdata/
|
||||
|
||||
# Allow synthetic demo audio
|
||||
!examples/demo_song/stems/*.wav
|
||||
pragmatic_readme_template*.md
|
||||
|
||||
# IDE
|
||||
.idea/
|
||||
|
||||
@ -3,24 +3,28 @@
|
||||
"generated_by": null,
|
||||
"chords": [
|
||||
{
|
||||
"id": "c_0001",
|
||||
"source": "auto",
|
||||
"confidence": 0.9,
|
||||
"locked": false,
|
||||
"start_beat": 0.0,
|
||||
"end_beat": 4.0,
|
||||
"label": "Am",
|
||||
"root": "A",
|
||||
"quality": "min",
|
||||
"bass": "A",
|
||||
"confidence": 0.9,
|
||||
"source": "auto"
|
||||
"bass": "A"
|
||||
},
|
||||
{
|
||||
"id": "c_0002",
|
||||
"source": "auto",
|
||||
"confidence": 0.88,
|
||||
"locked": false,
|
||||
"start_beat": 4.0,
|
||||
"end_beat": 6.0,
|
||||
"label": "C",
|
||||
"root": "C",
|
||||
"quality": "maj",
|
||||
"bass": "C",
|
||||
"confidence": 0.88,
|
||||
"source": "auto"
|
||||
"bass": "C"
|
||||
}
|
||||
]
|
||||
}
|
||||
11
examples/demo_song/export/song.txt
Normal file
11
examples/demo_song/export/song.txt
Normal 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
|
||||
129
examples/demo_song/manifest.json
Normal file
129
examples/demo_song/manifest.json
Normal 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": {}
|
||||
}
|
||||
@ -3,15 +3,36 @@
|
||||
"generated_by": null,
|
||||
"title": "Demo Song",
|
||||
"artist": "Synthetic Artist",
|
||||
"album": null,
|
||||
"year": null,
|
||||
"language": "en",
|
||||
"duration_sec": 3.0,
|
||||
"source_file": {
|
||||
"source": {
|
||||
"filename": "demo_song.wav",
|
||||
"path": "examples/demo_song/stems/vocals.wav",
|
||||
"kind": "audio",
|
||||
"sha256": "0000000000000000000000000000000000000000000000000000000000000000",
|
||||
"size_bytes": 529200
|
||||
},
|
||||
"key": "Am",
|
||||
"capo": 0,
|
||||
"audio_ref": {
|
||||
"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": [
|
||||
{
|
||||
"stage": "s2_stems",
|
||||
@ -37,9 +58,14 @@
|
||||
"stage": "s6_chords",
|
||||
"name": "chord-extractor",
|
||||
"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": [
|
||||
"s1_extract",
|
||||
"s2_stems",
|
||||
@ -47,7 +73,7 @@
|
||||
"s4_pitch",
|
||||
"s5_tempo",
|
||||
"s6_chords",
|
||||
"s7_strumming"
|
||||
"tracks:strumming"
|
||||
],
|
||||
"stages_failed": {}
|
||||
}
|
||||
@ -4,6 +4,7 @@
|
||||
#BPM:480.00
|
||||
#GAP:500
|
||||
#LANGUAGE:en
|
||||
#GENRE:Demo
|
||||
: 0 4 -3 Hel
|
||||
: 4 4 -3 lo
|
||||
: 8 8 0 world
|
||||
|
||||
@ -3,40 +3,52 @@
|
||||
"generated_by": null,
|
||||
"events": [
|
||||
{
|
||||
"id": "e_0001",
|
||||
"source": "auto",
|
||||
"confidence": 0.85,
|
||||
"locked": false,
|
||||
"beat": 0.0,
|
||||
"direction": "down",
|
||||
"strength": 0.9,
|
||||
"confidence": 0.85,
|
||||
"source": "auto"
|
||||
"strength": 0.9
|
||||
},
|
||||
{
|
||||
"id": "e_0002",
|
||||
"source": "auto",
|
||||
"confidence": 0.8,
|
||||
"locked": false,
|
||||
"beat": 0.5,
|
||||
"direction": "up",
|
||||
"strength": 0.7,
|
||||
"confidence": 0.8,
|
||||
"source": "auto"
|
||||
"strength": 0.7
|
||||
},
|
||||
{
|
||||
"id": "e_0003",
|
||||
"source": "auto",
|
||||
"confidence": 0.85,
|
||||
"locked": false,
|
||||
"beat": 1.0,
|
||||
"direction": "down",
|
||||
"strength": 0.85,
|
||||
"confidence": 0.85,
|
||||
"source": "auto"
|
||||
"strength": 0.85
|
||||
},
|
||||
{
|
||||
"id": "e_0004",
|
||||
"source": "auto",
|
||||
"confidence": 0.82,
|
||||
"locked": false,
|
||||
"beat": 1.5,
|
||||
"direction": "up",
|
||||
"strength": 0.75,
|
||||
"confidence": 0.82,
|
||||
"source": "auto"
|
||||
"strength": 0.75
|
||||
}
|
||||
],
|
||||
"patterns": [
|
||||
{
|
||||
"id": "p_0001",
|
||||
"source": "auto",
|
||||
"confidence": null,
|
||||
"locked": false,
|
||||
"start_beat": 0.0,
|
||||
"end_beat": 4.0,
|
||||
"pattern": "D U D U",
|
||||
"grid": "8th"
|
||||
"grid": "8th",
|
||||
"pattern": "D U D U"
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -3,14 +3,25 @@
|
||||
"generated_by": null,
|
||||
"anchors": [
|
||||
{
|
||||
"id": "t_0001",
|
||||
"source": "auto",
|
||||
"confidence": 1.0,
|
||||
"locked": false,
|
||||
"sec": 0.0,
|
||||
"beat": 0.0,
|
||||
"bpm": 120.0
|
||||
}
|
||||
],
|
||||
"time_signature": {
|
||||
"numerator": 4,
|
||||
"denominator": 4
|
||||
},
|
||||
"time_signatures": [
|
||||
{
|
||||
"id": "ts_0001",
|
||||
"source": "auto",
|
||||
"confidence": null,
|
||||
"locked": false,
|
||||
"beat": 0.0,
|
||||
"numerator": 4,
|
||||
"denominator": 4
|
||||
}
|
||||
],
|
||||
"downbeat_offset": 0
|
||||
}
|
||||
58
examples/demo_song/tracks/guitar.json
Normal file
58
examples/demo_song/tracks/guitar.json
Normal 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"
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -3,35 +3,52 @@
|
||||
"generated_by": null,
|
||||
"lines": [
|
||||
{
|
||||
"id": "l_0001",
|
||||
"source": "auto",
|
||||
"confidence": null,
|
||||
"locked": false,
|
||||
"voice": 0,
|
||||
"start": 0.5,
|
||||
"end": 2.5,
|
||||
"syllables": [
|
||||
{
|
||||
"id": "s_0001",
|
||||
"source": "auto",
|
||||
"confidence": 0.95,
|
||||
"locked": false,
|
||||
"text": "Hel",
|
||||
"start": 0.5,
|
||||
"end": 1.0,
|
||||
"midi": 57.0,
|
||||
"golden": false,
|
||||
"confidence": 0.95,
|
||||
"source": "auto"
|
||||
"type": "normal",
|
||||
"word_end": false,
|
||||
"golden": false
|
||||
},
|
||||
{
|
||||
"text": "lo ",
|
||||
"id": "s_0002",
|
||||
"source": "auto",
|
||||
"confidence": 0.92,
|
||||
"locked": false,
|
||||
"text": "lo",
|
||||
"start": 1.0,
|
||||
"end": 1.5,
|
||||
"midi": 57.0,
|
||||
"golden": false,
|
||||
"confidence": 0.92,
|
||||
"source": "auto"
|
||||
"type": "normal",
|
||||
"word_end": true,
|
||||
"golden": false
|
||||
},
|
||||
{
|
||||
"id": "s_0003",
|
||||
"source": "auto",
|
||||
"confidence": 0.98,
|
||||
"locked": false,
|
||||
"text": "world",
|
||||
"start": 1.5,
|
||||
"end": 2.5,
|
||||
"midi": 60.0,
|
||||
"golden": false,
|
||||
"confidence": 0.98,
|
||||
"source": "auto"
|
||||
"type": "normal",
|
||||
"word_end": true,
|
||||
"golden": false
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
610
examples/demo_song/vocals_f0.json
Normal file
610
examples/demo_song/vocals_f0.json
Normal 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
|
||||
]
|
||||
}
|
||||
@ -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
|
||||
from pathlib import Path
|
||||
|
||||
import soundfile as sf
|
||||
|
||||
from songsplit.container import pack_songpack, unpack_songpack
|
||||
from songsplit.export.ultrastar import parse_ultrastar
|
||||
from songsplit.schema.chords import ChordsDocument
|
||||
from songsplit.schema.manifest import ManifestDocument
|
||||
from songsplit.schema.meta import MetaDocument
|
||||
from songsplit.schema.strumming import StrummingDocument
|
||||
from songsplit.schema.tempo import TempoDocument
|
||||
from songsplit.schema.tracks import TrackDocument
|
||||
from songsplit.schema.vocals import VocalsDocument
|
||||
from songsplit.schema.vocals_f0 import VocalsF0Document
|
||||
|
||||
|
||||
def test_demo_package_structure():
|
||||
@ -18,10 +22,14 @@ def test_demo_package_structure():
|
||||
assert demo_dir.is_dir()
|
||||
|
||||
required_files = [
|
||||
"manifest.json",
|
||||
"meta.json",
|
||||
"tempo.json",
|
||||
"vocals.json",
|
||||
"vocals_f0.json",
|
||||
"chords.json",
|
||||
"tracks/guitar.json",
|
||||
"export/song.txt",
|
||||
"strumming.json",
|
||||
"song.txt",
|
||||
]
|
||||
@ -39,12 +47,23 @@ def test_demo_package_structure():
|
||||
def test_demo_package_schemas():
|
||||
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_raw = json.loads((demo_dir / "meta.json").read_text(encoding="utf-8"))
|
||||
meta = MetaDocument.model_validate(meta_raw)
|
||||
assert meta.title == "Demo Song"
|
||||
assert meta.schema_version == "1.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_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)
|
||||
assert len(vocals.lines) >= 1
|
||||
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_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 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 = StrummingDocument.model_validate(strumming_raw)
|
||||
assert len(strumming.events) == 4
|
||||
@ -86,7 +121,7 @@ def test_demo_package_audio_properties():
|
||||
|
||||
def test_demo_package_ultrastar_roundtrip():
|
||||
demo_dir = Path("examples/demo_song")
|
||||
song_txt = demo_dir / "song.txt"
|
||||
song_txt = demo_dir / "export" / "song.txt"
|
||||
parsed = parse_ultrastar(song_txt)
|
||||
|
||||
assert parsed.title == "Demo Song"
|
||||
@ -96,3 +131,16 @@ def test_demo_package_ultrastar_roundtrip():
|
||||
|
||||
texts = [s.text for s in parsed.lines[0]]
|
||||
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()
|
||||
|
||||
@ -229,4 +229,3 @@ def test_vocals_f0_document():
|
||||
dumped = json.loads(f0.model_dump_json())
|
||||
assert dumped["hop_sec"] == 0.01
|
||||
assert dumped["hz"][2] == 220.0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user