-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
477be3d
commit ff533ad
Showing
5 changed files
with
154 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# audio_alert_test.py | ||
# (for testing audio alerts) | ||
|
||
import pyttsx3 | ||
import logging | ||
|
||
def test_tts(): | ||
# Initialize logging | ||
logging.basicConfig(level=logging.INFO) | ||
logger = logging.getLogger("TTS_Test") | ||
|
||
try: | ||
# Initialize TTS engine | ||
engine = pyttsx3.init() | ||
logger.info("Initialized pyttsx3 engine.") | ||
|
||
# List available voices | ||
voices = engine.getProperty('voices') | ||
logger.info("Available voices:") | ||
for i, voice in enumerate(voices): | ||
logger.info(f"{i}: {voice.name} - {voice.id}") | ||
|
||
# Optional: Set a specific voice (uncomment if needed) | ||
# engine.setProperty('voice', voices[0].id) | ||
|
||
# Set speech rate | ||
rate = engine.getProperty('rate') | ||
logger.info(f"Current speech rate: {rate}") | ||
engine.setProperty('rate', rate - 25) # Decrease speech rate | ||
|
||
# Set volume (0.0 to 1.0) | ||
volume = engine.getProperty('volume') | ||
logger.info(f"Current volume: {volume}") | ||
engine.setProperty('volume', 1.0) # Set to max volume | ||
|
||
# Speak the test message | ||
test_message = "Human detected!" | ||
logger.info(f"Attempting to speak: '{test_message}'") | ||
engine.say(test_message) | ||
engine.runAndWait() | ||
logger.info("TTS announcement completed successfully.") | ||
|
||
except Exception as e: | ||
logger.error(f"An error occurred during TTS testing: {e}") | ||
|
||
if __name__ == "__main__": | ||
test_tts() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
# version.py | ||
|
||
version_number = "0.1610 (Nov 17th 2024)" | ||
version_number = "0.1611 (Nov 23h 2024)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters