-
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathProgram.cs
More file actions
57 lines (48 loc) · 1.93 KB
/
Program.cs
File metadata and controls
57 lines (48 loc) · 1.93 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
using Logger;
using OwnaudioNET.Features.Vocalremover;
using static OwnaudioNET.Features.Vocalremover.SimpleSeparator;
namespace OwnSeparator.BasicConsole
{
/// <summary>
/// Example program demonstrating simplified audio separator usage
/// </summary>
class Program
{
static void Main(string[] args)
{
Log.Info("OwnSeparator Audio Separation - Simplified");
Log.Info("==========================================");
string audioFilePath = @"path/audio/music.flac";
string outputDirectory = @"path/output";
try
{
// Create and initialize the separator
(SimpleAudioSeparationService? service, string vocalPath, string instrumentPath) = Separator(InternalModel.Default, outputDirectory);
if (service != null)
{
// Subscribe to events
service.ProgressChanged += (s, progress) =>
Log.Info($"{progress?.Status}: {progress?.OverallProgress:F1}%");
service.ProcessingCompleted += (s, result) =>
Log.Info($"Completed: {result?.ProcessingTime}");
// Process the audio file
Log.Info("Starting processing...");
var result = service.Separate(audioFilePath);
Log.Info($"Vocals file: {result.VocalsPath}");
Log.Info($"Instrumental file: {result.InstrumentalPath}");
service.Dispose();
}
}
catch (FileNotFoundException ex)
{
Log.Info($"File not found: {ex.Message}");
}
catch (Exception ex)
{
Log.Info($"An error occurred: {ex.Message}");
}
Log.Info("Press any key to exit...");
Console.Read();
}
}
}