Split multi-channel WAV files into single channel WAV files.
Перейти к файлу
Wiesław Šoltés 4ed8cb7124 Update README.md 2016-09-05 12:36:14 +02:00
docs Added cake build system 2016-09-03 15:04:50 +02:00
src Update SharedAssemblyInfo.cs 2016-09-05 12:30:49 +02:00
wav Renamed folder 2016-09-03 11:47:13 +02:00
.editorconfig Create .editorconfig 2016-09-05 12:31:22 +02:00
.gitattributes Added cake build system 2016-09-03 15:04:50 +02:00
.gitignore Updated .gitignore 2016-09-04 16:04:40 +02:00
.travis.yml Added cake build system 2016-09-03 15:04:50 +02:00
LICENSE.TXT Updated project structure 2016-09-03 11:54:45 +02:00
NuGet.Config Added avalonia version 2016-09-04 17:56:01 +02:00
README.md Update README.md 2016-09-05 12:36:14 +02:00
Reference.txt Added cake build system 2016-09-03 15:04:50 +02:00
SimpleWavSplitter.sln Added avalonia version 2016-09-04 17:56:01 +02:00
appveyor.yml Update appveyor.yml 2016-09-05 12:30:15 +02:00
build.cake Update build.cake 2016-09-05 12:32:08 +02:00
build.ps1 Added mono platform to validation set 2016-09-04 15:19:55 +02:00
build.sh Make build script executable 2016-09-03 23:32:42 +02:00

README.md

SimpleWavSplitter

Gitter

Build status Build Status

NuGet MyGet

Split multi-channel WAV files into single channel WAV files.

Install

Package Latest release Pre-release
SimpleWavSplitter.Avalonia Chocolatey Chocolatey
SimpleWavSplitter.Wpf Chocolatey Chocolatey

NuGet

SimpleWavSplitter is delivered as a NuGet package.

You can find the package on NuGet or by using nightly build feed:

  • Add https://www.myget.org/F/simplewavsplitter-nightly/api/v2 to your package sources
  • Update your package using WavFile feed

You can install the package like this:

Install-Package WavFile -Pre

Package Dependencies

Does not require any external dependencies.

Package Sources

Resources

Using SimpleWavSplitter

Split Wav Files

using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Threading;
using WavFile;
using static System.Console;
using static System.Math;

namespace SimpleWavSplitter.Console
{
    class Program
    {
        static void Main(string[] args)
        {
            string fileName = string.Empty;
            string outputPath = string.Empty;
            if (args.Count() == 1)
            {
                fileName = args[0];
                outputPath = fileName.Remove(fileName.Length - Path.GetFileName(fileName).Length);
            }
            else if (args.Count() == 2)
            {
                fileName = args[0];
                outputPath = args[1];
            }
            else
            {
                var v = Assembly.GetExecutingAssembly().GetName().Version;
                WriteLine(
                    string.Format(
                        "SimpleWavSplitterConsole v{0}.{1}.{2}", 
                        v.Major, v.Minor, v.Build));
                Write(Environment.NewLine);
                WriteLine("Usage:");
                WriteLine("SimpleWavSplitter.Console <file.wav> [<OutputPath>]");
                Environment.Exit(-1);
            }

            try
            {
                long bytesTotal = 0;
                var splitter = new WavFileSplitter(
                    value => Write(string.Format("\rProgress: {0:0.0}%", value)));
                var sw = Stopwatch.StartNew();
                bytesTotal = splitter.SplitWavFile(fileName, outputPath, CancellationToken.None);
                sw.Stop();
                Write(Environment.NewLine);
                WriteLine(
                    string.Format(
                        "Data bytes processed: {0} ({1} MB)", 
                        bytesTotal, Round((double)bytesTotal / (1024 * 1024), 1)));
                WriteLine(string.Format("Elapsed time: {0}", sw.Elapsed));
                Environment.Exit(0);
            }
            catch (Exception ex)
            {
                WriteLine(ex.Message);
                WriteLine(ex.StackTrace);
                Environment.Exit(-1);
            }
        }
    }
}

Get Wav Header

using System.IO;
using static System.Console;

string fileName = "test.wav";

using (var fs = new FileStream(fileName, FileMode.Open, FileAccess.Read))
{
    var h = WavFileInfo.ReadFileHeader(fs);
    Write(
        string.Format(
            "FileName:\t\t{0}\nFileSize:\t\t{1}\n{2}", 
            Path.GetFileName(fileName), fs.Length, h));
}

License

SimpleWavSplitter is licensed under the MIT license.