예제 #1
0
    labels_path = 'reshaped_TIMIT_labels.npy'

s_n_components = 64
r_n_components = 100

f0s = []
spectrograms = []
residuals = []
ds = np.load(input_file)
ls = np.load(label_file)
for i, X in enumerate(ds[:100]):
    X = X.astype('float64')
    f0, time_axis = dio(X, fs, period, opt)
    f0 = stonemask(X, fs, period, time_axis, f0)
    spectrogram = cheaptrick(X, fs, period, time_axis, f0)
    mel_spectrogram = melspec(spectrogram, fs, s_n_components)
    log_mel_spectrogram = np.log(mel_spectrogram)
    residual = platinum(X, fs, period, time_axis, f0, spectrogram)
    residuals.append(residual)
    spectrograms.append(spectrogram)

compression_residuals = np.concatenate([r[:100] for r in residuals], axis=0)

mel_spectrogram = melspec(spectrograms[0], fs, s_n_components)
log_mel_spectrogram = np.log(mel_spectrogram)
tf_r = PCA(n_components=r_n_components)
tf_r.fit(compression_residuals)

residual_matrix = tf_r.components_
reduced_residual = tf_r.transform(residuals[0])
tf_r_mean = tf_r.mean_
예제 #2
0
파일: make_timit.py 프로젝트: EQ4/world.py
    labels_path = 'reshaped_TIMIT_labels.npy'

s_n_components = 64
r_n_components = 100

f0s = []
spectrograms = []
residuals = []
ds = np.load(input_file)
ls = np.load(label_file)
for i, X in enumerate(ds[:100]):
    X = X.astype('float64')
    f0, time_axis = dio(X, fs, period, opt)
    f0 = stonemask(X, fs, period, time_axis, f0)
    spectrogram = cheaptrick(X, fs, period, time_axis, f0)
    mel_spectrogram = melspec(spectrogram, fs, s_n_components)
    log_mel_spectrogram = np.log(mel_spectrogram)
    residual = platinum(X, fs, period, time_axis, f0, spectrogram)
    residuals.append(residual)
    spectrograms.append(spectrogram)

compression_residuals = np.concatenate([r[:100] for r in residuals], axis=0)

mel_spectrogram = melspec(spectrograms[0], fs, s_n_components)
log_mel_spectrogram = np.log(mel_spectrogram)
tf_r = PCA(n_components=r_n_components)
tf_r.fit(compression_residuals)

residual_matrix = tf_r.components_
reduced_residual = tf_r.transform(residuals[0])
tf_r_mean = tf_r.mean_
예제 #3
0
    f0, time_axis = dio(X, fs, period, opt)
    f0 = stonemask(X, fs, period, time_axis, f0)
    spectrogram = cheaptrick(X, fs, period, time_axis, f0)
    residual = platinum(X, fs, period, time_axis, f0, spectrogram)
    log_spectrogram = np.log(spectrogram)
    residuals.append(residual)
    log_spectrograms.append(spectrogram)

log_spectrograms = np.concatenate(log_spectrograms, axis=0)
residuals = np.concatenate(residuals, axis=0)

s_n_components = 64
r_n_components = 100

print("Calculating compressed spectrogram exmaple")
mel_spectrogram = melspec(spectrogram, fs, s_n_components)
log_mel_spectrogram = np.log(mel_spectrogram)
print("Calculating decomposition of residual subset")
tf_r = PCA(n_components=r_n_components)
tf_r.fit(residuals)

residual_matrix = tf_r.components_
reduced_residual = tf_r.transform(residual)
tf_r_mean = tf_r.mean_

h5_file = tables.openFile(h5_file_path, mode='w')
print("Creating dataset at %s from directory %s" % (files_dir, h5_file_path))
compression_filter = tables.Filters(complevel=5, complib='blosc')
residual_matrix_storage = h5_file.createCArray(h5_file.root,
                                               'residual_matrix',
                                               tables.Float32Atom(),
예제 #4
0
    f0, time_axis = dio(X, fs, period, opt)
    f0 = stonemask(X, fs, period, time_axis, f0)
    spectrogram = cheaptrick(X, fs, period, time_axis, f0)
    residual = platinum(X, fs, period, time_axis, f0, spectrogram)
    log_spectrogram = np.log(spectrogram)
    residuals.append(residual)
    log_spectrograms.append(spectrogram)

log_spectrograms = np.concatenate(log_spectrograms, axis=0)
residuals = np.concatenate(residuals, axis=0)

s_n_components = 64
r_n_components = 100

print("Calculating compressed spectrogram exmaple")
mel_spectrogram = melspec(spectrogram, fs, s_n_components)
log_mel_spectrogram = np.log(mel_spectrogram)
print("Calculating decomposition of residual subset")
tf_r = PCA(n_components=r_n_components)
tf_r.fit(residuals)

residual_matrix = tf_r.components_
reduced_residual = tf_r.transform(residual)
tf_r_mean = tf_r.mean_

h5_file = tables.openFile(h5_file_path, mode='w')
print("Creating dataset at %s from directory %s" % (files_dir, h5_file_path))
compression_filter = tables.Filters(complevel=5, complib='blosc')
residual_matrix_storage = h5_file.createCArray(h5_file.root, 'residual_matrix',
                                               tables.Float32Atom(),
                                               shape=residual_matrix.shape,