How to use the essentia.standard function in essentia

To help you get started, we’ve selected a few essentia examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dodo1210 / tcc_code / elementos / spectral_flux / executa.py View on Github external
# 2. Load the audio as a waveform `y`
#    Store the sampling rate as `sr`
#captura da musica
arq = open('/home/douglas/Música/musicas/wav/tristes/tristes.txt','r')
lines = arq.readlines()
arq.close()

lista = []

count=0
for l in lines:
    #carregamento dos arquivos
    music, erro = l.split("\n",1)
    #VERIFIQUE O CAMINHO, POR FAVOR
    # Loading audio file
    features, features_frames = es.MusicExtractor(lowlevelStats=['mean', 'stdev'],
                                              rhythmStats=['mean', 'stdev'],
                                              tonalStats=['mean', 'stdev'])('/home/douglas/Música/musicas/wav/tristes/'+music)

    # See all feature names in the pool in a sorted order
    print(music, features['lowlevel.spectral_flux.mean'])
    lista.append(features['lowlevel.spectral_flux.mean'])

arq = open('/home/douglas/Documentos/tcc_code/resultado/resultados_tristes.csv','r')
musics = arq.readlines()
arq.close()


count=0
arq = open('/home/douglas/Documentos/tcc_code/resultado/resultados_tristes.csv','w')
for m in musics:
    music, erro = m.split("\n",1)
github scherroman / mugen / mugen / audio / audio.py View on Github external
def get_beat_stats(audio_file):
    """
    Extracts beat locations and intervals from an audio file
    """
    print("Processing audio beat patterns...")

    # Load audio
    audio = a_util.load_audio(audio_file)
    
    # Get beat stats from audio
    rhythm_extractor = essentia.standard.RhythmExtractor2013()
    duration_extractor = essentia.standard.Duration()

    rhythm = rhythm_extractor(audio)
    duration = duration_extractor(audio)
    beat_intervals = rhythm[4]

    # Fill in start and end intervals
    start_interval = rhythm[1][0]
    end_interval = duration - rhythm[1][len(rhythm[1]) - 1]
    beat_intervals = np.concatenate([[start_interval], beat_intervals, [end_interval]])
   
    beat_stats = {'bpm':rhythm[0], 'beat_locations':rhythm[1], 'bpm_estimates':rhythm[3], 
                  'beat_intervals':beat_intervals}

    logging.debug("\n")
    logging.debug("Beats per minute: {}".format(pprint.pformat(beat_stats['bpm'])))
    logging.debug("Beat locations: {}".format(pprint.pformat(beat_stats['beat_locations'].tolist())))