xscore_gen.md, cmtools.c : Update notes and added 'damper' report flag.

This commit is contained in:
kevin 2020-08-03 12:13:11 -04:00
parent 63991ae469
commit b5fcaaa09a
2 changed files with 36 additions and 22 deletions

View File

@ -89,10 +89,17 @@ of measured notes. Note that a decremented color stops all active measures
not just the measurement associated with the decremented color. not just the measurement associated with the decremented color.
### Section Numbering
Rectangles around a number indicate sections numbers.
Sections are used to aggregate measurements and to
indicate where particular transforms will be applied in the electronic score.
Preparing the Music XML File Preparing the Music XML File
---------------------------- ----------------------------
*xscore_gen* is know to work with the MusicXML files produced by *xscore_gen* is known to work with the MusicXML files produced by
the [Dolet 6 Sibelius plug-in]<https://www.musicxml.com/> the [Dolet 6 Sibelius plug-in]<https://www.musicxml.com/>
After generating the file it is necessary to do some After generating the file it is necessary to do some
@ -100,12 +107,30 @@ minor pre-processing before submitting it to *xscore_gen*
iconv -f UTF-16 -t UTF-8 -o score-utf16.xml score-utf8.xml iconv -f UTF-16 -t UTF-8 -o score-utf16.xml score-utf8.xml
On the first line of score-utf8.xml change:
```
<?xml version='1.0' encoding='UTF-16' standalone='no'?>
```
to
```
<?xml version='1.0' encoding='UTF-8' standalone='no'?>
```
Note that naively opening `score-utf8.xml` with emacs will
crash emacs because the stated XML file encoding `encoding='UTF-16'`
will not match the actual file encoding (UTF-8). Work around
this problem by editing the first line with `vi`.
Create the decoration file Create the decoration file
-------------------------- --------------------------
``` ```
cmtools --score_gen -x myscore.xml -d mydec.txt cmtools --score_gen -x myscore.xml -d mydec.txt {--damper}
``` ```
Here's a snippet of a typical 'decoration' file. Here's a snippet of a typical 'decoration' file.

View File

@ -103,13 +103,13 @@ bool verify_non_null_filename( cmCtx_t* ctx, const cmChar_t* fn, const cmChar_t*
return kOkCtRC; return kOkCtRC;
} }
cmRC_t score_gen( cmCtx_t* ctx, const cmChar_t* xmlFn, const cmChar_t* decFn, const cmChar_t* csvOutFn, const cmChar_t* midiOutFn, const cmChar_t* svgOutFn, unsigned reportFl, int begMeasNumb, int begTempoBPM, bool svgStandAloneFl, bool svgPanZoomFl ) cmRC_t score_gen( cmCtx_t* ctx, const cmChar_t* xmlFn, const cmChar_t* decFn, const cmChar_t* csvOutFn, const cmChar_t* midiOutFn, const cmChar_t* svgOutFn, unsigned reportFl, int begMeasNumb, int begTempoBPM, bool svgStandAloneFl, bool svgPanZoomFl, bool damperRptFl )
{ {
cmRC_t rc; cmRC_t rc;
if((rc = verify_file_exists(ctx,xmlFn,"XML file")) != kOkCtRC ) if((rc = verify_file_exists(ctx,xmlFn,"XML file")) != kOkCtRC )
return rc; return rc;
if( cmXScoreTest( ctx, xmlFn, decFn, csvOutFn, midiOutFn, svgOutFn, reportFl, begMeasNumb, begTempoBPM, svgStandAloneFl, svgPanZoomFl ) != kOkXsRC ) if( cmXScoreTest( ctx, xmlFn, decFn, csvOutFn, midiOutFn, svgOutFn, reportFl, begMeasNumb, begTempoBPM, svgStandAloneFl, svgPanZoomFl, damperRptFl ) != kOkXsRC )
return cmErrMsg(&ctx->err,kScoreGenFailedCtRC,"score_gen failed."); return cmErrMsg(&ctx->err,kScoreGenFailedCtRC,"score_gen failed.");
return kOkCtRC; return kOkCtRC;
@ -206,16 +206,6 @@ cmRC_t audio_file_report( cmCtx_t* ctx, const cmChar_t* audioFn, const cmChar_t*
return rc; return rc;
} }
cmRC_t midi_trim(cmCtx_t* ctx, const cmChar_t* midiInFn, unsigned begMidiUId, unsigned endMidiUId, const cmChar_t* midiOutFn)
{
cmRC_t rc;
if((rc = verify_file_exists(ctx,midiInFn,"MIDI file")) != kOkCtRC )
return rc;
// kNoteTerminateFl | kPedalTerminateFl
return cmMidiFileTrimFn(ctx, midiInFn, begMidiUId, endMidiUId, 0, midiOutFn );
}
int main( int argc, char* argv[] ) int main( int argc, char* argv[] )
{ {
@ -240,6 +230,7 @@ int main( int argc, char* argv[] )
kSvgPanZoomFlPoId, kSvgPanZoomFlPoId,
kBegMeasPoId, kBegMeasPoId,
kBegBpmPoId, kBegBpmPoId,
kDamperRptPoId,
kBegMidiUidPoId, kBegMidiUidPoId,
kEndMidiUidPoId kEndMidiUidPoId
}; };
@ -252,8 +243,7 @@ int main( int argc, char* argv[] )
kScoreReportSelId, kScoreReportSelId,
kMidiReportSelId, kMidiReportSelId,
kTimelineReportSelId, kTimelineReportSelId,
kAudioReportSelId, kAudioReportSelId
kMidiTrimSelId
}; };
@ -281,6 +271,7 @@ int main( int argc, char* argv[] )
unsigned svgPanZoomFl = 1; unsigned svgPanZoomFl = 1;
int begMeasNumb = 0; int begMeasNumb = 0;
int begTempoBPM = 60; int begTempoBPM = 60;
unsigned damperRptFl = 0;
unsigned begMidiUId = cmInvalidId; unsigned begMidiUId = cmInvalidId;
unsigned endMidiUId = cmInvalidId; unsigned endMidiUId = cmInvalidId;
unsigned actionSelId = kNoSelId; unsigned actionSelId = kNoSelId;
@ -316,8 +307,6 @@ int main( int argc, char* argv[] )
cmPgmOptInstallEnum( poH, kActionPoId, 'A', "audio_report", 0, kAudioReportSelId, kNoSelId, &actionSelId, 1, cmPgmOptInstallEnum( poH, kActionPoId, 'A', "audio_report", 0, kAudioReportSelId, kNoSelId, &actionSelId, 1,
"Generate an audio file report.",NULL); "Generate an audio file report.",NULL);
cmPgmOptInstallEnum( poH, kActionPoId, 'T', "midi_trim", 0, kMidiTrimSelId, kNoSelId, &actionSelId, 1,
"Trim a MIDI file to create a shortened version.",NULL);
cmPgmOptInstallStr( poH, kXmlFileNamePoId, 'x', "muisic_xml_fn",0, NULL, &xmlFn, 1, cmPgmOptInstallStr( poH, kXmlFileNamePoId, 'x', "muisic_xml_fn",0, NULL, &xmlFn, 1,
"Name of the input MusicXML file."); "Name of the input MusicXML file.");
@ -361,6 +350,9 @@ int main( int argc, char* argv[] )
cmPgmOptInstallInt( poH, kBegBpmPoId, 'e', "beg_bpm", 0, 0, &begTempoBPM, 1, cmPgmOptInstallInt( poH, kBegBpmPoId, 'e', "beg_bpm", 0, 0, &begTempoBPM, 1,
"Set to 0 to use the tempo from the score otherwise set to use the tempo at begMeasNumb." ); "Set to 0 to use the tempo from the score otherwise set to use the tempo at begMeasNumb." );
cmPgmOptInstallFlag( poH, kDamperRptPoId, 'p', "damper", 0, 1, &damperRptFl, 1,
"Print the pedal events during 'score_gen' processing.");
cmPgmOptInstallFlag( poH, kSvgStandAloneFlPoId, 'n', "svg_stand_alone_fl",0, 1, &svgStandAloneFl, 1, cmPgmOptInstallFlag( poH, kSvgStandAloneFlPoId, 'n', "svg_stand_alone_fl",0, 1, &svgStandAloneFl, 1,
"Write the SVG file as a stand alone HTML file. Enabled by default." ); "Write the SVG file as a stand alone HTML file. Enabled by default." );
@ -384,7 +376,7 @@ int main( int argc, char* argv[] )
switch( actionSelId ) switch( actionSelId )
{ {
case kScoreGenSelId: case kScoreGenSelId:
rc = score_gen( &ctx, xmlFn, decFn, csvScoreFn, midiOutFn, svgOutFn, reportFl, begMeasNumb, begTempoBPM, svgStandAloneFl, svgPanZoomFl ); rc = score_gen( &ctx, xmlFn, decFn, csvScoreFn, midiOutFn, svgOutFn, reportFl, begMeasNumb, begTempoBPM, svgStandAloneFl, svgPanZoomFl, damperRptFl );
break; break;
case kScoreFollowSelId: case kScoreFollowSelId:
@ -411,9 +403,6 @@ int main( int argc, char* argv[] )
rc = audio_file_report(&ctx, audioFn, rptFn ); rc = audio_file_report(&ctx, audioFn, rptFn );
break; break;
case kMidiTrimSelId:
rc = midi_trim(&ctx, midiInFn, begMidiUId, endMidiUId, midiOutFn);
break;
default: default:
rc = cmErrMsg(&ctx.err, kNoActionIdSelectedCtRC,"No action selector was selected."); rc = cmErrMsg(&ctx.err, kNoActionIdSelectedCtRC,"No action selector was selected.");