Fix : pyaudio.paInt16 missing in AudioRecorder class init

This commit is contained in:
martin legrand 2025-03-21 19:34:57 +01:00
parent b40322dc2c
commit b1ad643364

View File

@ -6,6 +6,7 @@ import torch
from transformers import AutoModelForSpeechSeq2Seq, AutoProcessor, pipeline
import time
import librosa
import pyaudio
audio_queue = queue.Queue()
done = False
@ -14,7 +15,7 @@ class AudioRecorder:
"""
AudioRecorder is a class that records audio from the microphone and adds it to the audio queue.
"""
def __init__(self, format: int, channels: int = 1, rate: int = 4096, chunk: int = 8192, record_seconds: int = 5, verbose: bool = False):
def __init__(self, format: int = pyaudio.paInt16, channels: int = 1, rate: int = 4096, chunk: int = 8192, record_seconds: int = 5, verbose: bool = False):
import pyaudio
self.format = format
self.channels = channels