Mercurial > hg > confint
view ext/essentia.R @ 0:205974c9568c tip
Initial commit. Predictions not included for lack of space.
author | franrodalg <f.rodriguezalgarra@qmul.ac.uk> |
---|---|
date | Sat, 29 Jun 2019 18:45:50 +0100 |
parents | |
children |
line wrap: on
line source
library(dplyr) library(tidyr) feats_mode <- 'filtered_fb' feats_path <- paste0('~/Repositories/research/datasets/features/gtzan/', feats_mode, '/essentia/') essentia_feats <- read.csv( file = paste0(feats_path, 'feats_essentia.csv') ) essentia_feats <- essentia_feats %>% separate(json_file_name, c('a', 'b', 'file'), sep = '/') %>% select(-a, -b) %>% separate(file, c('gt'), extra = 'drop') %>% mutate(ex_id = 1:nrow(essentia_feats)) %>% select(ex_id, gt, everything()) lowlevel <- essentia_feats %>% select(ex_id, gt, starts_with('lowlevel')) rhythm <- essentia_feats %>% select(ex_id, gt, starts_with('rhythm')) tonal <- essentia_feats %>% select(ex_id, gt, starts_with('tonal')) %>% mutate( tonal.chords_scale = as.numeric(tonal.chords_scale), tonal.chords_key = as.numeric(tonal.chords_key), tonal.key_key = as.numeric(tonal.key_key), tonal.key_scale = as.numeric(tonal.key_scale)) timbre_dynamics <- lowlevel %>% select(ex_id, gt, contains('loudness'), contains('silence'), contains('spectral'), contains('complexity'), contains('hfc'), contains('zerocrossingrate'), contains('dissonance'), contains('salience')) mfcc <- lowlevel %>% select(ex_id, gt, contains('mfcc')) gfcc <- lowlevel %>% select(ex_id, gt, contains('gfcc')) barkbands <- lowlevel %>% select(ex_id, gt, contains('barkbands')) melbands <- lowlevel %>% select(ex_id, gt, contains('melbands')) erbbands <- lowlevel %>% select(ex_id, gt, contains('erbbands')) write.csv(x = rhythm, file = paste0(feats_path, 'essentia_rhythm.csv'), row.names = F) write.csv(x = tonal, file = paste0(feats_path, 'essentia_tonal.csv'), row.names = F) write.csv(x = timbre_dynamics, file = paste0(feats_path, 'essentia_timbre_dynamics.csv'), row.names = F) write.csv(x = mfcc, file = paste0(feats_path, 'essentia_mfcc.csv'), row.names = F) write.csv(x = gfcc, file = paste0(feats_path, 'essentia_gfcc.csv'), row.names = F) write.csv(x = barkbands, file = paste0(feats_path, 'essentia_barkbands.csv'), row.names = F) write.csv(x = melbands, file = paste0(feats_path, 'essentia_melbands.csv'), row.names = F) write.csv(x = erbbands, file = paste0(feats_path, 'essentia_erbbands.csv'), row.names = F)