move wav2 to server.py
This commit is contained in:
16
utils.py
16
utils.py
@@ -8,7 +8,6 @@ import subprocess
|
||||
import numpy as np
|
||||
from scipy.io.wavfile import read
|
||||
import torch
|
||||
from av import open as avopen
|
||||
|
||||
MATPLOTLIB_FLAG = False
|
||||
|
||||
@@ -292,18 +291,3 @@ class HParams():
|
||||
|
||||
def __repr__(self):
|
||||
return self.__dict__.__repr__()
|
||||
|
||||
def wav2(i, o, format):
|
||||
inp = avopen(i, 'rb')
|
||||
out = avopen(o, 'wb', format=format)
|
||||
if format == "ogg": format = "libvorbis"
|
||||
|
||||
ostream = out.add_stream(format)
|
||||
|
||||
for frame in inp.decode(audio=0):
|
||||
for p in ostream.encode(frame): out.mux(p)
|
||||
|
||||
for p in ostream.encode(None): out.mux(p)
|
||||
|
||||
out.close()
|
||||
inp.close()
|
||||
|
||||
Reference in New Issue
Block a user