Sample Projects

Learn from example implementations using flutter_soloud

Overview

The flutter_soloud package includes several example projects demonstrating various features. These examples can be found in the example folder of the plugin.

Basic Examples

Getting Started

  • lib/main.dart - Basic setup and usage example
  • lib/output_device/output_device.dart - How to list and select output devices
  • lib/audio_context/audio_context.dart - How to use audio session

Audio Visualization

  • lib/audio_data/audio_data.dart - Real-time audio waveform and FFT visualization using AudioVisualizationData stream
  • lib/wave_data/wave_data.dart - Read and display audio samples from files

Advanced Features

Audio Context

  • lib/audio_context/audio_context.dart - How to use audio_session and audio_service

Audio Generation

  • lib/waveform/waveform.dart - Generate and control waveforms in real-time
  • lib/metronome/metronome.dart - Create a precise metronome. Shows how to use playClocked()

Streaming Examples

Released and Preserved buffer Modes

  • lib/buffer_stream/generate.dart - Generate PCM audio in an Isolate
  • lib/buffer_stream/websocket.dart - Stream PCM and Opus audio via WebSocket
  • lib/buffer_stream/web_radio.dart - Receive streamed audio from online web radio
  • lib/buffer_stream/simple_noise_stream.dart - For testing and undestanding audio streaming and buffering

Pull buffer streaming

  • lib/pull_buffer/file_stream.dart - It demonstrates the callback-driven pull model and the custom seek/progress bar.
  • lib/pull_buffer/http_range_stream.dart - Streams an audio file from a remote server using HTTP Range requests and feeds it to an [AudioSource].

Mixing Busses

  • lib/mixing_bus/mixing_bus.dart - How to use a mixing bus

Mixer Output Capture

  • lib/mixer_output_capture/mixer_output_capture.dart - Capture the master mixer output as a stream of audio data.

Audio Effects

ExampleDescription
lib/filters/compressor.dartDynamic range compression
lib/filters/limiter.dartPeak limiting and volume control
lib/filters/pitchshift.dartReal-time pitch shifting
lib/filters/parametric_eq.dartParametric equalizer

Running the Examples

  1. Clone the repository:
bash
git clone https://github.com/alnitak/flutter_soloud.git
  1. Navigate to the example directory:
bash
cd flutter_soloud/example
  1. Install dependencies:
bash
flutter pub get
  1. Run a specific example:
bash
flutter run -t lib/main.dart
# Or any other example file
flutter run -t lib/waveform/waveform.dart