File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change 1313import torchcrepe
1414from numpy import dtype , float32 , ndarray
1515from scipy .io .wavfile import read
16- from torch import FloatTensor
16+ from torch import FloatTensor , Tensor
1717from tqdm import tqdm
1818
1919LOG = getLogger (__name__ )
@@ -219,7 +219,7 @@ def compute_f0_crepe(
219219 # (T) -> (1, T)
220220 audio = audio .detach ()
221221
222- pitch = torchcrepe .predict (
222+ pitch : Tensor = torchcrepe .predict (
223223 audio ,
224224 sampling_rate ,
225225 hop_length ,
@@ -231,7 +231,10 @@ def compute_f0_crepe(
231231 pad = True ,
232232 )
233233
234- return pitch .detach ().cpu ().numpy ()[0 ]
234+ f0 = pitch .squeeze (0 ).cpu ().numpy ()
235+ p_len = p_len or wav_numpy .shape [0 ] // hop_length
236+ f0 = _resize_f0 (f0 , p_len )
237+ return f0
235238
236239
237240def compute_f0 (
You can’t perform that action at this time.
0 commit comments