crepe gui
This commit is contained in:
parent
efc6e6d321
commit
1643628a69
@ -117,7 +117,7 @@
|
||||
{
|
||||
"name": "f0Detector",
|
||||
"options": {
|
||||
"detectors": ["dio", "harvest"]
|
||||
"detectors": ["dio", "harvest", "crepe"]
|
||||
}
|
||||
},
|
||||
{
|
||||
|
11
client/demo/dist/index.html
vendored
11
client/demo/dist/index.html
vendored
@ -1 +1,10 @@
|
||||
<!doctype html><html style="width:100%;height:100%;overflow:hidden"><head><meta charset="utf-8"/><title>Voice Changer Client Demo</title><script defer="defer" src="index.js"></script></head><body style="width:100%;height:100%;margin:0"><div id="app" style="width:100%;height:100%"></div></body></html>
|
||||
<!DOCTYPE html>
|
||||
<html style="width: 100%; height: 100%; overflow: hidden">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Voice Changer Client Demo</title>
|
||||
<script defer src="index.js"></script></head>
|
||||
<body style="width: 100%; height: 100%; margin: 0px">
|
||||
<div id="app" style="width: 100%; height: 100%"></div>
|
||||
</body>
|
||||
</html>
|
||||
|
1695
client/demo/dist/index.js
vendored
1695
client/demo/dist/index.js
vendored
File diff suppressed because one or more lines are too long
2751
client/demo/dist/index.js.LICENSE.txt
vendored
2751
client/demo/dist/index.js.LICENSE.txt
vendored
File diff suppressed because it is too large
Load Diff
@ -117,7 +117,7 @@
|
||||
{
|
||||
"name": "f0Detector",
|
||||
"options": {
|
||||
"detectors": ["dio", "harvest"]
|
||||
"detectors": ["dio", "harvest", "crepe"]
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -9,10 +9,10 @@ class CrepePitchExtractor(PitchExtractor):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
if torch.cuda.is_available():
|
||||
self.device = torch.device('cuda:' + str(torch.cuda.current_device()))
|
||||
self.device = torch.device("cuda:" + str(torch.cuda.current_device()))
|
||||
else:
|
||||
self.device = torch.device('cpu')
|
||||
|
||||
self.device = torch.device("cpu")
|
||||
|
||||
def extract(self, audio, f0_up_key, sr, window, silence_front=0):
|
||||
n_frames = int(len(audio) // window) + 1
|
||||
start_frame = int(silence_front * sr / window)
|
||||
@ -26,12 +26,23 @@ class CrepePitchExtractor(PitchExtractor):
|
||||
f0_mel_min = 1127 * np.log(1 + f0_min / 700)
|
||||
f0_mel_max = 1127 * np.log(1 + f0_max / 700)
|
||||
|
||||
f0 = torchcrepe.predict(torch.tensor(audio).unsqueeze(0), sr,
|
||||
hop_length=window, fmin=f0_min, fmax=f0_max, model='tiny', batch_size=256,
|
||||
decoder=torchcrepe.decode.weighted_argmax, device=self.device)
|
||||
f0 = torchcrepe.predict(
|
||||
torch.tensor(audio).unsqueeze(0),
|
||||
sr,
|
||||
hop_length=window,
|
||||
fmin=f0_min,
|
||||
fmax=f0_max,
|
||||
# model="tiny",
|
||||
model="full",
|
||||
batch_size=256,
|
||||
decoder=torchcrepe.decode.weighted_argmax,
|
||||
device=self.device,
|
||||
)
|
||||
f0 = f0.squeeze().detach().cpu().numpy()
|
||||
|
||||
f0 = np.pad(f0.astype("float"), (start_frame, n_frames - f0.shape[0] - start_frame))
|
||||
f0 = np.pad(
|
||||
f0.astype("float"), (start_frame, n_frames - f0.shape[0] - start_frame)
|
||||
)
|
||||
|
||||
f0 *= pow(2, f0_up_key / 12)
|
||||
f0bak = f0.copy()
|
||||
@ -44,4 +55,3 @@ class CrepePitchExtractor(PitchExtractor):
|
||||
f0_coarse = np.rint(f0_mel).astype(np.int)
|
||||
|
||||
return f0_coarse, f0bak
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user