cfxr icon indicating copy to clipboard operation
cfxr copied to clipboard

Missing the Mutate functionality of sfxr

Open leberwurstsaft opened this issue 13 years ago • 6 comments

It would be really nice to have the mutate button in cfxr.

leberwurstsaft avatar Apr 09 '11 12:04 leberwurstsaft

It's almost the exact same as Random… Or is there some subtle difference I'm missing?

nevyn avatar Apr 09 '11 14:04 nevyn

Yes, the difference is simply that Random just randomizes everything and choses from all the "categories" of sounds as well. Whereas Mutate alters the current settings just slightly, kind of as in genetic algorithms, only without the fitness function, of course. So if you start off with some Coin-Pickup sound, and hit mutate repeatedly you'll get sounds that slowly deviate away from the original, but still all within reasonable range.

Thats useful for when you have a nice starting point and need some more sounds that are similar and kind of form a family of sounds. Of course, one may get there by using the sliders after a good starting point is found, but I come from a non-insider position and don't have the patience to try and understand all of the sliders effects. Thats why I came to love the mutate function, which is also in sfxr for the iPhone :)

leberwurstsaft avatar Apr 09 '11 14:04 leberwurstsaft

I just wanted to add my voice to this desire. I would also like to see the mutate functionality from sfxr on cfxr.

TrevorSayre avatar Aug 23 '11 19:08 TrevorSayre

I'd also love to see this.

If anybody can show me code for Mutate in another port I will have a go at adding it myself.

gingerbeardman avatar Jul 23 '12 00:07 gingerbeardman

The source for sfxr is here: http://code.google.com/p/sfxr/

TrevorSayre avatar Jul 23 '12 21:07 TrevorSayre

The mutate code is pretty straightforward. It simply adds anywhere between -0.05 and 0.05 to the parameters, with an extra 0.5 probability of not touching a parameter.

if(Button(5, 382, false, "MUTATE", 30))
        {
                if(rnd(1)) p_base_freq+=frnd(0.1f)-0.05f;
//              if(rnd(1)) p_freq_limit+=frnd(0.1f)-0.05f;
                if(rnd(1)) p_freq_ramp+=frnd(0.1f)-0.05f;
                if(rnd(1)) p_freq_dramp+=frnd(0.1f)-0.05f;
                if(rnd(1)) p_duty+=frnd(0.1f)-0.05f;
                if(rnd(1)) p_duty_ramp+=frnd(0.1f)-0.05f;
                if(rnd(1)) p_vib_strength+=frnd(0.1f)-0.05f;
                if(rnd(1)) p_vib_speed+=frnd(0.1f)-0.05f;
                if(rnd(1)) p_vib_delay+=frnd(0.1f)-0.05f;
                if(rnd(1)) p_env_attack+=frnd(0.1f)-0.05f;
                if(rnd(1)) p_env_sustain+=frnd(0.1f)-0.05f;
                if(rnd(1)) p_env_decay+=frnd(0.1f)-0.05f;
                if(rnd(1)) p_env_punch+=frnd(0.1f)-0.05f;
                if(rnd(1)) p_lpf_resonance+=frnd(0.1f)-0.05f;
                if(rnd(1)) p_lpf_freq+=frnd(0.1f)-0.05f;
                if(rnd(1)) p_lpf_ramp+=frnd(0.1f)-0.05f;
                if(rnd(1)) p_hpf_freq+=frnd(0.1f)-0.05f;
                if(rnd(1)) p_hpf_ramp+=frnd(0.1f)-0.05f;
                if(rnd(1)) p_pha_offset+=frnd(0.1f)-0.05f;
                if(rnd(1)) p_pha_ramp+=frnd(0.1f)-0.05f;
                if(rnd(1)) p_repeat_speed+=frnd(0.1f)-0.05f;
                if(rnd(1)) p_arp_speed+=frnd(0.1f)-0.05f;
                if(rnd(1)) p_arp_mod+=frnd(0.1f)-0.05f;
                do_play=true;
        }

leberwurstsaft avatar Jul 23 '12 22:07 leberwurstsaft