Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to play note at the time I want #22

Open
baigua opened this issue Dec 27, 2023 · 5 comments
Open

How to play note at the time I want #22

baigua opened this issue Dec 27, 2023 · 5 comments

Comments

@baigua
Copy link

baigua commented Dec 27, 2023

I found FlutterPcmSound is single threaded.

so what should I do, if I want my note not play one after another or play at the same time, but like this:

playtime

@chipweinberger
Copy link
Owner

turn on multiple notes at the same time in the synth

@chipweinberger
Copy link
Owner

timing is controlled by rendering more samples

  1. turn on note
  2. render 0.2 seconds
  3. turn on another note
  4. render 0.2 seconds
  5. et

@baigua
Copy link
Author

baigua commented Dec 27, 2023

Thanks a lot, I don't know if my understanding is correct?

playtime2

@chipweinberger
Copy link
Owner

you need to feed every buffer, not just the last one

or combine the buffers into one big one

@baigua
Copy link
Author

baigua commented Dec 27, 2023

sure, the feed part should be like:

Future.delayed(Duration(milliseconds: gapTime), () {
FlutterPcmSound.feed(PcmArrayInt16(bytes: buffer.bytes));
}

just make sure, if I don't noteOff any notes, they will keep active in the following render.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants