Coder Social home page Coder Social logo

Comments (6)

ukasz123 avatar ukasz123 commented on July 29, 2024 1

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.

ukasz123 avatar ukasz123 commented on July 29, 2024

Can you provide me a smallest example that shows the issue?

from soundpool.

novas1r1 avatar novas1r1 commented on July 29, 2024

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.

versolollo avatar versolollo commented on July 29, 2024

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.

novas1r1 avatar novas1r1 commented on July 29, 2024

@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.

knight0zh avatar knight0zh commented on July 29, 2024

@novas1r1 I encountered the same problem as you, did you finally solve it?

from soundpool.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.