(predictor, df)
| 42 | |
| 43 | |
| 44 | def 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 | |
| 77 | def get_eval_input_names(): |
no test coverage detected