Lofty.Audio
1.0.0
dotnet add package Lofty.Audio --version 1.0.0
NuGet\Install-Package Lofty.Audio -Version 1.0.0
<PackageReference Include="Lofty.Audio" Version="1.0.0" />
<PackageVersion Include="Lofty.Audio" Version="1.0.0" />
<PackageReference Include="Lofty.Audio" />
paket add Lofty.Audio --version 1.0.0
#r "nuget: Lofty.Audio, 1.0.0"
#:package Lofty.Audio@1.0.0
#addin nuget:?package=Lofty.Audio&version=1.0.0
#tool nuget:?package=Lofty.Audio&version=1.0.0
Lofty Audio
Lofty Audio is a .NET MAUI audio library built around a modular synthesis, effects, sampling, playback, and DAW foundation. It provides a graph-based audio engine with audio/control ports, generators, filters, effects, instruments, monitoring taps, WAV/MIDI utilities, and platform playback/recording adapters.
The library targets .NET 10 MAUI platforms and uses NAudio.Core interfaces for live audio provider/player interoperability.
Features
- Modular audio graph with
IModule,ModuleBase,ModularGraph, audio ports, control ports, and deterministic process ordering. - Block renderer through
AudioRenderer, with float rendering and PCM16 conversion helpers. - Built-in generators including oscillators, wavetable oscillator, FM synths, LFOs, ADSR envelope, noise, harmonic pad, organ, bassline, and Harmix-style synth modules.
- Built-in filters and utilities including gain, pan, stereo width, mixers, biquad filters, MIDI-to-frequency conversion, control math, and slew limiting.
- Built-in effects including delay, reverb, chorus, flanger, phaser, compressor, limiter, distortion, bitcrush, EQ, cabinet simulation, vocoder, tremolo, vibrato, auto-pan, auto-wah, octaver, vinyl simulation, and comb filtering.
- Sampling support with
SampleData, WAV sample loading, sampler modules, sample player modules, PCM synth modules, and beatbox/drum modules. - Instrument patch factories for sub synth, PCM synth, bassline, FM, pad, organ, vocoder, and beatbox patches.
- Live playback bridge through
ModularWaveProviderandModularAudioPlaybackSession. - Monitoring modules for peak/RMS levels, FFT analysis, and combined audio monitoring.
- DAW foundations for projects, sessions, tracks, clips, markers, regions, transport, tempo maps, looping, selection, editing commands, undo/redo, MIDI clips, step patterns, mixing, export, files, and JSON state.
- WAV reading/writing and audio export helpers.
- Standard MIDI file export for MIDI clips.
- Platform audio adapters for Windows, Android, and iOS.
Target Platforms
The project currently targets:
net10.0-androidnet10.0-ioson non-Linux hostsnet10.0-maccatalyston non-Linux hostsnet10.0-windows10.0.19041.0on Windows hosts
Minimum platform versions are configured in Lofty.Audio.csproj:
- Android 21.0
- iOS 15.0
- Mac Catalyst 15.0
- Windows 10.0.17763.0
Requirements
- .NET 10 SDK
- .NET MAUI workloads for the platforms you want to build
NAudio.Core, pulled in by the project package references
Core package references:
Microsoft.Maui.ControlsNAudio.Core
Building
From the repository root:
dotnet workload restore
dotnet build .\Lofty.Audio.slnx -c Release
During day-to-day development on Windows, you can target the Windows framework directly:
dotnet build .\Lofty.Audio\Lofty.Audio.csproj -c Release -f net10.0-windows10.0.19041.0
To create a NuGet package:
dotnet pack .\Lofty.Audio\Lofty.Audio.csproj -c Release
Basic Offline Rendering
The core engine renders blocks of interleaved float samples. A small synth graph can be rendered directly to a WAV file:
using Lofty.Audio.Core;
using Lofty.Audio.Daw.IO;
using Lofty.Audio.Filters;
using Lofty.Audio.Generators;
using Lofty.Audio.Output;
var graph = new ModularGraph();
var oscillator = graph.Add(new OscillatorModule(waveform: WaveformType.Saw));
var gain = graph.Add(new GainModule());
var output = graph.Add(new AudioOutput(gain.Output));
oscillator.FrequencyHz.DefaultValue = 110f;
oscillator.Amplitude.DefaultValue = 0.30f;
gain.Gain.DefaultValue = 0.8f;
oscillator.Output.ConnectTo(gain.Input);
var renderer = new AudioRenderer(graph, output, sampleRate: 44_100, channels: 2);
var samples = renderer.RenderToArray(frameCount: 44_100 * 4);
WavWriter.Write("renders/saw.wav", samples, channels: 2, sampleRate: 44_100);
Live Playback
ModularWaveProvider wraps an AudioRenderer as an NAudio.Wave.IWaveProvider. Pair it with an IWavePlayer implementation for the current platform.
using Lofty.Audio.Playback;
using NAudio.Wave;
var provider = ModularWaveProviderFactory.Create(graph, output);
using var player = new WaveOutEvent();
using var session = new ModularAudioPlaybackSession(player, provider);
session.Play();
Platform player status:
- Windows:
NAudio.Wave.WaveOutEventandWaveInEventimplementations are included underPlatforms/Windows. - Android:
AndroidAudioPlayerandAndroidAudioRecorderuseAudioTrackandAudioRecord. - iOS:
Lofty.Audio.Platforms.iOS.IosAudioPlayerusesOutputAudioQueue. - Mac Catalyst:
MacAudioPlayercurrently contains placeholder members that throwNotImplementedException.
Instrument Patches
Use ModularInstrumentFactory when you want a ready-made graph instead of wiring individual modules by hand:
using Lofty.Audio.Instruments;
using Lofty.Audio.Daw.Export;
var patch = ModularInstrumentFactory.CreateSubSynth();
patch.MidiNote.Value = 48f;
patch.Gate.Value = 1f;
AudioExporter.ExportGraphToWav(
"renders/sub-synth.wav",
patch.Graph,
patch.Output,
frameCount: 44_100 * 2);
Available factory patches include:
SubSynthPcmSynthBassLineFmSynthPadSynthOrganVocoderBeatBox
The Examples folder also includes SimplePatchFactory, LibraryPatches, and HarmixRackFactory for larger demonstration racks.
Sampling And WAV Files
Load WAV files as sample data:
using Lofty.Audio.Sampling;
var sample = WavSampleLoader.Load("samples/kick.wav", rootMidiNote: 60);
var sampler = new SamplerModule(sample);
WavReader and WavWriter support project-level WAV IO:
using Lofty.Audio.Daw.IO;
var audio = WavReader.Read("input.wav");
WavWriter.Write("copy.wav", audio.InterleavedSamples, audio.Channels, audio.SampleRate);
Supported WAV encodings include PCM 8/16/24/32-bit and 32-bit float.
DAW Foundation
The Lofty.Audio.Daw namespace provides a higher-level project/session model on top of the modular engine:
- Arrangement:
DawProject,DawSession,DawTrack,DawClip, markers, regions, assets, and time ranges. - Timing:
TempoMap,Transport, musical positions, loop ranges, and frame/tick conversion. - MIDI:
MidiClip, note/control/program events, recorder, quantizer, and SMF export. - Editing: add/remove/move/trim/split commands plus
UndoManager. - Mixing: channel strips, sends, buses, and master rendering helpers.
- Playback:
DawSessionEngine,DawPlaybackGraph, and track playback bindings. - Files/state: project folders, media import/export paths, and JSON save/load.
Example:
using Lofty.Audio.Daw.Midi;
using Lofty.Audio.Daw.Playback;
using Lofty.Audio.Instruments;
var engine = new DawSessionEngine(sampleRate: 44_100, channels: 2);
var patch = ModularInstrumentFactory.CreateSubSynth();
var midi = new MidiClip(lengthTicks: 960 * 4);
midi.Add(new MidiNoteEvent(tick: 0, durationTicks: 960, channel: 0, note: 48, velocity: 110));
engine.AddInstrumentTrack("Sub", patch, midi);
engine.Play();
var block = engine.RenderBlock(512);
engine.ExportAudio("renders/session.wav", frameCount: 44_100 * 4);
DawPlaybackGraph exposes emitted MIDI events through LastMidiEvents; hosts can use those events to drive module controls or their own instrument playback logic.
Module Catalog
ModuleCatalog.All describes the built-in module set by category. This is useful for browsers, preset pickers, or module palette UI.
Main categories:
- Generator
- Control
- Filter
- Effect
- Sampling
- Instrument
- Monitoring
- Output
DawFeatureCatalog.All provides a similar feature list for DAW-facing UI and documentation.
Project Layout
Lofty.Audio/
Core/ Modular graph, ports, buffers, renderer, math, module catalog
Generators/ Oscillators, synth voices, LFOs, envelopes, control generators
Filters/ Gain, mixer, biquad filter
Effects/ Delay, reverb, chorus, EQ, dynamics, modulation, vocoder, etc.
Sampling/ Sample data, WAV sample loader, samplers, PCM synth, beatbox
Instruments/ Ready-made modular instrument patches
Monitoring/ Level meters, FFT analyzer, monitor taps
Output/ AudioOutput module
Playback/ NAudio-compatible wave provider and playback session
Platforms/ Windows, Android, iOS, and Mac Catalyst platform audio adapters
Daw/ Arrangement, timing, MIDI, editing, sequencing, mixing, export, IO, files, state
Examples/ Patch and Harmix rack examples
Notes
- This folder does not currently contain a
.gitrepository. - This repository currently contains the library project only. There is no test project yet.
AllowUnsafeBlocksis enabled for platform audio interop paths.binandobjoutputs are present in the project folder.- No license file is currently included in the repository.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0-android36.0 is compatible. net10.0-ios26.0 is compatible. net10.0-maccatalyst26.0 is compatible. net10.0-windows10.0.19041 is compatible. |
-
net10.0-android36.0
- Microsoft.Maui.Controls (>= 10.0.20)
- NAudio.Core (>= 2.3.0)
-
net10.0-ios26.0
- Microsoft.Maui.Controls (>= 10.0.20)
- NAudio.Core (>= 2.3.0)
-
net10.0-maccatalyst26.0
- Microsoft.Maui.Controls (>= 10.0.20)
- NAudio.Core (>= 2.3.0)
-
net10.0-windows10.0.19041
- Microsoft.Maui.Controls (>= 10.0.20)
- NAudio.Core (>= 2.3.0)
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 |
|---|---|---|
| 1.0.0 | 63 | 5/31/2026 |