Spaces:
Running
on
Zero
Running
on
Zero
Nithya
commited on
Commit
·
7347979
1
Parent(s):
fdfa43a
add stereo input compatability
Browse files
app.py
CHANGED
|
@@ -210,6 +210,8 @@ def container_generate(model_selection, task_selection, audio, singer_id, t0):
|
|
| 210 |
if audio is None:
|
| 211 |
return None, None
|
| 212 |
sr, audio = audio
|
|
|
|
|
|
|
| 213 |
if len(audio) < 12*sr and task_selection == 'Melodic Reinterpretation':
|
| 214 |
# make sure the audio is at least 12 s long
|
| 215 |
audio = np.pad(audio, (0, 12*sr - len(audio)), mode='constant')
|
|
|
|
| 210 |
if audio is None:
|
| 211 |
return None, None
|
| 212 |
sr, audio = audio
|
| 213 |
+
if len(audio.shape) == 2:
|
| 214 |
+
audio = np.mean(audio, axis=1) # convert stereo to mono
|
| 215 |
if len(audio) < 12*sr and task_selection == 'Melodic Reinterpretation':
|
| 216 |
# make sure the audio is at least 12 s long
|
| 217 |
audio = np.pad(audio, (0, 12*sr - len(audio)), mode='constant')
|