source: main/trunk/model-sites-dev/mars/collect/amc-essentia/AUDIO-TO-ESSENTIA-CSV-FEATURE-FILE.pl--DEPRECATED@ 34772

Last change on this file since 34772 was 34772, checked in by davidb, 3 years ago

deprecated for this collection -- superceeded by AUDIO-FRAME-TO-ESSENTIA-CSV-FEATURE-FILE.pl

  • Property svn:executable set to *
File size: 2.0 KB
Line 
1#!/usr/bin/env perl
2
3use strict;
4use warnings;
5
6# Perl equiv to Bash script of the same name
7
8# ****
9# The only change to this file (from the DEAM version)
10# is to add on '_essentiafeatures' to the root filename used
11
12use Cwd qw(cwd getcwd);
13
14if (scalar(@ARGV) != 1) {
15 print STDERR "****\n";
16 print STDERR "* Error: incorrect usage\n";
17 print STDERR "* Usage: $0 audio_input_file\n";
18 print STDERR "****\n";
19 exit(1);
20}
21
22my $audio_file = $ARGV[0];
23
24my ($audio_root) = ($audio_file =~ m/^(.*)\..+?$/);
25
26my $json_file = "${audio_root}_essentiafeatures.json";
27my $csv_file = "${audio_root}_essentiafeatures.csv";
28
29my $pwd = cwd();
30my $profile_file = "$pwd/essentia-2013-2014.profile";
31
32# knock out any arrays in the JSON extracted features file
33my $ignore_fields="\
34 lowlevel.barkbands.* \
35 lowlevel.erbbands.* \
36 lowlevel.gfcc.* \
37 lowlevel.melbands.* \
38 lowlevel.melbands128.* \
39 lowlevel.mfcc.* \
40\
41 lowlevel.spectral_contrast_coeffs.* \
42 lowlevel.spectral_contrast_valleys.* \
43\
44 metadata.* \
45\
46 rhythm.beats_loudness_band_ratio.* \
47 rhythm.beats_position.* \
48 rhythm.bpm_histogram.* \
49\
50 tonal.hpcp.* \
51 tonal.chords_histogram.* \
52 tonal.thpcp.*";
53
54$ignore_fields =~ s/\n//sg;
55
56if ( ! -f $json_file ) {
57
58 print "******\n";
59 print "* Running Essentia music extractor\n";
60 print "* on input file: $audio_file\n";
61 print "* with profile: $profile_file\n";
62 print "* generating output: $json_file\n";
63 print "****\n";
64 system("essentia_streaming_extractor_music $audio_file $json_file $profile_file");
65
66 print "*\n";
67 print "******\n";
68
69}
70else {
71 print "* Skipping extraction of JSON features as $json_file already exists\n";
72}
73
74if ( ! -f $csv_file ) {
75
76 print "******\n";
77 print "* Running Essentia JSON to CSV convertor on $json_file\n";
78
79 system("json_to_csv.py -i $json_file -o $csv_file --add-filename --ignore $ignore_fields");
80 print "******\n";
81}
82else {
83 print "* Skipping JSON to CSV conversion as $csv_file already exists\n";
84}
85
86
87
Note: See TracBrowser for help on using the repository browser.