diff --git a/pizzactrl/hal_serial.py b/pizzactrl/hal_serial.py index f2ee658..7480f2c 100644 --- a/pizzactrl/hal_serial.py +++ b/pizzactrl/hal_serial.py @@ -4,7 +4,7 @@ from time import sleep from enum import Enum from typing import Any, List -# from scipy.io.wavfile import write as writewav +from scipy.io.wavfile import write as writewav import pydub import sounddevice as sd @@ -215,10 +215,10 @@ def record_sound(hal: PizzaHAL, filename: Any, duration: int, else: sd.wait() # Wait until recording is finished # TODO test - myrecording = np.int16(myrecording) - song = pydub.AudioSegment(myrecording.tobytes(), frame_rate=AUDIO_REC_SR, sample_width=2, channels=2) - song.export(str(filename), format="mp3", bitrate="320k") - # ALTERNATIVE writewav(str(filename), AUDIO_REC_SR, myrecording) + # myrecording = np.int16(myrecording) + # song = pydub.AudioSegment(myrecording.tobytes(), frame_rate=AUDIO_REC_SR, sample_width=2, channels=2) + # song.export(str(filename), format="mp3", bitrate="44.1k") + writewav(str(filename), AUDIO_REC_SR, myrecording) if cache: hal.soundcache[str(filename)] = (myrecording, AUDIO_REC_SR)