(self, z, pitches, max_audio_length=64000)
return result
Generate fake samples for given latents and pitches.

    Args:
      z: A numpy array of latent vectors [n_samples, n_latent dims].
      pitches: An iterable list of integer MIDI pitches [n_samples].
      max_audio_length: Integer, trim to this many samples.

    Returns:
      audio: Generated audio waveforms [n_samples, max_audio_length]
Generate fake samples for given latents and pitches.
Generate fake samples for given latents and pitches .
def generate_samples_from_z(self, z, pitches, max_audio_length=64000):
    """Generate fake samples for given latents and pitches.

    Args:
      z: A numpy array of latent vectors [n_samples, n_latent dims].
      pitches: An iterable list of integer MIDI pitches [n_samples].
      max_audio_length: Integer, trim to this many samples.

    Returns:
      audio: Generated audio waveforms [n_samples, max_audio_length]
    """
    labels = self._pitches_to_labels(pitches)
    n_samples = len(labels)
    num_batches = int(np.ceil(float(n_samples) / self.batch_size))
    n_tot = num_batches * self.batch_size
    padding = n_tot - n_samples
    # Pads zeros to make batches even batch size.
    labels = labels + [0] * padding
    z = np.concatenate([z, np.zeros([padding, z.shape[1]])], axis=0)

    # Generate waves
    start_time = time.time()
    waves_list = []
    for i in range(num_batches):
      start = i * self.batch_size
      end = (i + 1) * self.batch_size

      waves = self.sess.run(self.fake_waves_ph,
                            feed_dict={self.labels_ph: labels[start:end],
                                       self.noises_ph: z[start:end]})
      # Trim waves
      for wave in waves:
        waves_list.append(wave[:max_audio_length, 0])

    # Remove waves corresponding to the padded zeros.
    result = np.stack(waves_list[:n_samples], axis=0)
    print('generate_samples: generated {} samples in {}s'.format(
        n_samples, time.time() - start_time))
    return result
def generate_samples_from_z ( self , z , pitches , max_audio_length = 64000 ) : labels = self . _pitches_to_labels ( pitches ) n_samples = len ( labels ) num_batches = int ( np . ceil ( float ( n_samples ) / self . batch_size ) ) n_tot = num_batches * self . batch_size padding = n_tot - n_samples # Pads zeros to make batches even batch size. labels = labels + [ 0 ] * padding z = np . concatenate ( [ z , np . zeros ( [ padding , z . shape [ 1 ] ] ) ] , axis = 0 ) # Generate waves start_time = time . time ( ) waves_list = [ ] for i in range ( num_batches ) : start = i * self . batch_size end = ( i + 1 ) * self . batch_size waves = self . sess . run ( self . fake_waves_ph , feed_dict = { self . labels_ph : labels [ start : end ] , self . noises_ph : z [ start : end ] } ) # Trim waves for wave in waves : waves_list . append ( wave [ : max_audio_length , 0 ] ) # Remove waves corresponding to the padded zeros. result = np . stack ( waves_list [ : n_samples ] , axis = 0 ) print ( 'generate_samples: generated {} samples in {}s' . format ( n_samples , time . time ( ) - start_time ) ) return result