godot-sfxr
godot-sfxr copied to clipboard
Setting a long decay (extending the sample) creates sounds slowly.
Perhaps the module could perform some automatic pitch & frequency modulation, as Godot can quite easily slow down a sample to play it longer.
To reproduce:
- Create a
SfxrStreamPlayer
- Set
decay_time
to1.0
- Click
play
The sound on my machine takes quite a while to generate.
However if I raise the frequency of the generated sound, and then use a much shorter delay, I can use the godot built in pitch_scale
to slow the sound down to get what I want without any delay.
- Create a
SfxrStreamPlayer
- Set
decay_time
to0.2
- Set
pitch_scale
(DefaultAudioStreamPlayer
) to0.2
You will get a much lower pitched sound that generates very quickly.
Hi @tavurth
I know that longer sounds can take some time to generate in some computers, but I can't do much about that as GDScript can get slow.
On the latest push I changed some things and optimized a bit, so they might be quicker to generate. Also they get stored and can be reused without regenerating or buffering, so that can help as well.
You can use the default pitch scale in Odoo, or custom audio buses, to further alter the generated sound, but that is outside of the scope of this tool and I don't think there would be a problem using them. I'm not sure what you mean with that part.
Oh I also wanted to mention that for the speed part I even re-wrote everything in GDNative C++, but then the delivery/install/support of the plugin gets really complicated and I wanted the tool to be remain simple in that regard.
New update looks great!
Yep I'm glad this is GDscript as it keeps things simple, maybe a C# port would work well since Godot natively supports it for crossplatform delivery.
My PR was more about how we could abuse the pitch_scale
to reduce the size of the generated sample.
If we always set the pitch_scale
to 0.1
then the sample is much much longer than it would be otherwise.
However the frequency is altered to be very low.