I am running a simple script to record audio in pydub and play it back. It is playing it back, but after the playback, it is throwing a segementation fault at me, and i have no idea why. import sounddevice as sd import numpy as np from pydub import AudioSegment from pydub.playback import play import wavio def record_audio(duration=5, sample_rate=44100): print("Recording...") audio = sd.rec(int(duration * sample_rate), samplerate=sample_rate, channels=2, dtype='int16') sd.wait() # Save the recorded audio as a WAV file wavio.write("recorded.wav", audio, sample_rate, sampwidth=2) print("Recording saved as recorded.wav") def play_audio(file_path): print("Playing back...") audio = AudioSegment.from_wav(file_path) play(audio) print("Playback finished") # Record and playback record_audio() play_audio("recorded.wav") Here is the code python audio.py Recording... Recording saved as recorded.wav Playing back... [1] 25425 segmentation fault (core dumped) python audio.py Here is the output. Any solutions? I am on Ubuntu 24.04 LTS OS: Ubuntu 24.04.1 LTS x86_64 Host: Vostro 3590 Kernel: 6.8.0-1012-oem Uptime: 1 hour, 43 mins Packages: 3095 (dpkg), 61 (brew), 6 (flatpak), 40 (snap) Shell: zsh 5.9 Resolution: 1920x1080 DE: GNOME 46.0 WM: Mutter WM Theme: Adwaita Theme: Yaru-blue-dark [GTK2/3] Icons: Yaru-blue [GTK2/3] Terminal: tilix CPU: Intel i5-10210U (8) @ 4.200GHz GPU: Intel CometLake-U GT2 [UHD Graphics] GPU: AMD ATI Radeon R5 M230 / R7 M260DX / Radeon 52 Memory: 5288MiB / 7662MiB I tried other modules, but simpleaudio is also segfaulting, and pygame seems like avoiding the problem for me. I honestly did not try anything because I have no idea whats failing. ChatGPT is useless in this problem for me. Continue reading...