bugfix: multi-processing trial gabage. looping instanciate voice changer..

This commit is contained in:
wataru 2023-02-21 05:53:15 +09:00
parent 1278094ccd
commit 9a1a9245c8
2 changed files with 0 additions and 32 deletions

View File

@ -4,29 +4,12 @@ import numpy as np
import socketio
from voice_changer.VoiceChangerManager import VoiceChangerManager
import time
import multiprocessing as mp
# Queueからデータを読み取り
def read(q_in, q_out):
while True:
time.sleep(1)
[timestamp, sid] = q_in.get(True)
print("put........................................")
q_out.put([timestamp, sid])
class MMVC_Namespace(socketio.AsyncNamespace):
def __init__(self, namespace: str, voiceChangerManager: VoiceChangerManager):
super().__init__(namespace)
self.voiceChangerManager = voiceChangerManager
self.q_in = mp.Queue()
self.q_out = mp.Queue()
self.p = mp.Process(target=read, args=(self.q_in, self.q_out))
self.p.start()
@classmethod
def get_instance(cls, voiceChangerManager: VoiceChangerManager):
if not hasattr(cls, "_instance"):
@ -45,19 +28,6 @@ class MMVC_Namespace(socketio.AsyncNamespace):
print(data)
await self.emit('response', [timestamp, 0], to=sid)
else:
# print("receive ")
# self.q_in.put([timestamp, sid])
# while self.q_out.empty() == False:
# print("send........................................")
# [timestamp, sid] = self.q_out.get(True)
# await self.emit('response', [timestamp, 0], to=sid)
# print("end")
# print("receive ")
# time.sleep(2)
# await self.emit('response', [timestamp, 0], to=sid)
# print("end")
unpackedData = np.array(struct.unpack('<%sh' % (len(data) // struct.calcsize('<h')), data))
audio1, perf = self.voiceChangerManager.changeVoice(unpackedData)
bin = struct.pack('<%sh' % len(audio1), *audio1)

View File

@ -15,7 +15,6 @@ import pyworld as pw
from voice_changer.client_modules import convert_continuos_f0, spectrogram_torch, TextAudioSpeakerCollate, get_hparams_from_file, load_checkpoint
import time
import multiprocessing as mp
providers = ['OpenVINOExecutionProvider', "CUDAExecutionProvider", "DmlExecutionProvider", "CPUExecutionProvider"]
@ -487,7 +486,6 @@ class VoiceChanger():
with Timer("pre-process") as t:
if self.settings.inputSampleRate != 24000:
# print("convert sampling rate!", self.settings.inputSampleRate)
unpackedData = resampy.resample(unpackedData, 48000, 24000)
convertSize = unpackedData.shape[0] + min(self.settings.crossFadeOverlapSize, unpackedData.shape[0])
# print(convertSize, unpackedData.shape[0])