2c6ce0ebfa9537246878e8fb9144e0c879fca17d,cube/models/vocoder.py,BeeCoder,synthesize,#BeeCoder#,68

Before Change


        return np.random.choice(np.arange(256), p=scaled_prediction)

    def synthesize(self, mgc, batch_size, sample=True, temperature=1.0):
        synth = []
        dy.renew_cg()
        history = dy.inputVector([127 for x in range(self.HISTORY)])
        last_proc = 0
        for mgc_index in range(len(mgc)):
            curr_proc = int((mgc_index + 1) * 100 / len(mgc))
            if curr_proc % 5 == 0 and curr_proc != last_proc:
                while last_proc < curr_proc:
                    last_proc += 5
                    sys.stdout.write(" " + str(last_proc))
                    sys.stdout.flush()
            pred_probs = self._predict_one(mgc[mgc_index], history, runtime=True)
            for output in pred_probs:
                synth.append(self._pick_sample(output.npvalue(), temperature=temperature))

            hist = synth[-self.HISTORY:]
            dy.renew_cg()
            history = (dy.inputVector(hist) - 127.0) / 128.0


        return synth

After Change



    def synthesize(self, mgc, batch_size, sample=True, temperature=1.0):
        last_fft = None
        predicted = np.zeros((len(mgc), 513), dtype=np.complex)
        last_proc = 0
        for mgc_index in range(len(mgc)):
            dy.renew_cg()
            curr_proc = int((mgc_index + 1) * 100 / len(mgc))
            if curr_proc % 5 == 0 and curr_proc != last_proc:
                while last_proc < curr_proc:
                    last_proc += 5
                    sys.stdout.write(" " + str(last_proc))
                    sys.stdout.flush()
            [output_real, output_imag] = self._predict_one(mgc[mgc_index], last_fft=last_fft, runtime=True)

            last_fft = np.zeros(self.FFT_SIZE, dtype=np.complex)
            out_real = output_real.value()
            out_imag = output_imag.value()
            for ii in range(self.FFT_SIZE):
                last_fft[ii] = np.complex(out_real[ii], out_imag[ii])
                predicted[mgc_index, ii] = np.complex(out_real[ii], out_imag[ii])

        synth = self.vocoder.ifft(predicted, sample_rate=self.params.target_sample_rate)
        // print(synth)
        synth = np.array((synth + 1) * 32767, dtype=np.int16)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 9

Instances


Project Name: tiberiu44/TTS-Cube
Commit Name: 2c6ce0ebfa9537246878e8fb9144e0c879fca17d
Time: 2018-10-22
Author: tibi@racai.ro
File Name: cube/models/vocoder.py
Class Name: BeeCoder
Method Name: synthesize


Project Name: taehoonlee/tensornets
Commit Name: b9927f30cb9c92040c30d0fe8c735d8baea167b2
Time: 2019-03-13
Author: me@taehoonlee.com
File Name: tensornets/layers.py
Class Name:
Method Name: gconvbn


Project Name: luispedro/mahotas
Commit Name: d3e1a0327bbd287f805f92cffcb6e1c584ed61cc
Time: 2010-11-22
Author: lpc@cmu.edu
File Name: mahotas/texture.py
Class Name:
Method Name: cooccurence