I’ve read the sound documentation , and i wonder if i could stream music that i generate on the fly.
It seems difficult , because you can only play .wav and .ogg files.
May be generate a wav when level starts.
As i want a 3 or 4mn long music.
At 44100hz, during 4 minutes, on 16 bits samples (2 bytes), with mono output, it would need:
44100 * (4*60) * 2 / 2^20 = 20 mb (5mb/minutes)
seems doable, even on mobile devices (on PC, i could even allocate more memory for stereo rendering, which would give 10mb/mn).
But the idea of music generation was also to cut the music and play another pattern when certain events occurs. Of course i could generate some patterns, and switch from one to another with differents sound components (one per music pattern).
The sound component uses static sound resources (ogg or wav files). The only way to use those would be to have a preset of sounds and build patterns with them.
Alternatively you can build a native extension that plays sound. Check out these sound extensions: