Skip to content

Simple utility to render waveforms of audio files in various styles using System.Drawing

License

Notifications You must be signed in to change notification settings

justinswork/NAudio.WaveFormRenderer

 
 

Repository files navigation

NAudio.WaveFormRenderer

Simple utility to render waveforms of audio files to PNGs. Uses NAudio to extract the peaks and System.Drawing to render the images.

The project contains the WaveFormRendererLib library which performs peak calculation and waveform rendering, along with a simple test harness WinForms application to try it out with different settings. This can be used in any project that is able to take a dependency on NAudio and System.Drawing. It can be used in WinForms or WPF apps, or within ASP.NET applications to generate server side waveform images.

The waveform rendering algorithm is customizable:

  • Supports several peak calculation strategies (max, average, sampled, RMS, decibels)
  • Supports different colors or gradients for the top and bottom half
  • Supports different sizes for top and bottom half
  • Overall image size and background can be customized
  • Transparent backgrounds
  • Support for SoundCloud style bars
  • Several built-in rendering styles

Breaking changes

v2 switches from passing in a filename to passing in a NAudio WaveStream. This allows it to be used cross-platform without taking a dependency on AudioFileReader which is Windows only. On Windows, simply use AudioFileReader to create the WaveStream. On other platforms you can still use WaveFileReader, or Mp3FileReader using the NLayer frame decoder.

Test Harness Application

Test harness app makes it easy to experiment with the various rendering options and save the results as a PNG. Test Harness UI

Example Waveforms

Basic solid color waveform Basic solid color

Gradient vertical bars (old SoundCloud style) Gradient vertical bars

Blocks (SoundCloud style) Blocks

Orange Blocks

Transparent Backgrounds Transparent Background

Transparent Background

About

Simple utility to render waveforms of audio files in various styles using System.Drawing

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%