protected function getSoxEffectChain($numEffects = 2)
    {
        $effectsList = array('bend', 'chorus', 'overdrive', 'pitch', 'reverb', 'tempo', 'tremolo');
        $effects     = array_rand($effectsList, $numEffects);
        $outEffects  = array();

        if (!is_array($effects)) $effects = array($effects);

        foreach($effects as $effect) {
            $effect = $effectsList[$effect];

            switch($effect)
            {
                case 'bend':
                    $delay = mt_rand(0, 15) / 100.0;
                    $cents = mt_rand(-120, 120);
                    $dur   = mt_rand(75, 400) / 100.0;
                    $outEffects[] = "$effect $delay,$cents,$dur";
                    break;

                case 'chorus':
                    $gainIn  = mt_rand(75, 90) / 100.0;
                    $gainOut = mt_rand(70, 95) / 100.0;
                    $chorStr = "$effect $gainIn $gainOut";

                    for ($i = 0; $i < mt_rand(2, 3); ++$i) {
                        $delay = mt_rand(20, 100);
                        $decay = mt_rand(10, 100) / 100.0;
                        $speed = mt_rand(20, 50) / 100.0;
                        $depth = mt_rand(150, 250) / 100.0;

                        $chorStr .= " $delay $decay $speed $depth -s";
                    }

                    $outEffects[] = $chorStr;
                    break;

                case 'overdrive':
                    $gain = mt_rand(5, 25);
                    $color = mt_rand(20, 70);
                    $outEffects[] = "$effect $gain $color";
                    break;

                case 'pitch':
                    $cents = mt_rand(-300, 300);
                    $outEffects[] = "$effect $cents";
                    break;

                case 'reverb':
                    $reverberance = mt_rand(20, 80);
                    $damping      = mt_rand(10, 80);
                    $scale        = mt_rand(85, 100);
                    $depth        = mt_rand(90, 100);
                    $predelay     = mt_rand(0, 5);
                    $outEffects[] = "$effect $reverberance $damping $scale $depth $predelay";
                    break;

                case 'tempo':
                    $factor = mt_rand(65, 135) / 100.0;
                    $outEffects[] = "$effect -s $factor";
                    break;

                case 'tremolo':
                    $hz    = mt_rand(10, 30);
                    $depth = mt_rand(40, 85);
                    $outEffects[] = "$effect $hz $depth";
                    break;
            }
        }

        return implode(' ', $outEffects);
    }
protected function getSoxEffectChain($numEffects = 2)
    {
        $effectsList = array('bend', 'chorus', 'overdrive', 'pitch', 'reverb', 'tempo', 'tremolo');
        $effects     = array_rand($effectsList, $numEffects);
        $outEffects  = array();

        if (!is_array($effects)) $effects = array($effects);

        foreach($effects as $effect) {
            $effect = $effectsList[$effect];

            switch($effect)
            {
                case 'bend':
                    $delay = mt_rand(0, 15) / 100.0;
                    $cents = mt_rand(-120, 120);
                    $dur   = mt_rand(75, 400) / 100.0;
                    $outEffects[] = "$effect $delay,$cents,$dur";
                    break;

                case 'chorus':
                    $gainIn  = mt_rand(75, 90) / 100.0;
                    $gainOut = mt_rand(70, 95) / 100.0;
                    $chorStr = "$effect $gainIn $gainOut";

                    for ($i = 0; $i < mt_rand(2, 3); ++$i) {
                        $delay = mt_rand(20, 100);
                        $decay = mt_rand(10, 100) / 100.0;
                        $speed = mt_rand(20, 50) / 100.0;
                        $depth = mt_rand(150, 250) / 100.0;

                        $chorStr .= " $delay $decay $speed $depth -s";
                    }

                    $outEffects[] = $chorStr;
                    break;

                case 'overdrive':
                    $gain = mt_rand(5, 25);
                    $color = mt_rand(20, 70);
                    $outEffects[] = "$effect $gain $color";
                    break;

                case 'pitch':
                    $cents = mt_rand(-300, 300);
                    $outEffects[] = "$effect $cents";
                    break;

                case 'reverb':
                    $reverberance = mt_rand(20, 80);
                    $damping      = mt_rand(10, 80);
                    $scale        = mt_rand(85, 100);
                    $depth        = mt_rand(90, 100);
                    $predelay     = mt_rand(0, 5);
                    $outEffects[] = "$effect $reverberance $damping $scale $depth $predelay";
                    break;

                case 'tempo':
                    $factor = mt_rand(65, 135) / 100.0;
                    $outEffects[] = "$effect -s $factor";
                    break;

                case 'tremolo':
                    $hz    = mt_rand(10, 30);
                    $depth = mt_rand(40, 85);
                    $outEffects[] = "$effect $hz $depth";
                    break;
            }
        }

        return implode(' ', $outEffects);
    }
