faust_min 0.3.0
faust_min: ^0.3.0 copied to clipboard
High-fidelity physical modeling synthesis engine powered by Faust. Features 50+ dynamic instruments, polyphonic support, and an advanced Universal Music Language (UML) multi-notation sequencer.
faust_min #
A high-fidelity physical modeling synthesis plugin and sequencing engine for Flutter, powered by Faust.
faust_min is not just an audio player; it is a full-fledged, real-time computational acoustics engine. Instead of relying on static, lifeless samples, faust_min mathematically simulates the physical properties of instruments (string tension, resonance, air pressure, tube length) to generate deeply expressive and highly realistic audio directly on the device.
๐ Key Features #
๐ธ 50+ Physically Modeled Instruments #
The engine ships with an extensive, highly optimized library of over 50 real-time physical models, covering a vast array of global instruments:
- Western: Electric/Acoustic Guitars, Pianos, Saxophones, Bass, Flutes, Drum Kits.
- Indian Classical & Folk: Sitar, Sarod, Santoor, Bansuri, Tanpura, Tumbi, Tabla, Dhol, Dholak.
- Cinematic Chinese Nature: Guzheng, Erhu, Dagu, Wind, Thunder, Chougong.
- Electronic & Ambient: Tibetan Singing Bowls, Rainmakers, Synths, Vocal Formant Synthesizers.
๐น Advanced Polyphony & Multithreading #
- Dynamic Voice Allocation: Built-in polyphonic support allows multiple notes to ring out simultaneously without cutting each other off.
- Persistent Thread Pool: Driven by a highly performant
FaustMixerthread pool that renders heavy DSP algorithms concurrently across multiple CPU cores, avoiding UI thread blocks completely. - Sample-Accurate Timing: Perfect for high-density, multi-instrument sequencing.
๐ผ The Universal Music Language (UML) Sequencer #
faust_min includes a deeply integrated, zero-latency Sequence Orchestrator capable of parsing plain-text text files into complex musical arrangements. The sequencer intelligently adapts to different cultural notations:
- Western Notation: Standard
C4,D#5,Ebformatting. - Indian Solfรจge (Sargam): Fully parses
Sa,Re,Ga,Ma,Pa,Dha,Niusing complex Shruti frequency ratios. - Percussion Bols/Strokes: Unpitched parsing of specific strokes like
Dha,Ge,Dhinfor Tabla orKik,Snr,Hatfor drum kits.
๐ Getting Started #
Installation #
Add faust_min to your pubspec.yaml:
dependencies:
faust_min: ^0.2.0
Basic Instrument Usage #
Generate high-fidelity audio on the fly:
import 'package:faust_min/faust_min.dart';
// Create a new Flute instance (Instrument ID 10)
final flute = FaustInstrument(10, DSPExecutionType.StaticCompiled, 48000);
// Play a note (Frequency, Velocity)
flute.noteOn(440.0, 0.8);
// Apply real-time physical parameter modulations
flute.setParameter("breath_pressure", 0.9);
flute.setParameter("vibrato_depth", 0.05);
// Let it ring, then release
flute.noteOff();
Advanced Multi-Instrument Sequencing #
Orchestrate a massive arrangement using the UML Sequencer:
final orchestrator = SequenceOrchestrator(sampleRate: 48000);
// Define a Tumbi sequence using Indian notation and parameter overrides
String tumbiUML = '''
grid: 4
bpm: 120
instrument: tumbi
notation: Indian
basefreq: 659.25
vibrato_depth: 0.08
vibrato_rate: 7.0
5Sa . . 5Re . 5Ga . . 5Re . . 5Sa . . .
''';
// Define a Dhol sequence using Percussion strokes
String dholUML = '''
grid: 4
bpm: 120
instrument: dhol
Dha . . Na Na . . Tin Na . . Dha Dha . . Na
''';
// Load and play flawlessly synchronized
orchestrator.addSequence("Tumbi", tumbiUML);
orchestrator.addSequence("Dhol", dholUML);
orchestrator.play();
๐ Architecture & Stability #
Legacy C++ audio libraries often suffer from thread-safety issues, SIGSEGV crashes, and timing drift when used in a modern, multithreaded environment like Flutter's Dart Isolates.
faust_min solves this. The underlying DSP code is generated by Faust (Functional Audio Stream), which outputs completely stateless, re-entrant, memory-safe C++ arrays that are fully decoupled from the UI. This ensures industrial-grade stability and zero latency for professional audio applications.
๐ License #
This project is licensed under the MIT License.