-
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathProgram.cs
More file actions
678 lines (610 loc) · 30 KB
/
Program.cs
File metadata and controls
678 lines (610 loc) · 30 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
using Logger;
using OwnaudioNET.Features.Vocalremover;
namespace OwnSeparator.MultiModel
{
/// <summary>
/// Example program demonstrating multi-model audio separator with averaging
///
/// This example shows how to use multiple UVR MDX models in parallel
/// and average their outputs for better quality results.
///
/// How it works:
/// - All models process the original audio independently (parallel processing)
/// - Each model outputs vocals and instrumental (auto-detected or configured)
/// - Vocals from all models are averaged together
/// - Instrumentals from all models are averaged together
/// - Final result: High-quality averaged vocals + averaged instrumental
///
/// Common use cases:
/// 1. Multiple vocal models → Averaged vocals with better quality
/// 2. Multiple instrumental models → Averaged instrumental with less artifacts
/// 3. Mixed models (some vocal-focused, some instrumental-focused) → Best of both worlds
/// </summary>
class Program
{
static void Main(string[] args)
{
Log.Info(" OwnAudioSharp - Multi-Model Audio Separator");
// Parse command line arguments
if (args.Length > 0 && args[0] == "--help")
{
ShowHelp();
return;
}
// Default paths (modify these for your environment)
string audioFilePath = args.Length > 0 ? args[0] : @"/path/to/audio.mp3";
string outputDirectory = args.Length > 1 ? args[1] : @"/path/to/output/directory";
Log.Info("Choose an example:");
Log.Info("1. Simple 2-Model Averaging (Best + Karaoke)");
Log.Info("2. Triple Model Averaging (Best + Default + Karaoke)");
Log.Info("3. Custom Pipeline with Intermediate Saves");
Log.Info("4. Custom Model Files Pipeline");
Log.Info("5. Averaging Demo with Auto-Detection");
Log.Info("6. Mixed OutputType Demo (Vocals + Instrumental models)");
Console.Write("Enter choice (1-6): ");
string? choice = Console.ReadLine();
try
{
switch (choice)
{
case "1":
RunSimplePipeline(audioFilePath, outputDirectory);
break;
case "2":
RunTriplePipeline(audioFilePath, outputDirectory);
break;
case "3":
RunCustomPipelineWithDebug(audioFilePath, outputDirectory);
break;
case "4":
RunCustomFilesPipeline(audioFilePath, outputDirectory);
break;
case "5":
RunAveragingDemo(audioFilePath, outputDirectory);
break;
case "6":
RunMixedOutputTypeDemo(audioFilePath, outputDirectory);
break;
default:
Log.Info("Invalid choice. Running simple pipeline as default.");
RunSimplePipeline(audioFilePath, outputDirectory);
break;
}
}
catch (FileNotFoundException ex)
{
Log.Warning($"Error: File not found");
Log.Warning($" {ex.Message}");
Log.Warning("Please update the file paths in the code or pass them as arguments:");
Log.Warning(" dotnet run <audio-file> <output-directory>");
}
catch (Exception ex)
{
Log.Warning($"Error occurred: {ex.Message}");
Log.Warning("Stack trace:");
Log.Warning(ex.StackTrace);
}
Console.WriteLine();
Console.WriteLine("Press any key to exit...");
Console.ReadKey();
}
/// <summary>
/// Example 1: Simple 2-model averaging using helper method
/// This is the easiest way to average results from multiple models
/// </summary>
static void RunSimplePipeline(string audioFilePath, string outputDirectory)
{
Console.WriteLine();
Console.WriteLine(" Example 1: Simple 2-Model Averaging");
Console.WriteLine();
Console.WriteLine($"Input: {audioFilePath}");
Console.WriteLine($"Output: {outputDirectory}");
Console.WriteLine();
Console.WriteLine("ℹ️ Both models will process the original audio independently.");
Console.WriteLine(" Results will be averaged for better quality.");
Console.WriteLine();
// Create separator using helper method
var separator = MultiModelExtensions.CreateSimplePipeline(
model1: InternalModel.Best,
model2: InternalModel.Karaoke,
outputDirectory: outputDirectory
);
// Subscribe to progress updates
separator.ProgressChanged += OnProgressChanged;
separator.ProcessingCompleted += OnProcessingCompleted;
// Initialize and process
Console.WriteLine("⚙Initializing models...");
separator.Initialize();
Console.WriteLine("Starting processing...");
Console.WriteLine();
var result = separator.Separate(audioFilePath);
Console.WriteLine();
Console.WriteLine("Processing completed!");
Console.WriteLine($" Time: {result.ProcessingTime}");
Console.WriteLine($" Models: {result.ModelsProcessed}");
Console.WriteLine();
Console.WriteLine("Output files:");
Console.WriteLine($" 🎤 Vocals: {result.VocalsPath}");
Console.WriteLine($" 🎸 Instrumental: {result.InstrumentalPath}");
separator.Dispose();
}
/// <summary>
/// Example 2: Triple model averaging with all intermediate results saved
/// </summary>
static void RunTriplePipeline(string audioFilePath, string outputDirectory)
{
Console.WriteLine();
Console.WriteLine(" Example 2: Triple Model Averaging");
Console.WriteLine();
Console.WriteLine($"Input: {audioFilePath}");
Console.WriteLine($"Output: {outputDirectory}");
Console.WriteLine();
Console.WriteLine("Models: Best + Default + Karaoke (all parallel)");
Console.WriteLine("All intermediate results will be saved.");
Console.WriteLine();
Console.WriteLine("Each model processes the original audio independently.");
Console.WriteLine(" Results are averaged: (Best + Default + Karaoke) / 3");
Console.WriteLine();
// Create separator with 3 models
var separator = MultiModelExtensions.CreateTriplePipeline(
model1: InternalModel.Best,
model2: InternalModel.Default,
model3: InternalModel.Karaoke,
outputDirectory: outputDirectory
);
// Subscribe to events
separator.ProgressChanged += OnProgressChanged;
separator.ProcessingCompleted += OnProcessingCompleted;
// Initialize and process
Console.WriteLine("⚙Initializing models...");
separator.Initialize();
Console.WriteLine("Starting processing...");
Console.WriteLine();
var result = separator.Separate(audioFilePath);
Console.WriteLine();
Console.WriteLine("Processing completed!");
Console.WriteLine($" Time: {result.ProcessingTime}");
Console.WriteLine($" Models: {result.ModelsProcessed}");
Console.WriteLine();
Console.WriteLine("Final outputs:");
Console.WriteLine($" Vocals: {result.VocalsPath}");
Console.WriteLine($" Instrumental: {result.InstrumentalPath}");
Console.WriteLine();
Console.WriteLine("Intermediate results:");
foreach (var intermediate in result.IntermediatePaths)
{
Console.WriteLine($" {intermediate.Key}:");
Console.WriteLine($" {intermediate.Value}");
}
separator.Dispose();
}
/// <summary>
/// Example 3: Custom averaging pipeline with full control and debugging
/// </summary>
static void RunCustomPipelineWithDebug(string audioFilePath, string outputDirectory)
{
Console.WriteLine();
Console.WriteLine(" Example 3: Custom Averaging with Debug Mode");
Console.WriteLine();
Console.WriteLine($"Input: {audioFilePath}");
Console.WriteLine($"Output: {outputDirectory}");
Console.WriteLine();
Console.WriteLine("This example shows fine-grained control over averaging.");
Console.WriteLine();
// Create options with full control
var options = new MultiModelSeparationOptions
{
Models = new List<MultiModelInfo>
{
new MultiModelInfo
{
Name = "Step1_VocalExtraction",
Model = InternalModel.Best,
NFft = 6144,
DimT = 8,
DimF = 2048,
DisableNoiseReduction = false,
SaveIntermediateOutput = true // Save this step
},
new MultiModelInfo
{
Name = "Step2_Enhancement",
Model = InternalModel.Default,
NFft = 6144,
DimT = 8,
DimF = 2048,
DisableNoiseReduction = false,
SaveIntermediateOutput = true // Save this step
},
new MultiModelInfo
{
Name = "Step3_FinalPolish",
Model = InternalModel.Karaoke,
NFft = 6144,
DimT = 8,
DimF = 2048,
DisableNoiseReduction = true, // Different setting
SaveIntermediateOutput = false // Don't save (we have final)
}
},
OutputDirectory = outputDirectory,
EnableGPU = true,
ChunkSizeSeconds = 15,
Margin = 44100,
SaveAllIntermediateResults = true // Force save all
};
Console.WriteLine($"Pipeline configured with {options.Models.Count} models:");
for (int i = 0; i < options.Models.Count; i++)
{
var model = options.Models[i];
Console.WriteLine($" {i + 1}. {model.Name}");
Console.WriteLine($" Model: {model.Model}");
Console.WriteLine($" FFT: {model.NFft}, DimF: {model.DimF}, DimT: {model.DimT}");
Console.WriteLine($" Noise Reduction: {!model.DisableNoiseReduction}");
}
Console.WriteLine();
var separator = new MultiModelAudioSeparator(options);
// Detailed progress reporting
separator.ProgressChanged += (sender, progress) =>
{
Console.Write($"\r[Model {progress.CurrentModelIndex}/{progress.TotalModels}: {progress.CurrentModelName}] ");
Console.Write($"Chunk {progress.ProcessedChunks}/{progress.TotalChunks} ");
Console.Write($"({progress.OverallProgress:F1}%) - {progress.Status}");
};
separator.ProcessingCompleted += (sender, result) =>
{
Console.WriteLine();
Console.WriteLine();
Console.WriteLine($"Total processing time: {result.ProcessingTime}");
};
// Initialize and process
Console.WriteLine("Initializing models...");
separator.Initialize();
Console.WriteLine("Starting processing...");
Console.WriteLine();
var result = separator.Separate(audioFilePath);
Console.WriteLine();
Console.WriteLine("Processing completed!");
Console.WriteLine();
Console.WriteLine("Final outputs:");
Console.WriteLine($" Vocals: {result.VocalsPath}");
Console.WriteLine($" Instrumental: {result.InstrumentalPath}");
Console.WriteLine();
Console.WriteLine("All intermediate files:");
foreach (var intermediate in result.IntermediatePaths.OrderBy(x => x.Key))
{
Console.WriteLine($" {intermediate.Key}:");
Console.WriteLine($" {intermediate.Value}");
}
separator.Dispose();
}
/// <summary>
/// Example 4: Using custom model files from disk with auto-detection
/// </summary>
static void RunCustomFilesPipeline(string audioFilePath, string outputDirectory)
{
Console.WriteLine();
Console.WriteLine(" Example 4: Custom Model Files");
Console.WriteLine();
Console.WriteLine("This example shows how to use custom ONNX models from disk.");
Console.WriteLine("OutputType will be auto-detected from filename:");
Console.WriteLine(" - 'Voc_FT' contains 'Voc' → Auto-detected as Vocals");
Console.WriteLine(" - 'Inst_HQ_3' contains 'Inst' → Auto-detected as Instrumental");
Console.WriteLine();
// Example paths (update these to your actual model files)
string model1Path =
@"/path/model_1.onnx";
string model2Path = @"/path/model_2.onnx";
var options = new MultiModelSeparationOptions
{
Models = new List<MultiModelInfo>
{
new MultiModelInfo
{
Name = "CustomModel1",
ModelPath = model1Path,
NFft = 6144,
DimT = 8,
DimF = 2048
},
new MultiModelInfo
{
Name = "CustomModel2",
ModelPath = model2Path,
NFft = 6144,
DimT = 8,
DimF = 2048
}
},
OutputDirectory = outputDirectory,
EnableGPU = true
};
Console.WriteLine($"Input: {audioFilePath}");
Console.WriteLine($"Output: {outputDirectory}");
Console.WriteLine();
Console.WriteLine("Models:");
Console.WriteLine($" 1. {model1Path}");
Console.WriteLine($" 2. {model2Path}");
Console.WriteLine();
var separator = new MultiModelAudioSeparator(options);
separator.ProgressChanged += OnProgressChanged;
separator.ProcessingCompleted += OnProcessingCompleted;
Console.WriteLine("Initializing custom models...");
separator.Initialize();
Console.WriteLine("Starting processing...");
Console.WriteLine();
var result = separator.Separate(audioFilePath);
Console.WriteLine();
Console.WriteLine("Processing completed!");
Console.WriteLine();
Console.WriteLine("Output files:");
Console.WriteLine($" Vocals: {result.VocalsPath}");
Console.WriteLine($" Instrumental: {result.InstrumentalPath}");
separator.Dispose();
}
/// <summary>
/// Example 5: Demonstrates how multi-model averaging works with auto-detection
/// Shows the parallel processing pipeline with detailed explanation
/// </summary>
static void RunAveragingDemo(string audioFilePath, string outputDirectory)
{
Console.WriteLine();
Console.WriteLine(" Example 5: Multi-Model Averaging Demo");
Console.WriteLine();
Console.WriteLine("This demo shows how multi-model averaging works:");
Console.WriteLine();
Console.WriteLine(" Original Mix");
Console.WriteLine(" │");
Console.WriteLine(" ┌────────────┼────────────┐");
Console.WriteLine(" ↓ ↓ ↓");
Console.WriteLine(" ┌────────┐ ┌────────┐ ┌────────┐");
Console.WriteLine(" │Model 1 │ │Model 2 │ │Model 3 │ ← All process original");
Console.WriteLine(" │ Best │ │Default │ │Karaoke │ independently");
Console.WriteLine(" └────────┘ └────────┘ └────────┘");
Console.WriteLine(" │ │ │");
Console.WriteLine(" ↓ ↓ ↓");
Console.WriteLine(" V₁ + I₁ V₂ + I₂ V₃ + I₃");
Console.WriteLine(" │ │ │");
Console.WriteLine(" └────────────┼────────────┘");
Console.WriteLine(" ↓");
Console.WriteLine(" ┌─────────────┐");
Console.WriteLine(" │ AVERAGING │");
Console.WriteLine(" └─────────────┘");
Console.WriteLine(" │");
Console.WriteLine(" ┌────────────┴────────────┐");
Console.WriteLine(" ↓ ↓");
Console.WriteLine(" Vocals_avg Instrumental_avg");
Console.WriteLine(" (V₁+V₂+V₃)/3 (I₁+I₂+I₃)/3");
Console.WriteLine(" │ │");
Console.WriteLine(" ↓ ↓");
Console.WriteLine(" SAVE! SAVE!");
Console.WriteLine();
Console.WriteLine($"Input: {audioFilePath}");
Console.WriteLine($"Output: {outputDirectory}");
Console.WriteLine();
var options = new MultiModelSeparationOptions
{
Models = new List<MultiModelInfo>
{
new MultiModelInfo
{
Name = "Model_Best",
Model = InternalModel.Best,
NFft = 6144,
DimT = 8,
DimF = 2048,
DisableNoiseReduction = false
// OutputType = null (auto-detect)
},
new MultiModelInfo
{
Name = "Model_Default",
Model = InternalModel.Default,
NFft = 6144,
DimT = 8,
DimF = 2048,
DisableNoiseReduction = false
// OutputType = null (auto-detect)
},
new MultiModelInfo
{
Name = "Model_Karaoke",
Model = InternalModel.Karaoke,
NFft = 6144,
DimT = 8,
DimF = 2048,
DisableNoiseReduction = false
// OutputType = null (auto-detect)
}
},
OutputDirectory = outputDirectory,
EnableGPU = true,
ChunkSizeSeconds = 15,
Margin = 44100,
SaveAllIntermediateResults = true // Save individual model outputs
};
var separator = new MultiModelAudioSeparator(options);
separator.ProgressChanged += (sender, progress) =>
{
Console.Write($"\rProcessing model {progress.CurrentModelIndex}/{progress.TotalModels} ");
Console.Write($"({progress.CurrentModelName})... ");
Console.Write($"Chunk {progress.ProcessedChunks}/{progress.TotalChunks} ({progress.OverallProgress:F1}%)");
};
Console.WriteLine("Initializing models...");
separator.Initialize();
Console.WriteLine("Starting parallel processing + averaging pipeline...");
Console.WriteLine();
var startTime = DateTime.Now;
var result = separator.Separate(audioFilePath);
var elapsed = DateTime.Now - startTime;
Console.WriteLine();
Console.WriteLine();
Console.WriteLine("Processing completed!");
Console.WriteLine();
Console.WriteLine("Statistics:");
Console.WriteLine($" Total time: {elapsed}");
Console.WriteLine($" Models used: {result.ModelsProcessed}");
Console.WriteLine($" Memory: Streaming (minimal footprint)");
Console.WriteLine();
Console.WriteLine("Final averaged outputs:");
Console.WriteLine($" Vocals (averaged): {result.VocalsPath}");
Console.WriteLine($" ↳ Average of {result.ModelsProcessed} model outputs");
Console.WriteLine($" Instrumental (averaged): {result.InstrumentalPath}");
Console.WriteLine($" ↳ Average of {result.ModelsProcessed} model outputs");
Console.WriteLine();
Console.WriteLine("Individual model outputs:");
foreach (var intermediate in result.IntermediatePaths.OrderBy(x => x.Key))
{
Console.WriteLine($" {intermediate.Key}");
}
Console.WriteLine();
Console.WriteLine("How averaging works:");
Console.WriteLine(" 1. All models process the ORIGINAL audio independently");
Console.WriteLine(" 2. Each model outputs vocals and instrumental");
Console.WriteLine(" 3. Vocals from all models are averaged: (V₁+V₂+V₃)/3");
Console.WriteLine(" 4. Instrumentals from all models are averaged: (I₁+I₂+I₃)/3");
Console.WriteLine(" 5. Result: Better quality with reduced artifacts!");
separator.Dispose();
}
/// <summary>
/// Example 6: Mixed OutputType demo - combining vocal and instrumental models
/// Shows explicit OutputType configuration for models that output different stems
/// </summary>
static void RunMixedOutputTypeDemo(string audioFilePath, string outputDirectory)
{
Console.WriteLine();
Console.WriteLine(" Example 6: Mixed OutputType Demo");
Console.WriteLine();
Console.WriteLine("This demo shows how to combine models with different outputs:");
Console.WriteLine();
Console.WriteLine(" Model 1 (Voc_FT) → Outputs VOCALS");
Console.WriteLine(" Model 2 (Inst_HQ_3) → Outputs INSTRUMENTAL");
Console.WriteLine();
Console.WriteLine(" The system will:");
Console.WriteLine(" 1. Extract vocals from Model 1 (direct output)");
Console.WriteLine(" 2. Calculate instrumental from Model 1 (original - vocals)");
Console.WriteLine(" 3. Extract instrumental from Model 2 (direct output)");
Console.WriteLine(" 4. Calculate vocals from Model 2 (original - instrumental)");
Console.WriteLine(" 5. Average both vocals: (V₁ + V₂) / 2");
Console.WriteLine(" 6. Average both instrumentals: (I₁ + I₂) / 2");
Console.WriteLine();
Console.WriteLine($"Input: {audioFilePath}");
Console.WriteLine($"Output: {outputDirectory}");
Console.WriteLine();
var options = new MultiModelSeparationOptions
{
Models = new List<MultiModelInfo>
{
new MultiModelInfo
{
Name = "VocalModel_VocFT",
ModelPath = @"/path/to/Voc_FT.onnx",
NFft = 6144,
DimT = 8,
DimF = 2048,
OutputType = ModelOutputType.Vocals // Explicit: this outputs VOCALS
},
new MultiModelInfo
{
Name = "InstrumentalModel_InstHQ3",
ModelPath = @"/path/to/Inst_HQ_3.onnx",
NFft = 6144,
DimT = 8,
DimF = 2048,
OutputType = ModelOutputType.Instrumental // Explicit: this outputs INSTRUMENTAL
}
},
OutputDirectory = outputDirectory,
EnableGPU = true,
ChunkSizeSeconds = 15,
Margin = 44100,
SaveAllIntermediateResults = true
};
Console.WriteLine("Configuration:");
for (int i = 0; i < options.Models.Count; i++)
{
var model = options.Models[i];
Console.WriteLine($" Model {i + 1}: {model.Name}");
Console.WriteLine($" OutputType: {model.OutputType}");
Console.WriteLine($" Path: {Path.GetFileName(model.ModelPath ?? "embedded")}");
}
Console.WriteLine();
var separator = new MultiModelAudioSeparator(options);
separator.ProgressChanged += (sender, progress) =>
{
Console.Write($"\r[{progress.CurrentModelName}] ");
Console.Write($"Chunk {progress.ProcessedChunks}/{progress.TotalChunks} ({progress.OverallProgress:F1}%)");
};
Console.WriteLine("Initializing models...");
separator.Initialize();
Console.WriteLine("Starting processing...");
Console.WriteLine();
var result = separator.Separate(audioFilePath);
Console.WriteLine();
Console.WriteLine();
Console.WriteLine("Processing completed!");
Console.WriteLine($" Time: {result.ProcessingTime}");
Console.WriteLine();
Console.WriteLine("Final averaged outputs:");
Console.WriteLine($" Vocals (averaged): {result.VocalsPath}");
Console.WriteLine($" ↳ (Vocal model output + Instrumental model complement) / 2");
Console.WriteLine($" Instrumental (averaged): {result.InstrumentalPath}");
Console.WriteLine($" ↳ (Instrumental model output + Vocal model complement) / 2");
Console.WriteLine();
Console.WriteLine("Individual model outputs:");
foreach (var intermediate in result.IntermediatePaths.OrderBy(x => x.Key))
{
Console.WriteLine($" {intermediate.Key}");
}
Console.WriteLine();
Console.WriteLine("Benefits of mixing OutputTypes:");
Console.WriteLine(" Combines strengths of specialized models");
Console.WriteLine(" Vocal-focused model improves vocal quality");
Console.WriteLine(" Instrumental-focused model improves instrumental quality");
Console.WriteLine(" Averaging reduces artifacts from both");
separator.Dispose();
}
/// <summary>
/// Standard progress event handler
/// </summary>
static void OnProgressChanged(object? sender, MultiModelSeparationProgress progress)
{
Console.Write($"\r[{progress.CurrentModelIndex}/{progress.TotalModels}: {progress.CurrentModelName}] ");
Console.Write($"{progress.Status} ({progress.OverallProgress:F1}%)");
}
/// <summary>
/// Processing completed event handler
/// </summary>
static void OnProcessingCompleted(object? sender, MultiModelSeparationResult result)
{
Console.WriteLine();
Console.WriteLine();
Console.WriteLine($"⏱Processing time: {result.ProcessingTime}");
Console.WriteLine($"Vocals: {result.VocalsPath}");
Console.WriteLine($"Instrumental: {result.InstrumentalPath}");
}
/// <summary>
/// Show help information
/// </summary>
static void ShowHelp()
{
Console.WriteLine("Usage: dotnet run [audio-file] [output-directory]");
Console.WriteLine();
Console.WriteLine("Arguments:");
Console.WriteLine(" audio-file Path to input audio file (WAV, MP3, or FLAC)");
Console.WriteLine(" output-directory Path to output directory for results");
Console.WriteLine();
Console.WriteLine("Examples:");
Console.WriteLine(" dotnet run song.mp3 output/");
Console.WriteLine(" dotnet run \"C:\\Music\\song.wav\" \"C:\\Output\\\"");
Console.WriteLine();
Console.WriteLine("The program will prompt you to choose an example pipeline:");
Console.WriteLine(" 1. Simple 2-Model Averaging");
Console.WriteLine(" 2. Triple Model Averaging");
Console.WriteLine(" 3. Custom Pipeline with Debug");
Console.WriteLine(" 4. Custom Model Files");
Console.WriteLine(" 5. Averaging Demo with Auto-Detection");
Console.WriteLine(" 6. Mixed OutputType Demo (Vocals + Instrumental models)");
}
}
}