diff --git a/scripts/uploadMp3_5.php b/scripts/uploadMp3_5.php index 6bdd035..fbc802d 100755 --- a/scripts/uploadMp3_5.php +++ b/scripts/uploadMp3_5.php @@ -18,19 +18,48 @@ $file = UPLOAD_DIR . $_POST['name'] . '_'.$_POST['type'] .'.mp3'; $success = file_put_contents($file, $data); $wavfile = $file.'.wav'; $distortedfile = $wavfile.'.wav'; +$distortedfile1 = $wavfile.'.1.wav'; +$distortedfile2 = $wavfile.'.2.wav'; +$distortedfile3 = $wavfile.'.3.wav'; -// $command = escapeshellcmd('/home/lain/virtualenvs/radioactive/bin/python3 python-audio-effects/echo.py '.$file); -// $output = shell_exec($command); -// echo $output; -// if type=echo "string"; shell_exec('ffmpeg -i "'.$file.'" "'.$wavfile.'"'); +if ($_POST['type']=='echo'){ + // echo + $command = '/home/lain/virtualenvs/radioactive/bin/python3 python-audio-effects/echo.py "'.$wavfile.'" "'.$distortedfile.'"'; + $output=shell_exec($command); + print $output; +} +elseif ($_POST['type']=='lowpass'){ + // lowpass + $command = '/home/lain/virtualenvs/radioactive/bin/python3 python-audio-effects/lowpass.py "'.$wavfile.'" "'.$distortedfile.'"'; + $output=shell_exec($command); + print $output; +} -$command = '/home/lain/virtualenvs/radioactive/bin/python3 python-audio-effects/echo.py "'.$wavfile.'" "'.$distortedfile.'"'; +elseif ($_POST['type']=='lowpitch'){ + +// lowpitch +$command = '/home/lain/virtualenvs/radioactive/bin/python3 python-audio-effects/lowpitch.py "'.$wavfile.'" "'.$distortedfile.'"'; $output=shell_exec($command); print $output; +} + +else { + // collective + $command = '/home/lain/virtualenvs/radioactive/bin/python3 python-audio-effects/echo.py "'.$wavfile.'" "'.$distortedfile1.'"'; + $output=shell_exec($command); + print $output; + $command = '/home/lain/virtualenvs/radioactive/bin/python3 python-audio-effects/lowpass.py "'.$wavfile.'" "'.$distortedfile2.'"'; + $output=shell_exec($command); + print $output; + $command = '/home/lain/virtualenvs/radioactive/bin/python3 python-audio-effects/lowpitch.py "'.$wavfile.'" "'.$distortedfile3.'"'; + $output=shell_exec($command); + print $output; + shell_exec('ffmpeg -i "'.$wavfile.'" -i "'.$distortedfile1.'" -i "'.$distortedfile2.'" -i "'.$distortedfile3.'" -filter_complex amix=inputs=4:duration=longest "'.$distortedfile.'"'); +} # make a database of recordings