Beispiel #1
0
    default="~/corpus-folder/fluid-dataset",
    type=str,
    help="Folder for output. This will be made if it doesnt exist.",
)
args = parser.parse_args()
"""
Using the python-flucoma package analyser outputs can be turned into datasets.
To do this we have to specifically create an instance of the analyser we are interested in.
After the FTISProcess has run we then extract the output from that instance.
"""

src = Corpus(args.input)
out = args.output

world = World(sink=out)

stats = Stats(numderivs=2,
              spec=["stddev", "mean"])  # create an instance of the stats class
src >> CollapseAudio() >> FluidMFCC() >> stats
world.build(src)

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

    # Now that ftis has completed lets pack the data into a fluid dataset
    dataset = dataset.pack(
        stats.output
    )  # use the pack function to marshall it to the right format
    dataset_path = Path(out) / "dataset.json"  # create an output path
    write_json(dataset_path.expanduser(), dataset)  # write to disk
Beispiel #2
0
Give me a crude 3 cluster output of all of the 'static' files. Later on we'll find other files similar to these.
We can use both bits of information to help compose.
"""

output = "../../reaper/Convolutions/base_materials"
em = Corpus("~/Cloud/Projects/ElectroMagnetic/outputs/classification/4_Split/1")

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

dr = UMAP(components=10, cache=1)
clustering = AgglomerativeClustering(numclusters=3)
analysis.add(
    FluidMFCC(discard=True, numcoeffs=20, fftsettings=[2048, -1, -1], cache=1),
    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:
            
Beispiel #3
0
)
parser.add_argument(
    "-o",
    "--output",
    default="~/corpus-folder/corpus-management",
    type=str,
    help="Folder for output. This will be made if it doesnt exist.",
)
args = parser.parse_args()
"""
Corpus objects overload the addition operator.
This allows you to add Corpus objects together to create a new Corpus from their materials.
"""

em = Corpus(args.corpusone)  # first corpus
db = Corpus(args.corpustwo)  # second corpus
corpus = em + db  # compose a corpus of both sub-corpora

# adding two Corpus() objects together modifies their contents
# em + db is NOT the same as db + em, unless you are assigning the output
# If you want to add the contents of db to em, you would need to structure it...
# ```em + db```
# and use em as the 'source' for the FTISProcess

world = World(sink=args.output)
corpus >> FluidMFCC()
world.build(corpus)

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