Exemplo n.º 1
0
sample_scalenotes = flat_scalenotes[-1000:]
"""
# find some start points
for n in range(len(sample_labels)):
    lcr_i = label_to_lcr[sample_labels[n, 0]]
    if lcr_i[0] == 0:
        print(n) 
"""
# 16 44 117 119 143 151 206 242 267 290 308 354 380 410 421 456 517 573 598 622 638 663 676 688 715 725 749 752 820 851 866 922

# start at 16 since that's the start of a chord sequence (could choose any of the numbers above)
for offset in [16, 44, 308, 421, 517, 752, 866]:
    print("sampling offset {}".format(offset))
    x_rec_i = x_rec[offset:offset + num_each]

    x_ts = piano_roll_imlike_to_image_array(x_rec_i, 0.25)
    # cut off zero padding on the vertical axis
    x_ts = x_ts[:, :35]

    if not os.path.exists("samples"):
        os.mkdir("samples")
    save_image_array(
        x_ts,
        "samples/multichannel_pixel_cnn_gen_{}_seed_{}_temp_{}.png".format(
            offset, args.seed, args.temp))

    sample_flat_idx = flat_idx[-1000:]

    p = sample_flat_idx[offset:offset + num_each]
    note_to_norm_kv = d2["note_to_norm_kv"]
    midi_to_norm_kv = d2["midi_to_norm_kv"]
Exemplo n.º 2
0
import numpy as np
from tfbldr.datasets import piano_roll_imlike_to_image_array
from tfbldr.datasets import save_image_array
import sys

fname = sys.argv[1]
d = np.load(fname)
xr = d["pr"][8:16]
rr = piano_roll_imlike_to_image_array(xr, 0.25, background="white")
rr = rr[:, 40:80]
pngname = "samples/{}.png".format(fname.split("/")[-1].split(".")[0])
print("saving {}".format(pngname))
save_image_array(rr,
                 pngname,
                 resize_multiplier=(4, 1),
                 gamma_multiplier=7,
                 flat_wide=True)
print("image complete")
from IPython import embed
embed()
raise ValueError()