mirror of
https://github.com/2noise/ChatTTS.git
synced 2026-08-30 17:05:27 +08:00
chore(format): run black on dev (#536)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
13e1e67786
commit
f1c6da98c1
@@ -97,7 +97,9 @@ async def generate_voice(params: ChatTTSParams):
|
||||
|
||||
# zip all of the audio files together
|
||||
buf = io.BytesIO()
|
||||
with zipfile.ZipFile(buf, "a", compression=zipfile.ZIP_DEFLATED, allowZip64=False) as f:
|
||||
with zipfile.ZipFile(
|
||||
buf, "a", compression=zipfile.ZIP_DEFLATED, allowZip64=False
|
||||
) as f:
|
||||
for idx, wav in enumerate(wavs):
|
||||
f.writestr(wav_arr_to_mp3_view(wav), f"{idx}.mp3")
|
||||
logger.info("Audio generation successful.")
|
||||
|
||||
@@ -3,12 +3,13 @@ import threading
|
||||
import time
|
||||
import random
|
||||
|
||||
import pyaudio # please install it manually
|
||||
import pyaudio # please install it manually
|
||||
import numpy as np
|
||||
import ChatTTS
|
||||
|
||||
from tools.audio import batch_unsafe_float_to_int16
|
||||
|
||||
|
||||
# 流式声音处理器
|
||||
class AudioStreamer:
|
||||
def __init__(self):
|
||||
|
||||
@@ -13,6 +13,7 @@ def unsafe_float_to_int16(audio: np.ndarray) -> np.ndarray:
|
||||
audio16 = audio.astype(np.int16)
|
||||
return audio16
|
||||
|
||||
|
||||
@jit
|
||||
def batch_unsafe_float_to_int16(audios: list[np.ndarray]) -> list[np.ndarray]:
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user