def process_corpus_highlevel(corpus_name, chop, cman=SOURCE_REPO): """ Wrapper for the **process_highlevel** method in order to process all files in a given **corpus** for a given **chop** """ cm = FileCorpusManager(cman) corpus = cm.load_corpus(corpus_name) for f in corpus.list_audio_files(): process_highlevel(corpus, f, chop=chop) corpus.create_gaia_db(chop='highlevel_%s' % chop)
def initial_test(): """ Helper method used for analysing a couple of corpuses at once. """ cm = FileCorpusManager(SOURCE_REPO) for name in ['melodies', 'motown']: corpus = cm.load_corpus((name)) for f in corpus.list_audio_files(): process_highlevel(corpus, f, chop='onsets') corpus.create_gaia_db(chop='highlevel_onsets')
def create_corpus(filepath, weights, chop): """ Create a directory callled corpus in the same directory as filepath, convert all the audio files, segment and analyse... ffmpeg must be installed for Mp3 conversion to work """ if os.path.isfile(filepath): cm = FileCorpusManager(os.path.dirname(filepath)) try: cm.create_corpus('corpus') except CorpusExistsException, e: cm.delete_corpus('corpus') cm.create_corpus('corpus') c = cm.load_corpus('corpus') shutil.copy(filepath, os.path.join(os.path.dirname(filepath), 'corpus', os.path.basename(filepath)))
convert all the audio files, segment and analyse... ffmpeg must be installed for Mp3 conversion to work """ if os.path.isfile(filepath): cm = FileCorpusManager(os.path.dirname(filepath)) try: cm.create_corpus('corpus') except CorpusExistsException, e: cm.delete_corpus('corpus') cm.create_corpus('corpus') c = cm.load_corpus('corpus') shutil.copy(filepath, os.path.join(os.path.dirname(filepath), 'corpus', os.path.basename(filepath))) else: cm = FileCorpusManager(filepath) to_copy = os.listdir(cm.repository) try: cm.create_corpus('corpus') except CorpusExistsException, e: cm.delete_corpus('corpus') to_copy = os.listdir(cm.repository) cm.create_corpus('corpus') c = cm.load_corpus('corpus') os.chdir(cm.repository) for f in to_copy: shutil.copy(f, c.location) os.chdir(c.location) ca.rename_wavs() ca.execute_flac_convert()