Spaces:
Sleeping
Sleeping
Update sonogram_utility.py
Browse files- sonogram_utility.py +2 -0
sonogram_utility.py
CHANGED
|
@@ -129,10 +129,12 @@ def audioNormalize(waveform,sampleRate,stepSizeInSeconds = 2,dbThreshold = -50,d
|
|
| 129 |
currEnd = int(min(currStart + stepSizeInSeconds * sampleRate, len(copyWaveform[0])-1))
|
| 130 |
done = False
|
| 131 |
while(not done):
|
|
|
|
| 132 |
copyWaveform_db = waveform[:,currStart:currEnd].clone().detach()
|
| 133 |
copyWaveform_db = transform(copyWaveform_db)
|
| 134 |
if currStart == 0:
|
| 135 |
print("First DB level calculated")
|
|
|
|
| 136 |
|
| 137 |
if torch.max(copyWaveform_db[0]).item() > dbThreshold:
|
| 138 |
gain = torch.min(dbTarget - copyWaveform_db[0])
|
|
|
|
| 129 |
currEnd = int(min(currStart + stepSizeInSeconds * sampleRate, len(copyWaveform[0])-1))
|
| 130 |
done = False
|
| 131 |
while(not done):
|
| 132 |
+
print(f"{currStart//len(copyWaveform[0]):.2f}% equalized")
|
| 133 |
copyWaveform_db = waveform[:,currStart:currEnd].clone().detach()
|
| 134 |
copyWaveform_db = transform(copyWaveform_db)
|
| 135 |
if currStart == 0:
|
| 136 |
print("First DB level calculated")
|
| 137 |
+
|
| 138 |
|
| 139 |
if torch.max(copyWaveform_db[0]).item() > dbThreshold:
|
| 140 |
gain = torch.min(dbTarget - copyWaveform_db[0])
|