Skip to content
4 changes: 2 additions & 2 deletions backend/app/audio.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ def _detect_leading_silence(sound: AudioSegment) -> int:
def trim_silence(path: str) -> AudioSegment:
sound = AudioSegment.from_wav(path + ".wav")
start_trim = Audio._detect_leading_silence(sound)
end_trim = Audio._detect_leading_silence(sound.reverse())
# end_trim = Audio._detect_leading_silence(sound.reverse())
duration = len(sound)
trimmed_sound = sound[start_trim:duration - end_trim]
trimmed_sound = sound[int(start_trim/2):duration]
return trimmed_sound

@staticmethod
Expand Down
2 changes: 1 addition & 1 deletion backend/app/file_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def save_audio(path: str, audio: bytes):
with open(webm_file_name, 'wb+') as f:
f.write(audio)
subprocess.call(
'ffmpeg -i {} -ab 160k -ac 2 -ar 44100 -vn {}.wav -y'.format(
'ffmpeg -i {} -ab 160k -ac 1 -ar 44100 -vn {}.wav -y'.format(
webm_file_name, path
),
shell=True
Expand Down
Loading