diff --git a/LossyWAVSharp/LossyWAVSharp.csproj b/LossyWAVSharp/LossyWAVSharp.csproj
new file mode 100644
index 0000000..f8e436d
--- /dev/null
+++ b/LossyWAVSharp/LossyWAVSharp.csproj
@@ -0,0 +1,101 @@
+
+
+ Debug
+ AnyCPU
+ 8.0.50727
+ 2.0
+ {A574F3B1-E38B-4EE4-9394-49D6E2DF52EA}
+ Exe
+ Properties
+ LossyWAVSharp
+ LossyWAVSharp
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+ true
+ ..\bin\x64\Debug\
+ DEBUG;TRACE
+ full
+ x64
+ C:\Program Files (x86)\Microsoft Visual Studio 8\Team Tools\Static Analysis Tools\FxCop\\rules
+ true
+ GlobalSuppressions.cs
+ prompt
+
+
+ ..\bin\x64\Release\
+ TRACE
+ true
+ pdbonly
+ x64
+ C:\Program Files (x86)\Microsoft Visual Studio 8\Team Tools\Static Analysis Tools\FxCop\\rules
+ true
+ GlobalSuppressions.cs
+ prompt
+
+
+ true
+ ..\bin\win32\Debug\
+ DEBUG;TRACE
+ full
+ x86
+ C:\Program Files (x86)\Microsoft Visual Studio 8\Team Tools\Static Analysis Tools\FxCop\\rules
+ true
+ GlobalSuppressions.cs
+ prompt
+
+
+ ..\bin\win32\Release\
+ TRACE
+ true
+ pdbonly
+ x86
+ C:\Program Files (x86)\Microsoft Visual Studio 8\Team Tools\Static Analysis Tools\FxCop\\rules
+ true
+ GlobalSuppressions.cs
+ prompt
+
+
+
+
+
+
+
+
+
+
+
+
+ {6458A13A-30EF-45A9-9D58-E5031B17BEE2}
+ AudioCodecsDotNet
+
+
+ {8A0426FA-0BC2-4C49-A6E5-1F9A68156F19}
+ LossyWAVDotNet
+
+
+
+
+
\ No newline at end of file
diff --git a/LossyWAVSharp/LossyWAVSharp.csproj.user b/LossyWAVSharp/LossyWAVSharp.csproj.user
new file mode 100644
index 0000000..f2c8722
--- /dev/null
+++ b/LossyWAVSharp/LossyWAVSharp.csproj.user
@@ -0,0 +1,6 @@
+
+
+ -
+ C:\Work\cuetoolsnet\bin\x64\Release\
+
+
\ No newline at end of file
diff --git a/LossyWAVSharp/Program.cs b/LossyWAVSharp/Program.cs
new file mode 100644
index 0000000..c3bc6bc
--- /dev/null
+++ b/LossyWAVSharp/Program.cs
@@ -0,0 +1,130 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.IO;
+using LossyWAVDotNet;
+using AudioCodecsDotNet;
+
+namespace LossyWAVSharp
+{
+ class Program
+ {
+ static void Usage()
+ {
+ Console.WriteLine("Usage : LossyWAVSharp.exe ");
+ Console.WriteLine();
+ Console.WriteLine("Quality Options:");
+ Console.WriteLine();
+ Console.WriteLine("-I, --insane highest quality output, suitable for transcoding;");
+ Console.WriteLine("-E, --extreme high quality output, also suitable for transcoding;");
+ Console.WriteLine("-S, --standard default quality output, considered to be transparent;");
+ Console.WriteLine("-P, --portable good quality output for DAP use. Not considered to be fully");
+ Console.WriteLine(" transparent, but considered fit for its intended purpose.");
+ Console.WriteLine();
+ Console.WriteLine("Standard Options:");
+ Console.WriteLine();
+ Console.WriteLine("-C, --correction write correction file for processed WAV file; default=off.");
+ Console.WriteLine("-h, --help display help.");
+ Console.WriteLine();
+ Console.WriteLine("Advanced Options:");
+ Console.WriteLine();
+ Console.WriteLine("-q, --quality quality preset (10=highest quality, 0=lowest bitrate;");
+ Console.WriteLine(" default = --standard = 5; --insane = 10; --extreme = 7.5;");
+ Console.WriteLine(" --portable = 2.5)");
+ Console.WriteLine("-N --stdinname pseudo filename to use when input from STDIN.");
+ }
+
+ static void Main(string[] args)
+ {
+ Console.SetOut(Console.Error);
+ Console.WriteLine("LossyWAV {0}, Copyright (C) 2007,2008 Nick Currie, Copyleft.", LossyWAVWriter.version_string);
+ Console.WriteLine("C# port Copyright (C) 2008 Gregory S. Chudov.");
+ Console.WriteLine("This is free software under the GNU GPLv3+ license; There is NO WARRANTY, to");
+ Console.WriteLine("the extent permitted by law. for details.");
+ if (args.Length < 1 || (args[0].StartsWith("-") && args[0] != "-"))
+ {
+ Usage();
+ return;
+ }
+ string sourceFile = args[0];
+ string stdinName = null;
+ double quality = 5.0;
+ bool createCorrection = false;
+ for (int arg = 1; arg < args.Length; arg++)
+ {
+ bool ok = true;
+ if (args[arg] == "-I" || args[arg] == "--insane")
+ quality = 10;
+ else if (args[arg] == "-E" || args[arg] == "--extreme")
+ quality = 7.5;
+ else if (args[arg] == "-S" || args[arg] == "--standard")
+ quality = 5.0;
+ else if (args[arg] == "-P" || args[arg] == "--portable")
+ quality = 2.5;
+ else if (args[arg] == "-C" || args[arg] == "--correction")
+ createCorrection = true;
+ else if ((args[arg] == "-N" || args[arg] == "--stdinname") && ++arg < args.Length)
+ stdinName = args[arg];
+ else if ((args[arg] == "-q" || args[arg] == "--quality") && ++arg < args.Length)
+ ok = double.TryParse(args[arg], out quality);
+ else
+ ok = false;
+ if (!ok)
+ {
+ Usage();
+ return;
+ }
+ }
+ //Stream stdout = Console.OpenStandardOutput();
+ DateTime start = DateTime.Now;
+ TimeSpan lastPrint = TimeSpan.FromMilliseconds(0);
+ try
+ {
+ WAVReader audioSource = new WAVReader(sourceFile, (sourceFile == "-" ? Console.OpenStandardInput() : null));
+ if (sourceFile == "-" && stdinName != null) sourceFile = stdinName;
+ WAVWriter audioDest = new WAVWriter(Path.ChangeExtension(sourceFile, ".lossy.wav"), audioSource.BitsPerSample, audioSource.ChannelCount, audioSource.SampleRate);
+ WAVWriter lwcdfDest = createCorrection ? new WAVWriter(Path.ChangeExtension(sourceFile, ".lwcdf.wav"), audioSource.BitsPerSample, audioSource.ChannelCount, audioSource.SampleRate) : null;
+ LossyWAVWriter lossyWAV = new LossyWAVWriter(audioDest, lwcdfDest, audioSource.BitsPerSample, audioSource.ChannelCount, audioSource.SampleRate, quality);
+ int[,] buff = new int[0x1000, audioSource.ChannelCount];
+
+ Console.WriteLine("Filename : {0}", sourceFile);
+ Console.WriteLine("File Info : {0}kHz; {1} channel; {2} bit; {3}", audioSource.SampleRate, audioSource.ChannelCount, audioSource.BitsPerSample, TimeSpan.FromSeconds(audioSource.Length * 1.0 / audioSource.SampleRate));
+
+ do
+ {
+ uint samplesRead = audioSource.Read(buff, Math.Min((uint)buff.GetLength(0), (uint)audioSource.Remaining));
+ if (samplesRead == 0) break;
+ lossyWAV.Write(buff, samplesRead);
+ TimeSpan elapsed = DateTime.Now - start;
+ if ((elapsed - lastPrint).TotalMilliseconds > 60)
+ {
+ Console.Error.Write("\rProgress : {0:00}%; {1:0.0000} bits; {2:0.00}x; {3}/{4}",
+ 100.0 * audioSource.Position / audioSource.Length,
+ 1.0 * lossyWAV.OverallBitsRemoved / audioSource.ChannelCount / lossyWAV.BlocksProcessed,
+ lossyWAV.SamplesProcessed / elapsed.TotalSeconds / audioSource.SampleRate,
+ elapsed,
+ TimeSpan.FromMilliseconds(elapsed.TotalMilliseconds / lossyWAV.SamplesProcessed * audioSource.Length)
+ );
+ lastPrint = elapsed;
+ }
+ } while (true);
+
+ TimeSpan totalElapsed = DateTime.Now - start;
+ Console.Error.Write("\r \r");
+ Console.WriteLine("Results : {0:0.0000} bits; {1:0.00}x; {2}",
+ (1.0 * lossyWAV.OverallBitsRemoved) / audioSource.ChannelCount / lossyWAV.BlocksProcessed,
+ lossyWAV.SamplesProcessed / totalElapsed.TotalSeconds / audioSource.SampleRate,
+ totalElapsed
+ );
+ audioSource.Close();
+ lossyWAV.Close();
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine();
+ Console.WriteLine("Error: {0}", ex.Message);
+ Console.WriteLine("{0}", ex.StackTrace);
+ }
+ }
+ }
+}
diff --git a/LossyWAVSharp/Properties/AssemblyInfo.cs b/LossyWAVSharp/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..bb6b2ca
--- /dev/null
+++ b/LossyWAVSharp/Properties/AssemblyInfo.cs
@@ -0,0 +1,33 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("LossyWAV# command line utility")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Copyleft")]
+[assembly: AssemblyProduct("LossyWAV#")]
+[assembly: AssemblyCopyright("Copyright c 2007, 2008 Nick Currie, C# port by Greg Chudov")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("5fdc4393-9a1a-439d-989f-1c055f189b74")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+[assembly: AssemblyVersion("1.1.1.0")]
+[assembly: AssemblyFileVersion("1.1.1.0")]