protected function getSoxEffectChain ( $ numEffects = 2 ) { $ effectsList = array ( 'bend' , 'chorus' , 'overdrive' , 'pitch' , 'reverb' , 'tempo' , 'tremolo' ) ; $ effects = array_rand ( $ effectsList , $ numEffects ) ; $ outEffects = array ( ) ; if ( ! is_array ( $ effects ) ) $ effects = array ( $ effects ) ; foreach ( $ effects as $ effect ) { $ effect = $ effectsList [ $ effect ] ; switch ( $ effect ) { case 'bend' : $ delay = mt_rand ( 0 , 15 ) / 100.0 ; $ cents = mt_rand ( - 120 , 120 ) ; $ dur = mt_rand ( 75 , 400 ) / 100.0 ; $ outEffects [ ] = "$effect $delay,$cents,$dur" ; break ; case 'chorus' : $ gainIn = mt_rand ( 75 , 90 ) / 100.0 ; $ gainOut = mt_rand ( 70 , 95 ) / 100.0 ; $ chorStr = "$effect $gainIn $gainOut" ; for ( $ i = 0 ; $ i < mt_rand ( 2 , 3 ) ; ++ $ i ) { $ delay = mt_rand ( 20 , 100 ) ; $ decay = mt_rand ( 10 , 100 ) / 100.0 ; $ speed = mt_rand ( 20 , 50 ) / 100.0 ; $ depth = mt_rand ( 150 , 250 ) / 100.0 ; $ chorStr .= " $delay $decay $speed $depth -s" ; } $ outEffects [ ] = $ chorStr ; break ; case 'overdrive' : $ gain = mt_rand ( 5 , 25 ) ; $ color = mt_rand ( 20 , 70 ) ; $ outEffects [ ] = "$effect $gain $color" ; break ; case 'pitch' : $ cents = mt_rand ( - 300 , 300 ) ; $ outEffects [ ] = "$effect $cents" ; break ; case 'reverb' : $ reverberance = mt_rand ( 20 , 80 ) ; $ damping = mt_rand ( 10 , 80 ) ; $ scale = mt_rand ( 85 , 100 ) ; $ depth = mt_rand ( 90 , 100 ) ; $ predelay = mt_rand ( 0 , 5 ) ; $ outEffects [ ] = "$effect $reverberance $damping $scale $depth $predelay" ; break ; case 'tempo' : $ factor = mt_rand ( 65 , 135 ) / 100.0 ; $ outEffects [ ] = "$effect -s $factor" ; break ; case 'tremolo' : $ hz = mt_rand ( 10 , 30 ) ; $ depth = mt_rand ( 40 , 85 ) ; $ outEffects [ ] = "$effect $hz $depth" ; break ; } } return implode ( ' ' , $ outEffects ) ; }
Get a random effect or chain of effects to apply to a segment of the
audio file.

These effects should increase the randomness of the audio for
a particular letter/number by modulating the signal.  The SoX effects
used are *bend*, *chorus*, *overdrive*, *pitch*, *reverb*, *tempo*, and
*tremolo*.

For each effect selected, random parameters are supplied to the effect.

@param int $numEffects  How many effects to chain together
@return string  A string of valid SoX effects and their respective options.
Get a random effect or chain of effects to apply to a segment of the audio file .