Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lichess-org/flutter-sound-effect
Flutter plugin to play short sounds with low latency
https://github.com/lichess-org/flutter-sound-effect
Last synced: about 2 months ago
JSON representation
Flutter plugin to play short sounds with low latency
- Host: GitHub
- URL: https://github.com/lichess-org/flutter-sound-effect
- Owner: lichess-org
- License: gpl-3.0
- Created: 2024-07-24T10:34:39.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-07-27T15:08:43.000Z (5 months ago)
- Last Synced: 2024-07-31T10:39:17.733Z (5 months ago)
- Language: Dart
- Size: 279 KB
- Stars: 0
- Watchers: 6
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# sound_effect
A Flutter plugin for playing sound effects with a simple API and the lowest
possible latency.## Getting Started
Initialize the plugin, before using any of the other methods:
```dart
import 'package:sound_effect/sound_effect.dart';void main() async {
final _soundEffect = SoundEffect();
await _soundEffect.initialize();
}
```Load a sound effect, using a unique identifier and the path to the sound file:
```dart
Future loadSound(String soundId) async {
await _soundEffect.load(soundId, 'assets/sound_effect.mp3');
}
```Play the sound effect:
```dart
Future playSound(String soundId) async {
await _soundEffect.play(soundId);
}
```You can also play the sound effect with a custom volume:
```dart
_soundEffect.play('effect', volume: 0.5);
```Release the loaded sounds when they are no longer needed:
```dart
_soundEffect.release();
```