Skip to content

Commit

Permalink
update LibVoice.php
Browse files Browse the repository at this point in the history
  • Loading branch information
Amitminer committed Jun 26, 2023
1 parent e5dde38 commit 3404dc8
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions lib/LibVoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,27 @@
use system;

class LibVoice{

/**
* Convert the given message to speech using Termux TTS.
*
* @param mixed $msg The message to be spoken.
*
* @return void
*/
public static function say(mixed $msg): void{
$msg = strtolower("termux-tts-speak {$msg}");
$voicemsg = system($msg);
// var_dump($voicemsg);
$msg = strtolower("termux-tts-speak {$msg}");
$voicemsg = system($msg);
// Uncomment the line below to debug the voice message output.
// var_dump($voicemsg);
}

/**
* Listen for speech input using Termux speech-to-text.
*
* @return string|null The captured speech input, or null if no input is detected.
*/
public static function listen(){
$listen = system("termux-speech-to-text");
return $listen;
}
}
}

0 comments on commit 3404dc8

Please sign in to comment.