Mercurial > hg > sonic-annotator
diff runner/MIDIFeatureWriter.cpp @ 196:082c3f21f49e
Simple MIDI writer test
author | Chris Cannam |
---|---|
date | Tue, 01 Sep 2015 15:51:07 +0100 |
parents | 977b7007071f |
children | 3b7ec45abd1c |
line wrap: on
line diff
--- a/runner/MIDIFeatureWriter.cpp Wed Aug 26 21:46:52 2015 +0100 +++ b/runner/MIDIFeatureWriter.cpp Tue Sep 01 15:51:07 2015 +0100 @@ -22,6 +22,8 @@ #include "base/Exceptions.h" #include "data/fileio/MIDIFileWriter.h" +//#define DEBUG_MIDI_FEATURE_WRITER 1 + MIDIFeatureWriter::MIDIFeatureWriter() : FileFeatureWriter(SupportOneFilePerTrackTransform | SupportOneFilePerTrack | @@ -37,7 +39,7 @@ string MIDIFeatureWriter::getDescription() const { - return "Write features to MIDI files. All features are written as MIDI notes. If a feature has at least one value, its first value will be used as the note pitch, the second value (if present) for velocity. If a feature has units of Hz, then its pitch will be converted from frequency to an integer value in MIDI range, otherwise it will be written directly. Multiple (up to 16) transforms can be written to a single MIDI file, where they will be given separate MIDI channel numbers."; + return "Write features to MIDI files. All features are written as MIDI notes. If a feature has at least one value, its first value will be used as the note pitch, the second value (if present) for velocity. If a feature has units of Hz, then its pitch will be converted from frequency to an integer value in MIDI range, otherwise it will simply be rounded to the nearest integer and written directly. Multiple (up to 16) transforms can be written to a single MIDI file, where they will be given separate MIDI channel numbers."; } MIDIFeatureWriter::ParameterList @@ -108,6 +110,11 @@ if (feature.hasDuration) { duration = Vamp::RealTime::realTime2Frame(feature.duration, sampleRate); } + +#ifdef DEBUG_MIDI_FEATURE_WRITER + cerr << "feature timestamp = " << feature.timestamp << ", sampleRate = " << sampleRate << ", frame = " << frame << endl; + cerr << "feature duration = " << feature.duration << ", sampleRate = " << sampleRate << ", duration = " << duration << endl; +#endif int pitch = 60; if (feature.values.size() > 0) {