File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -77,10 +77,20 @@ def audio_player(
7777 console : Console , speed_factor : float = 1.0
7878) -> Iterator [AudioOut | None ]:
7979 # Perform late imports
80- # Those can fail if a linux machine doesn't have portaudio or libsamplerate
81- # installed
8280 import samplerate
83- import sounddevice
81+
82+ # Especially for sounddevice, as it doesn't package the portaudio library in its manylinux wheels.
83+ try :
84+ import sounddevice
85+ except OSError :
86+ raise SystemExit (
87+ """\
88+ Audio output is not available because the PortAudio library could not be found.
89+ Please make sure you have portaudio installed.
90+ For example, on Debian-based distributions, you can run:
91+ $ sudo apt install libportaudio2
92+ Otherswise, you can use the --no-audio option to run without audio support."""
93+ )
8494
8595 input_rate = console .FPS * console .TICKS_IN_FRAME
8696 resampler = samplerate .Resampler ("linear" , channels = 2 )
You can’t perform that action at this time.
0 commit comments