DataJuggler.AudioTools
1.0.2
See the version list below for details.
dotnet add package DataJuggler.AudioTools --version 1.0.2
NuGet\Install-Package DataJuggler.AudioTools -Version 1.0.2
<PackageReference Include="DataJuggler.AudioTools" Version="1.0.2" />
paket add DataJuggler.AudioTools --version 1.0.2
#r "nuget: DataJuggler.AudioTools, 1.0.2"
// Install DataJuggler.AudioTools as a Cake Addin #addin nuget:?package=DataJuggler.AudioTools&version=1.0.2 // Install DataJuggler.AudioTools as a Cake Tool #tool nuget:?package=DataJuggler.AudioTools&version=1.0.2
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
News
11.5.2024: NuGet package PixelDatabase was updated, which fixed a bug with the Background image not being created.
Product | Versions 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. |
-
net8.0
- DataJuggler.PixelDatabase (>= 8.3.6)
- NAudio (>= 2.2.1)
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.
This is the first release of this package.