Skip to content

Commit

Permalink
bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
MCterra10 committed Apr 20, 2021
1 parent e9334b7 commit 996da87
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions api/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@
// Path to the youtube-dl executable. Used for song downloads. Set to false to disable functionality.
$youtubedlPath = "C:\\youtube-dl";

// Path to the DECTalk say.exe file, used for outputting TTS audio. Set to false to disable functionality.
$dectalkPath = "C:\\dectalk\\say.exe";
// Path to the DECTalk *FOLDER*, containing say.exe, used for outputting TTS audio. Set to false to disable functionality.
$dectalkPath = "C:\\dectalk";

// Directory to output downloaded audio to. Should be a webserver directory.
$audioOutput = "C:/inetpub/wwwroot-rsc/youtube-audio";
Expand Down
8 changes: 4 additions & 4 deletions api/tts/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@

if(!file_exists("{$audioOutput}/{$hash}.mp3")) {
// Generate the audio
$command = $dectalkPath . " -w " . escapeshellarg("{$audioOutput}/{$hash}.wav") . " " . escapeshellarg($urlDecoded);
chdir($dectalkPath);
$command = "say.exe -w " . escapeshellarg("{$audioOutput}/{$hash}.wav") . " " . escapeshellarg($urlDecoded);
shell_exec($command);
// Now convert to mp3 with ffmpeg
$command = "ffmpeg -guess_layout_max 0 -i " . escapeshellarg("{$audioOutput}/{$hash}.wav") . " -acodec libmp3lame -ac 2 -b:a 128k " . escapeshellarg("{$audioOutput}/{$hash}.wav");
$command = "ffmpeg -y -guess_layout_max 0 -i " . escapeshellarg("{$audioOutput}/{$hash}.wav") . " -acodec libmp3lame -ac 2 -b:a 128k " . escapeshellarg("{$audioOutput}/{$hash}.mp3");
shell_exec($command);
// Delete the original wav file
$commend = "del " . escapeshellarg("{$audioOutput}/{$hash}.wav");
shell_exec($command);
unlink("{$audioOutput}/{$hash}.wav");
}

// Now all we have to do is send back the URL.
Expand Down

0 comments on commit 996da87

Please sign in to comment.