NokitaKaze.WAVParser 0.1.0

Install-Package NokitaKaze.WAVParser -Version 0.1.0
dotnet add package NokitaKaze.WAVParser --version 0.1.0
<PackageReference Include="NokitaKaze.WAVParser" Version="0.1.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add NokitaKaze.WAVParser --version 0.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: NokitaKaze.WAVParser, 0.1.0"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install NokitaKaze.WAVParser as a Cake Addin
#addin nuget:?package=NokitaKaze.WAVParser&version=0.1.0

// Install NokitaKaze.WAVParser as a Cake Tool
#tool nuget:?package=NokitaKaze.WAVParser&version=0.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

WAV Parser

NuGet version (NokitaKaze.WAVParser) Travis

Yet another parser for wave files. I just like to write my own code.

This library could read 8/16/24/32/64-bit audio with WAVE_FORMAT_PCM (pcm_u8, pcm_s16le, pcm_s32le, pcm_s24le, pcm_s32le, pcm_s64le) format and 32/64-float bit with WAVE_FORMAT_IEEE_FLOAT (pcm_f32le, pcm_f64le).

Main reason for this library to exist is to support other library.

Using

You could read any media file, but you need to convert it to WAV.

ffmpeg -i some-media-file.raw -sn -vn -c:a pcm_s16le temporary.wav

Read

var parser = new NokitaKaze.WAVParser.WAVParser("input.wav");
Console.WriteLine("Channels count:\t{0}", parser.ChannelCount);
Console.WriteLine("AudioFormat:   \t{0}", parser.AudioFormat);
Console.WriteLine("BlockAlign:    \t{0}", parser.BlockAlign);
Console.WriteLine("SampleRate:    \t{0}Hz", parser.SampleRate);
Console.WriteLine("BitsPerSample: \t{0}", parser.SamplesCount);
Console.WriteLine("Duration:      \t{0}", parser.Duration);

foreach (var channelSamples in reReader.Samples)
{
    foreach (var sample in channelSamples)
    {
        // Hint: All samples are doubles for double precision processing
        Console.Write("{0:F8}, ", sample);
    }
}
// method 2
Stream stream;
var parser = new NokitaKaze.WAVParser.WAVParser(stream);

// method 3
var rawRiffStream = System.IO.File.ReadAllBytes("input.wav");
var parser = new NokitaKaze.WAVParser.WAVParser(byteArray);

Write

// method #1
var byteArray = parser.GetDataAsRiff();

// method #2
parser.Save("output.wav");

// method #3
Stream randomStream = ...;
parser.Save(randomStream);

Create new

var rnd = new System.Random.Random();

var parser = new NokitaKaze.WAVParser.WAVParser();
parser.ChannelCount = 1;
parser.Samples = new List<List<double>>() {new List<double>()};
parser.BlockAlign = (ushort) (parser.ChannelCount * parser.BitsPerSample / 8);

for (int i = 0; i < 1000; i++)
{
    // random samples to stream
    parser.Samples[0].Add(rnd.NextDouble() * 2 - 1);
}

parser.Save(...);
  • .NETStandard 2.0

    • No dependencies.
  • .NETStandard 2.1

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.1.0 1,449 5/2/2020