Skip to content

Commit

Permalink
now convert also from 300kHz to 300kHz
Browse files Browse the repository at this point in the history
  • Loading branch information
fdechaumont committed Apr 4, 2022
1 parent 5e20c2d commit cdf91c7
Showing 1 changed file with 15 additions and 18 deletions.
33 changes: 15 additions & 18 deletions LMT/USV2/convert/convertTo300khz.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,22 @@ def convert( file ):


if frameRate == 300000:
print("File is already in 300kHz: " , file )
return

print("Frame rate : " , frameRate )
if frameRate != 300000:
print("Converting sampling rate to 300kHz...")

try:
duration = librosa.get_duration(filename=file)
print("Duration: " , duration , " seconds")
y, sr = librosa.load( file , mono=True, sr=300000)

convertedFile = file+".converted.wav"
sf.write( convertedFile, y, sr, subtype='PCM_16')
print("Converting framerate done")
print("File is already in 300kHz: " , file , "... (converting anyway)")

print("Converting sampling rate to 300kHz...")

try:
duration = librosa.get_duration(filename=file)
print("Duration: " , duration , " seconds")
y, sr = librosa.load( file , mono=True, sr=300000)

except:
print("Error in conversion")
return
convertedFile = file+".converted.wav"
sf.write( convertedFile, y, sr, subtype='PCM_16')
print("Converting framerate done")

except:
print("Error in conversion")
return

# end convert

Expand Down

0 comments on commit cdf91c7

Please sign in to comment.