Is there a way to disable console text-output?
I get this output every time I run say() function
Playing WAVE '/tmp/tmplGOau7.wav' : Signed 16 bit Little Endian, Rate 22050 Hz, Mono
I want to disable that for easier debugging from console, when there is less stuff in the console it's easier to read. It would help if it didn't output anything else than what it's suppose to do: output sound from text that is given to it. Or at least have option for disabling it. If there is one I haven't found it or it's not mentioned in the docs or anywhere is it?
I think it can be made quieter by adding a --quiet to this line:
https://github.com/grigi/talkey/blob/master/talkey/base.py#L259
e.g. `cmd = ['aplay', '--quiet', str(filename)]
And you are right, this should probably only ever show if debug logging is turned on.
Is there any intention to fix this issue?
I think it can be made quieter by adding a
--quietto this line: https://github.com/grigi/talkey/blob/master/talkey/base.py#L259 e.g. `cmd = ['aplay', '--quiet', str(filename)] And you are right, this should probably only ever show if debug logging is turned on.
Doesn't work for systems where that is not manually edited.
Hacky way to fix this by globally defaulting the subprocess.Popen not to output to stdout/stderr:
from talkey import Talkey
import subprocess
from functools import partial
subprocess.Popen = partial( # type: ignore
subprocess.Popen,
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL)
tts = Talkey()
tts.say("Hello world")
Another hacky way with automatic "unmuting" after the end of the SubprocessSilencer -block:
from talkey import Talkey
from typing import Any
from functools import partial
import subprocess
class SubprocessSilencer:
def __enter__(self) -> None:
self.popen = subprocess.Popen
subprocess.Popen = partial( # type: ignore
subprocess.Popen,
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL)
def __exit__(self, *args: Any) -> None:
subprocess.Popen = self.popen # type: ignore
tts = Talkey()
with SubprocessSilencer():
tts.say("Hello world")