Skip to content

Commit

Permalink
Skips existing files instead of quitting
Browse files Browse the repository at this point in the history
  • Loading branch information
racitup committed Mar 30, 2020
1 parent c238a9e commit 0c0881f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tools/downsample.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Uses Audacity to downsample Freeswitch sound files to the various rates required.
Takes a directory as input and expects files in the form: .../lang/country/voice/app/rate/file.wav.
Outputs 8kHz, 16kHz and 32kHz versions in the current working dir: ./newrate/lang/country/voice/app/newrate/file.wav.
Quits if a file exists.
Skips existing files.
Make sure Audacity is running first and that mod-script-pipe is enabled in preferences before running this script.
"""

Expand Down Expand Up @@ -130,7 +130,11 @@ def newpath(wav, newrate):
def downsample(client, path, newrate):
"Main downsample loop"
for wav in get_wavs(path):
newwav = newpath(wav, newrate)
try:
newwav = newpath(wav, newrate)
except OSError as e:
print(e)
continue
cutoff = (newrate * 7) / 16
script = [
'Import2: Filename="{}"'.format(wav), # Open, full file path required
Expand Down

0 comments on commit 0c0881f

Please sign in to comment.