godot-sfxr icon indicating copy to clipboard operation
godot-sfxr copied to clipboard

Setting a long decay (extending the sample) creates sounds slowly.

Open tavurth opened this issue 2 years ago • 3 comments

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:

  1. Create a SfxrStreamPlayer
  2. Set decay_time to 1.0
  3. 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.

  1. Create a SfxrStreamPlayer
  2. Set decay_time to 0.2
  3. Set pitch_scale (Default AudioStreamPlayer) to 0.2

You will get a much lower pitched sound that generates very quickly.

tavurth avatar Feb 02 '22 22:02 tavurth

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.

tomeyro avatar Feb 08 '22 03:02 tomeyro

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.

tomeyro avatar Feb 08 '22 03:02 tomeyro

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.

tavurth avatar Feb 08 '22 09:02 tavurth