DataJuggler.AudioTools 1.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package DataJuggler.AudioTools --version 1.0.1                
NuGet\Install-Package DataJuggler.AudioTools -Version 1.0.1                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DataJuggler.AudioTools" Version="1.0.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add DataJuggler.AudioTools --version 1.0.1                
#r "nuget: DataJuggler.AudioTools, 1.0.1"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install DataJuggler.AudioTools as a Cake Addin
#addin nuget:?package=DataJuggler.AudioTools&version=1.0.1

// Install DataJuggler.AudioTools as a Cake Tool
#tool nuget:?package=DataJuggler.AudioTools&version=1.0.1                

DataJuggler.AudioTools makes it simple to draw a Wave file image in C#. NAudio is used to read audio files and DataJuggler.PixelDatabase is used to create the wave images.

Simple WInForms example:

Canvas is an 800 x 200 PictureBox with BackgroundImageLayout set to Stretch.

The image created will 200 height and width will be 200 for every second of audio. Longer audio files do take longer.

using DataJuggler.AudioTools;

// Path to your audioFile
string path = "c:\Temp\Audio.mp3"

// Analyze the file and create the Wave
AudioAnalysis audioAnalysis = WaveVisualizer.VisualizeWave(path, Color.LightSteelBlue, Color.White, Color.White, Color.PaleVioletRed);

// if there were not any errors
if (!audioAnalysis.HasException)
{
    // update the Canvas
    Canvas.BackgroundImage = audioAnalysis.Bitmap;
    Canvas.Refresh();
}
else
{
    // Show a message box for this test
    MessageBox.Show(audioAnalysis.Exception.ToString(), "Error");
}

Future Updates

I am building an audio player now for Blazor and I wanted this to display the wav pattern. I may build a WinForms player also if anyone has any interested in this let me know.

Technical Mumbo Jumbo

The way this project works is it reads all the RawSignalInfo data from the audio file, then the RawSignalInfo is condensed into SignalInfo. Chuncks of 1,000 RawSignalInfo are combined into 1 SignalInfo object, and the values for MaxSignalInfo and MinSignalInfo are set from the Max and Min of the 1,000. This means for a 4 second audio file at 48000 Sample Rate, you should get about 196,000 RawSignalInfo which condenses down to about 196 SignalInfo, which is much easier to work with.

I compared the results against Audacity and it seems to match.

Please create an issue if you find any problems or if you have any suggestions or somments.

Thanks

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on DataJuggler.AudioTools:

Package Downloads
DataJuggler.BlazorAudio

A component to make it easy to play audio or audio on the web.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.3 301 11/6/2024
1.0.2 93 11/5/2024
1.0.1 95 11/5/2024
1.0.0 90 11/5/2024

This is the first release of this package.