Skip to content

Instantly share code, notes, and snippets.

@ibaaj
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ibaaj/9794758 to your computer and use it in GitHub Desktop.
Save ibaaj/9794758 to your computer and use it in GitHub Desktop.
Parsing essentia yaml export - find . -name "*.yaml" -exec node conv.js {} \;
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