Skip to content

Commit

Permalink
pydub playback sounds like garbage. Use playsound.
Browse files Browse the repository at this point in the history
  • Loading branch information
wsanchez committed Nov 9, 2023
1 parent 8c01bea commit 0bf2276
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
3 changes: 3 additions & 0 deletions mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ ignore_missing_imports = True
[mypy-hypothesis.*]
ignore_missing_imports = True

[mypy-playsound]
ignore_missing_imports = True

[mypy-setuptools]
ignore_missing_imports = True

Expand Down
2 changes: 2 additions & 0 deletions requirements/requirements-direct.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ arrow==1.3.0
attrs==22.2.0
click==8.1.3
openai-whisper==20231106
playsound==1.3.0
pydub==0.25.1
pyobjc==10.0
rich==13.6.0
simpleaudio==1.0.4
textual==0.41.0
Expand Down
6 changes: 2 additions & 4 deletions src/transmissions/tui/_transmissionsscreen.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from typing import ClassVar, cast

from pydub import AudioSegment
from pydub.playback import play
from playsound import playsound
from textual import on
from textual.app import ComposeResult
from textual.screen import Screen
Expand Down Expand Up @@ -157,7 +156,6 @@ async def action_play(self) -> None:
self.log(f"No such audio file: {path}")
return

sound = AudioSegment.from_file(str(path), format="wav")
play(sound)
playsound(str(path))
except Exception as e:
self.log(f"Play failed: {e}")

0 comments on commit 0bf2276

Please sign in to comment.