MCPcopy
hub / github.com/andabi/deep-voice-conversion / convert

Function convert

convert.py:44–74  ·  view source on GitHub ↗
(predictor, df)

Source from the content-addressed store, hash-verified

42
43
44def convert(predictor, df):
45 pred_spec, y_spec, ppgs = predictor(next(df().get_data()))
46
47 # Denormalizatoin
48 pred_spec = denormalize_db(pred_spec, hp.default.max_db, hp.default.min_db)
49 y_spec = denormalize_db(y_spec, hp.default.max_db, hp.default.min_db)
50
51 # Db to amp
52 pred_spec = db2amp(pred_spec)
53 y_spec = db2amp(y_spec)
54
55 # Emphasize the magnitude
56 pred_spec = np.power(pred_spec, hp.convert.emphasis_magnitude)
57 y_spec = np.power(y_spec, hp.convert.emphasis_magnitude)
58
59 # Spectrogram to waveform
60 audio = np.array(map(lambda spec: spec2wav(spec.T, hp.default.n_fft, hp.default.win_length, hp.default.hop_length,
61 hp.default.n_iter), pred_spec))
62 y_audio = np.array(map(lambda spec: spec2wav(spec.T, hp.default.n_fft, hp.default.win_length, hp.default.hop_length,
63 hp.default.n_iter), y_spec))
64
65 # Apply inverse pre-emphasis
66 audio = inv_preemphasis(audio, coeff=hp.default.preemphasis)
67 y_audio = inv_preemphasis(y_audio, coeff=hp.default.preemphasis)
68
69 # if hp.convert.one_full_wav:
70 # # Concatenate to a wav
71 # y_audio = np.reshape(y_audio, (1, y_audio.size), order='C')
72 # audio = np.reshape(audio, (1, audio.size), order='C')
73
74 return audio, y_audio, ppgs
75
76
77def get_eval_input_names():

Callers 1

do_convertFunction · 0.85

Calls 5

denormalize_dbFunction · 0.90
db2ampFunction · 0.90
spec2wavFunction · 0.90
inv_preemphasisFunction · 0.90
get_dataMethod · 0.45

Tested by

no test coverage detected