f@0: library(dplyr) f@0: library(tidyr) f@0: f@0: feats_mode <- 'filtered_fb' f@0: f@0: feats_path <- paste0('~/Repositories/research/datasets/features/gtzan/', f@0: feats_mode, '/essentia/') f@0: f@0: essentia_feats <- read.csv( f@0: file = paste0(feats_path, 'feats_essentia.csv') f@0: ) f@0: essentia_feats <- essentia_feats %>% f@0: separate(json_file_name, c('a', 'b', 'file'), sep = '/') %>% f@0: select(-a, -b) %>% f@0: separate(file, c('gt'), extra = 'drop') %>% f@0: mutate(ex_id = 1:nrow(essentia_feats)) %>% f@0: select(ex_id, gt, everything()) f@0: f@0: f@0: lowlevel <- essentia_feats %>% f@0: select(ex_id, gt, f@0: starts_with('lowlevel')) f@0: rhythm <- essentia_feats %>% f@0: select(ex_id, gt, f@0: starts_with('rhythm')) f@0: tonal <- essentia_feats %>% f@0: select(ex_id, gt, f@0: starts_with('tonal')) %>% f@0: mutate( f@0: tonal.chords_scale = as.numeric(tonal.chords_scale), f@0: tonal.chords_key = as.numeric(tonal.chords_key), f@0: tonal.key_key = as.numeric(tonal.key_key), f@0: tonal.key_scale = as.numeric(tonal.key_scale)) f@0: f@0: timbre_dynamics <- lowlevel %>% f@0: select(ex_id, gt, f@0: contains('loudness'), f@0: contains('silence'), f@0: contains('spectral'), f@0: contains('complexity'), f@0: contains('hfc'), f@0: contains('zerocrossingrate'), f@0: contains('dissonance'), f@0: contains('salience')) f@0: mfcc <- lowlevel %>% f@0: select(ex_id, gt, f@0: contains('mfcc')) f@0: gfcc <- lowlevel %>% f@0: select(ex_id, gt, f@0: contains('gfcc')) f@0: barkbands <- lowlevel %>% f@0: select(ex_id, gt, f@0: contains('barkbands')) f@0: melbands <- lowlevel %>% f@0: select(ex_id, gt, f@0: contains('melbands')) f@0: erbbands <- lowlevel %>% f@0: select(ex_id, gt, f@0: contains('erbbands')) f@0: f@0: write.csv(x = rhythm, f@0: file = paste0(feats_path, 'essentia_rhythm.csv'), f@0: row.names = F) f@0: write.csv(x = tonal, f@0: file = paste0(feats_path, 'essentia_tonal.csv'), f@0: row.names = F) f@0: write.csv(x = timbre_dynamics, f@0: file = paste0(feats_path, 'essentia_timbre_dynamics.csv'), f@0: row.names = F) f@0: write.csv(x = mfcc, f@0: file = paste0(feats_path, 'essentia_mfcc.csv'), f@0: row.names = F) f@0: write.csv(x = gfcc, f@0: file = paste0(feats_path, 'essentia_gfcc.csv'), f@0: row.names = F) f@0: write.csv(x = barkbands, f@0: file = paste0(feats_path, 'essentia_barkbands.csv'), f@0: row.names = F) f@0: write.csv(x = melbands, f@0: file = paste0(feats_path, 'essentia_melbands.csv'), f@0: row.names = F) f@0: write.csv(x = erbbands, f@0: file = paste0(feats_path, 'essentia_erbbands.csv'), f@0: row.names = F)