Spaces:
Runtime error
Runtime error
Trying to fix encoding error with .wav
Browse files
app.py
CHANGED
@@ -37,7 +37,9 @@ def get_path_to_wav_format(uploaded_file):
|
|
37 |
st.info(new_desired_path)
|
38 |
waveform, sample_rate = torchaudio.load(actual_file_path)
|
39 |
st.info(f"waveform, sample_rate: {waveform}, {sample_rate}")
|
40 |
-
torchaudio.save(new_desired_path, waveform, sample_rate
|
|
|
|
|
41 |
|
42 |
return new_desired_path
|
43 |
|
|
|
37 |
st.info(new_desired_path)
|
38 |
waveform, sample_rate = torchaudio.load(actual_file_path)
|
39 |
st.info(f"waveform, sample_rate: {waveform}, {sample_rate}")
|
40 |
+
torchaudio.save(new_desired_path, waveform, sample_rate,
|
41 |
+
encoding="PCM_S", # Prevent encoding errors. https://stackoverflow.com/questions/60352850/wave-error-unknown-format-3-arises-when-trying-to-convert-a-wav-file-into-text
|
42 |
+
)
|
43 |
|
44 |
return new_desired_path
|
45 |
|