8000 Is there a way to disable console text-output? · Issue #3 · grigi/talkey · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Jul 27, 2026. It is now read-only.
This repository was archived by the owner on Jul 27, 2026. It is now read-only.

Is there a way to disable console text-output? #3

Open

Description

@Crare

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?

Activity

  1. grigi commented on Jan 30, 2017

    @grigi
    Owner

    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.

  2. deepy commented on May 19, 2017

    @deepy

    Is there any intention to fix this issue?

  3. b10011 commented on Jul 12, 2019

    @b10011

    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.

    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")
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0