diff --git a/config.json b/config.json index 64681d3..d2dc8b3 100644 --- a/config.json +++ b/config.json @@ -1,5 +1,6 @@ { - "mode": "quote", + "mode": "words", + "mode_modifier": 30, "wpm": 50, "language": "english" } diff --git a/dictate.py b/dictate.py index ad997fb..2896fed 100644 --- a/dictate.py +++ b/dictate.py @@ -59,3 +59,13 @@ def quote(config): engine.runAndWait() time.sleep(1/(config['wpm']/60)) +def file(config): + engine = pyttsx3.init() + with open(f'{config['mode_modifier']}', 'r') as file: + lines = file.readlines() + for line in lines: + for word in line.split(' '): + print(word,end=' ') + engine.say(word) + engine.runAndWait() + time.sleep(1/(config['wpm']/60)) diff --git a/main.py b/main.py index b34caff..4fb9463 100644 --- a/main.py +++ b/main.py @@ -23,3 +23,5 @@ if config['mode'] == 'timed': dictate.timed(config) if config['mode'] == 'quote': dictate.quote(config) +if config['mode'] == 'file': + dictate.file(config)