Comments (6)
I've build a minimal sample of what I think you are trying to build and it seems that some sounds are not played because on iOS the concurrent maxStreams
streams has been reached on higher tempos. The immediate solution is to set the maxStreams
option to 2 or more.
_pool = Soundpool.fromOptions(
options: SoundpoolOptions(maxStreams: 2),
);
Let me know if it solves your problem.
from soundpool.
Can you provide me a smallest example that shows the issue?
from soundpool.
Hi @ukasz123,
I'm using this issue since I'm having the same problem which is not solved yet. I built a metronome as well and it is supposed to be an opensource flutter package very soon. I uploaded it here: https://github.com/novas1r1/flutter_metronome
My issues are the following:
I'm using the Timer.periodic to play two different sounds. It is lagging way more on a real device than on the android emulator, which is super weird. Since it's a metronome it has to be as accurate as possible and it starts lagging already at a low bpm amount. I needed to modify the Timer.periodic, since it is not meant to have a callback exactly after one interval, but in the timespan between one and another interval. In the documentation it says: "The exact timing depends on the underlying timer implementation. No more than n callbacks will be made in duration * n time, but the time between two consecutive callbacks can be shorter and longer than duration." (https://api.dart.dev/stable/2.17.3/dart-async/Timer/Timer.periodic.html)
I added an example which you can directly run and test to have a live demo of what I mean. Also if you check the debug console, this log is very often happening:
"D/AudioTrack(22283): createTrack_l(8): AUDIO_OUTPUT_FLAG_FAST denied by server; frameCount 0 -> 402"
I tried increasing the maxStreams, but it didn't change anything. It doesn't matter if it's a debug or a release build. You can see the live version of the current implementation in my app (links to the stores are here: drumbitious.com, sorry, don't want to advertise, just provide an example of the real implementation).
It would be so awesome if you have any hint for me on what I could improve or if soundpool might not be the right choice for me.
Thanks in advance <3!!!
from soundpool.
I am working on a metronome as well, increasing to 2 streams wasn't enough, but with 10 it works without lagging! I am developing for MacOS. Thanks for the tip!
from soundpool.
@versolollo just because out of curiosity: if you run your metronome on a phone - is it also not lagging? Also how much bpm are working fine?
from soundpool.
@novas1r1 I encountered the same problem as you, did you finally solve it?
from soundpool.
Related Issues (20)
- Catch when the sound is completed. HOT 1
- Question about `load` HOT 2
- Soundpool Audio Not Heard When Running on Mobile Device's Chrome Web Browser
- Admob interstitial ads are silent after they are displayed.
- Package Upgrade issue HOT 3
- Could not find method namesapce() for arguments [pl.ukaszapps.soundpool] on extension 'android' of type com.android.build.gradle.LibraryExtension.
- stop() not working with loadAndPlayUri and loadAndPlayUint8List HOT 2
- setVolume resets to default 1.0 when maxStreams > 1
- Namespace not specified. Specify a namespace in the module's build file HOT 3
- Soundpool Plugin Causing Crash on Flutter iOS App HOT 3
- soundpool_windux is incompatible with soundpool_web due to http version dependency HOT 1
- soundpool.play returned streamId==0 HOT 4
- Windux: setVolume throws UnimplementedError although it has been implemented in Rust.
- Initial sound playback defaults to volume 1.0 regardless of set value HOT 1
- Feature Request: Pitch Adjustment for Soundpool HOT 1
- iOS - .play() works only the first time HOT 2
- Raster Jank HOT 1
- Playing sound stops background music on Android HOT 2
- 'Soundpool.new' is deprecated and shouldn't be used. Use fromOptions instead.
- 16 Warning Message when Building Signed APK
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from soundpool.