Last active
August 29, 2015 13:57
-
-
Save ibaaj/9794758 to your computer and use it in GitHub Desktop.
Parsing essentia yaml export - find . -name "*.yaml" -exec node conv.js {} \;
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
yaml = require('js-yaml'); | |
fs = require('fs'); | |
try { | |
var doc = yaml.safeLoad(fs.readFileSync(process.argv[2], 'utf8')); | |
var nLine = process.argv[2] + ',' | |
+ doc.metadata.audio_properties.length + ',' | |
+ doc.rhythm.bpm + ',' | |
+ doc.tonal.chords_changes_rate + ',' | |
+ doc.tonal.tuning_frequency + ',' | |
+ doc.tonal.chords_key + ',' | |
+ doc.tonal.chords_scale | |
+ "\n"; | |
console.log("parsing " + process.argv[2] + "done..."); | |
fs.appendFile('1.csv', nLine, function (err) { | |
console.log(err); | |
}); | |
console.log("writing " + process.argv[2] + "done, goodbye!"); | |
} catch (e) { | |
console.log(e); | |
} | |
/** | |
* CSV file contains | |
* CSV file contains Nom,Duree,Bpm,Chords_changes_rate,Tuning_frequency,Chords_key,Chords_scale | |
* | |
**/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment