Skip to content

Commit

Permalink
Saving wav as temp file
Browse files Browse the repository at this point in the history
  • Loading branch information
dougollerenshaw committed Oct 8, 2024
1 parent b3b4554 commit ac871b7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions codeaide/ui/chat_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@
)
from codeaide.utils.logging_config import get_logger
from codeaide.ui.traceback_dialog import TracebackDialog
import os
import time
import sounddevice as sd
import numpy as np
from scipy.io import wavfile
import whisper
import tempfile


class AudioRecorder(QThread):
Expand Down Expand Up @@ -646,7 +646,8 @@ def start_recording(self):

self.logger.info(f"Final HTML after setting: {self.input_text.toHtml()}")

filename = os.path.expanduser("~/recorded_audio.wav")
with tempfile.NamedTemporaryFile(suffix=".wav", delete=False) as temp_file:
filename = temp_file.name
self.recorder = AudioRecorder(filename, self.logger)
self.recorder.finished.connect(self.on_recording_finished)
self.recorder.start()
Expand Down

0 comments on commit ac871b7

Please sign in to comment.