czyoung commited on
Commit
06b6d56
·
verified ·
1 Parent(s): 9bb7582

Removed processFile()

Browse files
Files changed (1) hide show
  1. utils.py +0 -49
utils.py CHANGED
@@ -34,55 +34,6 @@ TRANSPARENT_BG = dict(
34
  paper_bgcolor="rgba(0,0,0,0)",
35
  )
36
 
37
- # ---------------------------------------------------------------------------
38
- # Audio processing
39
- # ---------------------------------------------------------------------------
40
-
41
- def processFile(filePath, pipeline, enableDenoise, earlyCleanup,
42
- gainWindow, minimumGain, maximumGain,
43
- dfModel=None, dfState=None, attenLimDB=3):
44
- """Load, optionally denoise, equalize, and diarize an audio file.
45
-
46
- Returns (annotations, totalTimeInSeconds, waveform_tensor, sample_rate).
47
- """
48
- print("Loading file")
49
- waveformList, sampleRate = su.splitIntoTimeSegments(filePath, 600)
50
- print("File loaded")
51
-
52
- enhancedWaveformList = []
53
- if enableDenoise:
54
- print("Denoising")
55
- for w in waveformList:
56
- if enableDenoise:
57
- from df import enhance
58
- newW = enhance(dfModel, dfState, w, atten_lim_db=attenLimDB).detach().cpu()
59
- enhancedWaveformList.append(newW)
60
- else:
61
- enhancedWaveformList.append(w)
62
- if enableDenoise:
63
- print("Audio denoised")
64
-
65
- waveformEnhanced = su.combineWaveforms(enhancedWaveformList)
66
- if earlyCleanup:
67
- del enhancedWaveformList
68
-
69
- print("Equalizing Audio")
70
- waveform_gain_adjusted = su.equalizeVolume()(
71
- waveformEnhanced, sampleRate, gainWindow, minimumGain, maximumGain
72
- )
73
- if earlyCleanup:
74
- del waveformEnhanced
75
- print("Audio Equalized")
76
-
77
- print("Detecting speakers")
78
- diarization_output = pipeline({"waveform": waveform_gain_adjusted, "sample_rate": sampleRate})
79
- annotations = diarization_output.speaker_diarization
80
- print("Speakers Detected")
81
-
82
- totalTimeInSeconds = int(waveform_gain_adjusted.shape[-1] / sampleRate)
83
- return annotations, totalTimeInSeconds, waveform_gain_adjusted, sampleRate
84
-
85
-
86
  # ---------------------------------------------------------------------------
87
  # Speaker sample helpers
88
  # ---------------------------------------------------------------------------
 
34
  paper_bgcolor="rgba(0,0,0,0)",
35
  )
36
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
  # ---------------------------------------------------------------------------
38
  # Speaker sample helpers
39
  # ---------------------------------------------------------------------------