From b31c87e3eef8f6361a9cd23fa31caeda2578b7fa Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 23 Oct 2024 08:43:50 +0530 Subject: [PATCH] ... --- src/calibre/gui2/tts/piper.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/calibre/gui2/tts/piper.py b/src/calibre/gui2/tts/piper.py index 4bc0491547..6834b6faa4 100644 --- a/src/calibre/gui2/tts/piper.py +++ b/src/calibre/gui2/tts/piper.py @@ -32,7 +32,7 @@ from qt.core import ( sip, ) -from calibre.constants import cache_dir, is_debugging, ismacos, iswindows, piper_cmdline +from calibre.constants import cache_dir, is_debugging, iswindows, piper_cmdline from calibre.gui2 import error_dialog from calibre.gui2.tts.types import TTS_EMBEDED_CONFIG, EngineSpecificSettings, Quality, TTSBackend, Voice, widget_parent from calibre.spell.break_iterator import PARAGRAPH_SEPARATOR, split_into_sentences_for_tts @@ -421,9 +421,11 @@ class Piper(TTSBackend): self._audio_sink.setVolume(s.volume) # On Windows, the buffer is zero causing data to be discarded. # Ensure we have a nice large buffer on all platforms. - # However, on Linux changing the buffer size causes audio to not - # play on some systems. See https://www.mobileread.com/forums/showthread.php?t=363881 - if not iswindows and not ismacos: + # However, on Linux and macOS changing the buffer size causes audio to not + # play on some systems or play with a large delay. + # See https://www.mobileread.com/forums/showthread.php?t=363881 + # and https://www.mobileread.com/forums/showthread.php?t=364225 + if iswindows: self._audio_sink.setBufferSize(2 * 1024 * 1024) self._audio_sink.stateChanged.connect(self._utterances_being_spoken.audio_state_changed) self._process.start()