コード例 #1
0
ファイル: corpus.py プロジェクト: jamesb93/ftis
    def filter_duration(x, low: float, high: float) -> bool:
        hsh = create_hash(x, low, high)
        tmp = Path("/tmp") / "ftis_cache"
        tmp.mkdir(exist_ok=True)

        cache = tmp / f"{hsh}.npy"
        if not cache.exists():
            dur = get_duration(x)
            np.save(cache, dur)
        else:
            dur = np.load(cache)
        return dur < high and dur > low
コード例 #2
0
ファイル: 10_reaper_clustering.py プロジェクト: jamesb93/ftis
    # #    "track2" : [
    # #        {"file" : None, "length": 1.0, "start": 0.0, "position": 0.0}
    # #    ]
    # # }
    # #---------------------------------------------------------------------------#

    tracks = {}

    for cluster, members in clustering.output.items(
    ):  # iterate as a pair the item and its slices
        # iterate cluster number and its members as a pair
        pos = 0  # establish that we start each track at 0.0 seconds on timeline
        for media in members:  # iterate each media item for that cluster
            # convert to seconds for reaper
            sr = get_sr(media)  # get the sample rate (for conversion2)
            duration = get_duration(media)  # get the duration
            item = {
                "file":
                media,  # provide the file name (can be absolute or relative actually...)
                "length": duration,  # provide the length of the item
                "start": 0.0,  # provide the start of the item
                "position": pos  # this item is at the position stored in 'pos'
            }

            pos += duration  # increment pos by the length of this item
            # this way we get the items nicely lined up like:
            # |item|item|item|item|
            # in the reaper session

            if cluster not in tracks:  # if this is the first item
                tracks[cluster] = [
コード例 #3
0
    Stats(numderivs=1, flatten=True, cache=1),
    Standardise(cache=1),
    dr,
    clustering
)

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

    tracks = {}
    for cluster, items in clustering.output.items():
        track_id = cluster
        pos = 0
        for audiofile in items:
            
            dur = get_duration(audiofile)
            item = {
                "file": audiofile,
                "length": dur,
                "start": 0.0,
                "position": pos
            }
            pos += dur

            if track_id in tracks: tracks[track_id].append(item)
            else: tracks[track_id] = [item]

    # Now make the folders
    reaper_session = Path(output) / "base_materails.rpp"

    env = jinja2.Environment(loader=jinja2.FileSystemLoader(['../../RPRTemplates']))
コード例 #4
0
    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)
            item = {
                "file": i,
                "length": dur,
                "start": 0.0,
                "position": pos,
                "color": ""
            }
            pos += dur

            if anchor in tracks:
                tracks[str(anchor)].append(item)
            else:
                tracks[str(anchor)] = [item]

    # Now make the folders
コード例 #5
0
ファイル: filters.py プロジェクト: jamesb93/ftis
 def filter_duration(self, x):
     dur = get_duration(x)
     return dur < self.max_dur and dur > self.min_dur
コード例 #6
0
ファイル: loudest.py プロジェクト: jamesb93/interferences
    CorpusLoader(cache=1), CorpusFilter(max_loudness=100, min_loudness=75),
    FluidMFCC(discard=True, numcoeffs=20, fftsettings=[8192, 128, 8192]),
    Stats(numderivs=1,
          spec=["median", "max", "min", "stddev", "mean", "skewness"]),
    UMAP(components=2), clustering)

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

    tracks = {}
    for cluster, items in clustering.output.items():
        track_id = cluster
        pos = 0
        for audiofile in items:

            dur = get_duration(audiofile)
            item = {
                "file": audiofile,
                "length": get_duration(audiofile),
                "start": 0.0,
                "position": pos
            }
            pos += dur

            if track_id in tracks:
                tracks[track_id].append(item)
            else:
                tracks[track_id] = [item]

    # Now make the folders
    reaper_session = Path(folder) / "Quietest.rpp"