Skip to content
pubscout

dart_melty_soundfont

2.0.0, released a year ago by jamcorder.com

A SoundFont synthesizer (.sf2 player) written in pure Dart.

$ flutter pub add dart_melty_soundfont
Source repository

What it does

dart_melty_soundfont parses SoundFont (.sf2) files and MIDI sequences, synthesizing them into PCM waveforms in pure Dart. It supports wave synthesis, MIDI processing, effects like reverb and chorus, and has no package dependencies.

AI-written summary of version 2.0.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to play SoundFont (.sf2) files or MIDI files in a pure Dart or Flutter app.
  • You want an audio synthesizer with zero external package dependencies.
  • You need to generate PCM audio buffers manually to feed into an audio player or output device.

Skip it when

  • You are looking for a high-level audio player that plays MP3/WAV files directly out-of-the-box without manual PCM handling.
  • You need a complete battery-included audio playback solution with built-in device speaker routing (the library only generates waveforms).

Strengths

  • Written in pure Dart with no external dependencies.
  • Includes MIDI file sequencing, effects like reverb and chorus, and zero memory allocation during rendering.
  • Cross-platform compatibility across Android, iOS, Windows, macOS, and Linux.

Weaknesses

  • Does not audibly make sound on its own; requires an external library (like flutter_pcm_sound) to send generated PCM waveforms to device speakers.
  • Audio rendering needs to be run in isolates or using compute to prevent UI stutters.

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
0

No special native permissions or dependencies required. Just add the package and load your .sf2 assets.

import 'package:dart_melty_soundfont/dart_melty_soundfont.dart';
import 'package:flutter/services.dart' show rootBundle;

ByteData bytes = await rootBundle.load('assets/akai_steinway.sf2');
Synthesizer synth = Synthesizer.loadByteData(bytes);
synth.selectPreset(channel: 0, preset: 0);
synth.noteOn(channel: 0, key: 72, velocity: 120);
ArrayInt16 buf16 = ArrayInt16.zeros(numShorts: 44100);
synth.renderMonoInt16(buf16);

Alternatives

Packages that do the same job and could replace dart_melty_soundfont.