Spaces:
Sleeping
Sleeping
helloWorld199
commited on
Commit
•
ba6c1db
1
Parent(s):
dd168eb
from wav to mp3 v2
Browse files- src/main.py +3 -3
src/main.py
CHANGED
@@ -130,7 +130,7 @@ def convert_to_stereo(audio_path):
|
|
130 |
# check if mono
|
131 |
if type(wave[0]) != np.ndarray:
|
132 |
print("QUI DENTRO STEREOOOOOOOOO!")
|
133 |
-
stereo_path = f'{os.path.splitext(audio_path)[0]}_stereo.
|
134 |
command = shlex.split(f'ffmpeg -y -loglevel error -i "{audio_path}" -ac 2 -f mp3 "{stereo_path}"')
|
135 |
subprocess.run(command)
|
136 |
return stereo_path
|
@@ -149,11 +149,11 @@ def normalize_audio(input_audio_path, output_audio_path):
|
|
149 |
lufs_right2 = meter2.integrated_loudness(y2[1])
|
150 |
|
151 |
y2_normalized_left = pyln.normalize.loudness(y2[0], lufs_left2, lufs_left1)
|
152 |
-
y2_normalized_right = pyln.normalize.loudness(y2[
|
153 |
|
154 |
y2_normalized = np.stack((y2_normalized_left, y2_normalized_right), axis=0)
|
155 |
|
156 |
-
output_path = f"{output_audio_path}_normalized.
|
157 |
|
158 |
sf.write(output_path, y2_normalized.T, sr2)
|
159 |
|
|
|
130 |
# check if mono
|
131 |
if type(wave[0]) != np.ndarray:
|
132 |
print("QUI DENTRO STEREOOOOOOOOO!")
|
133 |
+
stereo_path = f'{os.path.splitext(audio_path)[0]}_stereo.mp3'
|
134 |
command = shlex.split(f'ffmpeg -y -loglevel error -i "{audio_path}" -ac 2 -f mp3 "{stereo_path}"')
|
135 |
subprocess.run(command)
|
136 |
return stereo_path
|
|
|
149 |
lufs_right2 = meter2.integrated_loudness(y2[1])
|
150 |
|
151 |
y2_normalized_left = pyln.normalize.loudness(y2[0], lufs_left2, lufs_left1)
|
152 |
+
y2_normalized_right = pyln.normalize.loudness(y2[1], lufs_right2, lufs_right1)
|
153 |
|
154 |
y2_normalized = np.stack((y2_normalized_left, y2_normalized_right), axis=0)
|
155 |
|
156 |
+
output_path = f"{output_audio_path}_normalized.mp3"
|
157 |
|
158 |
sf.write(output_path, y2_normalized.T, sr2)
|
159 |
|