python离线实时语音识别会议记录录音并转写文本代码

代码语言:python

所属分类:其他

代码描述:python离线实时语音识别会议记录录音并转写文本代码

代码标签: python 离线 实时 语音 识别 会议 记录 录音 转写 文本 代码

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

#!/usr/local/python3/bin/python3
# -*- coding: utf-8 -*
import tkinter as tk
from tkinter import ttk, scrolledtext, messagebox
import threading
import queue
import sounddevice as sd
from scipy.io.wavfile import write
import numpy as np
from faster_whisper import WhisperModel
import os
import datetime
import torch
import noisereduce as nr # 【新增】导入降噪库

# --- 全局配置 ---
LANGUAGES = { "简体中文": "zh", "自动检测": "auto", "English": "en", "日本語": "ja", "한국어": "ko", "Français": "fr", "Deutsch": "de", "Español": "es" }
SAMPLE_RATE = 16000 # 【新增】将采样率定义为全局常量

class AdvancedRecorderApp:
    def __init__(self, master):
        self.master = master
        self.is_recording = False
        self.model = None
        self.current_model_settings = {}
        
        self.setup_ui()
        self.check_device()

    def setup_ui(self):
        self.master.title("高级会议录音神器 V2.1 (降噪增强版)")
        self.master.geometry("800x650") # 稍微增加高度以容纳新控件

        # --- 设置区域 ---
        settings_frame = ttk.LabelFrame(self.master, text="设置")
        settings_frame.pack(padx=10, pady=10, fill="x")

        # 模型选择
        ttk.Label(settings_frame, text="模型:").grid(row=0, column=0, padx=5, pady=5, sticky="w")
        self.model_var = tk.StringVar(value="small").........完整代码请登录后点击上方下载按钮下载查看

网友评论0