Upload skmodel_e550_s27500.pth
#146
by Jony09 - opened
- lib/infer/infer_libs/audio.py +5 -6
- requirements.txt +1 -1
lib/infer/infer_libs/audio.py
CHANGED
|
@@ -19,9 +19,9 @@ platform_stft_mapping = {
|
|
| 19 |
stft = platform_stft_mapping.get(sys.platform)
|
| 20 |
|
| 21 |
def wav2(i, o, format):
|
| 22 |
-
inp = av.open(i, '
|
| 23 |
if format == "m4a": format = "mp4"
|
| 24 |
-
out = av.open(o, '
|
| 25 |
if format == "ogg": format = "libvorbis"
|
| 26 |
if format == "mp4": format = "aac"
|
| 27 |
|
|
@@ -36,13 +36,12 @@ def wav2(i, o, format):
|
|
| 36 |
inp.close()
|
| 37 |
|
| 38 |
def audio2(i, o, format, sr):
|
| 39 |
-
inp = av.open(i, '
|
| 40 |
-
out = av.open(o, '
|
| 41 |
if format == "ogg": format = "libvorbis"
|
| 42 |
if format == "f32le": format = "pcm_f32le"
|
| 43 |
|
| 44 |
-
ostream = out.add_stream(format)
|
| 45 |
-
ostream.codec_context.layout = "mono"
|
| 46 |
ostream.sample_rate = sr
|
| 47 |
|
| 48 |
for frame in inp.decode(audio=0):
|
|
|
|
| 19 |
stft = platform_stft_mapping.get(sys.platform)
|
| 20 |
|
| 21 |
def wav2(i, o, format):
|
| 22 |
+
inp = av.open(i, 'rb')
|
| 23 |
if format == "m4a": format = "mp4"
|
| 24 |
+
out = av.open(o, 'wb', format=format)
|
| 25 |
if format == "ogg": format = "libvorbis"
|
| 26 |
if format == "mp4": format = "aac"
|
| 27 |
|
|
|
|
| 36 |
inp.close()
|
| 37 |
|
| 38 |
def audio2(i, o, format, sr):
|
| 39 |
+
inp = av.open(i, 'rb')
|
| 40 |
+
out = av.open(o, 'wb', format=format)
|
| 41 |
if format == "ogg": format = "libvorbis"
|
| 42 |
if format == "f32le": format = "pcm_f32le"
|
| 43 |
|
| 44 |
+
ostream = out.add_stream(format, channels=1)
|
|
|
|
| 45 |
ostream.sample_rate = sr
|
| 46 |
|
| 47 |
for frame in inp.decode(audio=0):
|
requirements.txt
CHANGED
|
@@ -43,7 +43,7 @@ torchcrepe==0.0.20
|
|
| 43 |
fastapi==0.88
|
| 44 |
ffmpy==0.3.1
|
| 45 |
python-dotenv>=1.0.0
|
| 46 |
-
av
|
| 47 |
PySimpleGUI
|
| 48 |
pedalboard
|
| 49 |
gdown
|
|
|
|
| 43 |
fastapi==0.88
|
| 44 |
ffmpy==0.3.1
|
| 45 |
python-dotenv>=1.0.0
|
| 46 |
+
av==11.0.0
|
| 47 |
PySimpleGUI
|
| 48 |
pedalboard
|
| 49 |
gdown
|