flutter_resonance_audio 0.0.1+1
flutter_resonance_audio: ^0.0.1+1 copied to clipboard

Resonance Audio plugin for Flutter.

flutter_resonance_audio #

Resonance Audio plugin for Flutter.

Currently for Android only. Please help me for supporting iOS.

Usage #

To use this plugin, add flutter_resonance_audio as a dependency in your pubspec.yaml file.

Example #

import 'package:flutter/material.dart';
import 'package:flutter_resonance_audio/flutter_resonance_audio.dart';

final audioEngine = FlutterResonanceAudio();

void main() async {
  await audioEngine.init();

    home: Scaffold(
      body: Center(
      child: RaisedButton(
        onPressed: _playSound,
        child: Text('Play sound'),

_playSound() async {
  int sourceId = await audioEngine.createSoundObject('assets/sound.ogg');


This library mirrors GvrAudioEngine API (except init).

Return type (Future)MethodDescription
intcreateSoundObject(String filename)Returns a new sound object handle.
intcreateSoundfield(String filename)Returns a new Ambisonic soundfield handle.
intcreateStereoSound(String filename)Returns a new non-spatialized stereo sound.
voidenableRoom(boolean enable)Turns on/off the room reverberation effects.
voidenableSpeakerStereoMode(boolean enable)Enables the stereo speaker mode.
booleanisSoundPlaying(int sourceId)Checks if a sound is playing.
booleanisSourceIdValid(int sourceId)Checks if a
voidpause()Pauses the GVR Audio system.
voidpauseSound(int sourceId)Pauses the playback of a sound.
voidplaySound(int sourceId, boolean loopingEnabled)Starts the playback of a sound.
booleanpreloadSoundFile(String filename)Preloads a sound file.
voidresume()Resumes the GVR Audio system.
voidresumeSound(int sourceId)Resumes the playback of a sound.
voidsetHeadPosition(float x, float y, float z)Sets the head position.
voidsetHeadRotation(float x, float y, float z, float w)Sets the head rotation.
voidsetRoomProperties(float sizeX, float sizeY, float sizeZ, int wallMaterial, int ceilingMaterial, int floorMaterial)Sets the room properties describing the dimensions and surface materials of a given room.
voidsetRoomReverbAdjustments(float gain, float timeAdjust, float brightnessAdjust)Adjusts the properties of the current reverb, allowing changes to the reverb's gain, duration and low/high frequency balance.
voidsetSoundObjectDistanceRolloffModel(int soundObjectId, int rolloffModel, float minDistance, float maxDistance)Sets the given sound object source's distance attenuation method with minimum and maximum distances.
voidsetSoundObjectPosition(int soundObjectId, float x, float y, float z)Repositions an existing sound object.
voidsetSoundVolume(int sourceId, float volume)Changes the volume of an existing sound.
voidsetSoundfieldRotation(int soundfieldId, float x, float y, float z, float w)Sets the rotation of an existing Ambisonic soundfield.
voidstopSound(int sourceId)Stops the playback of a sound and destroys the corresponding Sound Object or Soundfield.
voidunloadSoundFile(String filename)Unloads a sound file from the sample cache.
voidupdate()The update method must be called from the main thread at a regular rate.
pub points

Resonance Audio plugin for Flutter.



API reference




Apache 2.0 (LICENSE)




Packages that depend on flutter_resonance_audio