chipweinberger / dart_melty_soundfont

A port of Melty Synth by Nobuaki Tanaka (C#) to Dart
Other
35 stars 8 forks source link

How to play note at the time I want #22

Open baigua opened 9 months ago

baigua commented 9 months ago

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 commented 9 months ago

turn on multiple notes at the same time in the synth

chipweinberger commented 9 months ago

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 commented 9 months ago

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

playtime2

chipweinberger commented 9 months ago

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

or combine the buffers into one big one

baigua commented 9 months ago

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.