A powerful and extensible cross-platform .NET audio engine. provides comprehensive audio processing capabilities including playback, recording, effects, analysis, and visualization, built with a modular and high-performance architecture.
A Powerful and Extensible .NET Audio Engine for Enterprise Applications
Introduction
SoundFlow is a robust and versatile .NET audio engine designed for seamless cross-platform audio processing. It provides a comprehensive set of features for audio playback, recording, processing, analysis, and visualization, all within a well-structured and extensible framework.
Key Features:
Cross-Platform by Design: Runs seamlessly on Windows, macOS, Linux, Android, and iOS or any other .NET compatible platform.
Modular Component Architecture: Build custom audio pipelines by connecting sources, modifiers, mixers, and analyzers.
Extensibility: Easily add custom audio components, effects, and visualizers to tailor the engine to your specific needs.
High Performance: Optimized for real-time audio processing with SIMD support and efficient memory management.
Playback: Play audio from various sources, including files, streams, and in-memory assets.
Recording: Capture audio input and save it to different encoding formats.
Mixing: Combine multiple audio streams with precise control over volume and panning.
Effects: Apply a wide range of audio effects, including reverb, chorus, delay, equalization, and more.
Analysis: Extract valuable information from audio data, such as RMS level, peak level, frequency spectrum, and voice activity.
Visualization: Create engaging visual representations of audio waveforms, spectrums, and level meters.
Surround Sound: Supports advanced surround sound configurations with customizable speaker positions, delays, and panning methods.
HLS Streaming Support: Integrate internet radio and online audio via HTTP Live Streaming.
Backend Agnostic: Supports the MiniAudio backend out of the box, with the ability to add others.
Getting Started
Installation
NuGet Package Manager:
Install-Package SoundFlow
.NET CLI:
dotnet add package SoundFlow
Basic Usage Example
This example demonstrates how to play an audio file using SoundFlow:
using SoundFlow.Abstracts;
using SoundFlow.Backends.MiniAudio;
using SoundFlow.Components;
using SoundFlow.Providers;
using SoundFlow.Enums;
// Initialize the audio engine with the MiniAudio backend
using var audioEngine = new MiniAudioEngine(44100, Capability.Playback);
// Create a SoundPlayer and load an audio file
var player = new SoundPlayer(new StreamDataProvider(File.OpenRead("path/to/your/audiofile.wav")));
// Add the player to the master mixer
Mixer.Master.AddComponent(player);
// Start playback
player.Play();
// Keep the console application running until playback finishes
Console.WriteLine("Playing audio... Press any key to stop.");
Console.ReadKey();
// Stop playback and remove the player from the mixer
player.Stop();
Mixer.Master.RemoveComponent(player);
Core Concepts
SoundFlow is built upon a few key concepts:
Audio Engine (AudioEngine): The central component that manages audio device initialization, data processing, and the audio graph.
Sound Components (SoundComponent): Modular units that process or generate audio, forming a directed graph through input and output connections.
Mixer (Mixer): Combines multiple audio streams into a single output.
Sound Modifiers (SoundModifier): Apply audio effects like reverb, chorus, delay, and equalization.
Audio Playback & Recording: Components for playing and capturing audio, including surround sound support.
Audio Providers: Standardized way to read audio data from various sources (files, streams, memory).
Audio Analysis & Visualization: Tools for extracting information from audio and creating visual representations.
The Documentation provides a wide range of tutorials and examples to help you get started:
Playback: Playing audio files and streams, controlling playback.
Recording: Recording audio, using voice activity detection.
Effects: Applying various audio effects.
Analysis: Getting RMS level, analyzing frequency spectrum.
Visualization: Creating level meters, waveform displays, and spectrum analyzers.
(Note: You can also find example code in the Samples folder of the repository.)
Contributing
We welcome contributions to SoundFlow! If you'd like to contribute, please follow these guidelines:
Report Issues: If you find a bug or have a feature request, please open an issue on the GitHub repository.
Ask Questions and Seek Help: If you have questions about using SoundFlow or need help with a specific issue, please open a discussion on the GitHub repository to keep the issues section clean and focused.
Submit Pull Requests:
Fork the repository.
Create a new branch for your changes.
Make your changes, following the project's coding style and conventions.
Write unit tests for your code.
Ensure all tests pass.
Submit a pull request to the master branch.
Coding Style:
Follow the .NET coding conventions.
Use clear and descriptive variable and method names.
Write concise and well-documented code.
Use XML documentation comments for public members.
Acknowledgments
This project uses the miniaudio library for as default backend for audio I/O.