Esempio n. 1
0
    min_duration=2, max_duration=20))

unstatic = Corpus(
    "~/Cloud/Projects/ElectroMagnetic/outputs/classification/4_Split/0")
static = Corpus(
    "~/Cloud/Projects/ElectroMagnetic/outputs/classification/4_Split/1")

output = "../../reaper/Convolutions/tuned"

analysis = Chain(source=(db + tuned + unstatic + static), folder=output)

kdtree = KDTree()
dr = UMAP(components=10, cache=1)  # we need access to the original data
analysis.add(
    # FluidMFCC(discard=True, numcoeffs=20, fftsettings=[4096, -1, -1], cache=1),
    LibroCQT(cache=0),
    Stats(numderivs=1, flatten=True, cache=1),
    Standardise(cache=1),
    dr,
    kdtree)

if __name__ == "__main__":
    analysis.run()

    pinpoint = tuned.items[0]  # single item
    x = dr.output[pinpoint]
    dist, ind = kdtree.model.query([x], k=200)
    keys = [x for x in dr.output.keys()]
    names = [keys[x] for x in ind[0]]
    d = {"1": names}
    write_json(analysis.folder / "nearest_files.json", d)
Esempio n. 2
0
db = (Corpus("~/Cloud/Projects/DataBending/DataAudioUnique").duration(
    min_duration=2, max_duration=20))

em = Corpus(
    "~/Cloud/Projects/ElectroMagnetic/outputs/classification/4_Split/1")

output = "../../reaper/Convolutions/anchors"

analysis = Chain(source=(em + db), folder=output)

kdtree = KDTree()
dr = UMAP(components=10, cache=1)  # we need access to the original data
analysis.add(
    FluidMFCC(discard=True, numcoeffs=20, fftsettings=[4096, -1, -1], cache=1),
    Stats(numderivs=1, flatten=True, cache=1), Standardise(cache=1), dr,
    kdtree)

if __name__ == "__main__":
    analysis.run()

    tracks = {}
    for anchor in anchors:
        pos = 0
        point = dr.output[anchor]
        dist, ind = kdtree.model.query([point], k=25)
        keys = [x for x in dr.output.keys()]
        names = [keys[x] for x in ind[0]]
        names.append(anchor)
        for i in names:
            dur = get_duration(i)