mirror of
https://github.com/HiMeditator/auto-caption.git
synced 2026-02-15 04:14:46 +08:00
feat(renderer): 添加界面主题颜色功能,添加复制最新字幕选项(#13)
- 新增界面主题颜色功能,支持自定义主题颜色 - 使用 antd 滑块替代原生 input 元素 - 添加复制字幕记录功能,可选择复制最近的字幕记录
This commit is contained in:
@@ -55,7 +55,7 @@ def resample_chunk_mono(chunk: bytes, channels: int, orig_sr: int, target_sr: in
|
||||
return chunk_mono_r.tobytes()
|
||||
|
||||
|
||||
def resample_chunk_mono_np(chunk: bytes, channels: int, orig_sr: int, target_sr: int, mode="sinc_best") -> np.ndarray:
|
||||
def resample_chunk_mono_np(chunk: bytes, channels: int, orig_sr: int, target_sr: int, mode="sinc_best", dtype=np.float32) -> np.ndarray:
|
||||
"""
|
||||
将当前多通道音频数据块转换成单通道音频数据块,然后进行重采样,返回 Numpy 数组
|
||||
|
||||
@@ -65,6 +65,7 @@ def resample_chunk_mono_np(chunk: bytes, channels: int, orig_sr: int, target_sr:
|
||||
orig_sr: 原始采样率
|
||||
target_sr: 目标采样率
|
||||
mode: 重采样模式,可选:'sinc_best' | 'sinc_medium' | 'sinc_fastest' | 'zero_order_hold' | 'linear'
|
||||
dtype: 返回 Numpy 数组的数据类型
|
||||
|
||||
Return:
|
||||
单通道音频数据块
|
||||
@@ -82,7 +83,7 @@ def resample_chunk_mono_np(chunk: bytes, channels: int, orig_sr: int, target_sr:
|
||||
|
||||
ratio = target_sr / orig_sr
|
||||
chunk_mono_r = samplerate.resample(chunk_mono, ratio, converter_type=mode)
|
||||
chunk_mono_r = np.round(chunk_mono_r).astype(np.int16)
|
||||
chunk_mono_r = chunk_mono_r.astype(dtype)
|
||||
return chunk_mono_r
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user