Spaces:
Sleeping
Sleeping
| import sys | |
| from pathlib import Path | |
| sys.path.insert(0, str(Path(__file__).resolve().parents[1])) | |
| import json | |
| import tempfile | |
| import soundfile as sf | |
| from synth_generator import generate_test_song | |
| from pipeline_runner import PipelineParams, run_extraction_pipeline | |
| song = generate_test_song(pattern_name='rock', bars=2, bpm=120, add_bass=False) | |
| out = Path(tempfile.mkdtemp(prefix='dse-test-')) | |
| inp = out / 'input.wav' | |
| sf.write(inp, song.drums_only, song.sr) | |
| params = PipelineParams(stem='all', target_min=4, target_max=8, synthesize=True) | |
| res = run_extraction_pipeline(inp, out / 'out', params) | |
| print(json.dumps({ | |
| 'duration_sec': res.duration_sec, | |
| 'audio_duration_sec': res.audio_duration_sec, | |
| 'realtime_factor': res.realtime_factor, | |
| 'hit_count': res.hit_count, | |
| 'cluster_count': res.cluster_count, | |
| 'stages': res.stages, | |
| 'files': res.files, | |
| }, indent=2)) | |