Browse Source

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

master
kevin 3 years ago
parent
commit
b5fcaaa09a
2 changed files with 36 additions and 22 deletions
  1. 27
    2
      doc/xscore_gen.md
  2. 9
    20
      src/cmtools/cmtools.c

+ 27
- 2
doc/xscore_gen.md View File

@@ -89,10 +89,17 @@ of measured notes.  Note that a decremented color stops all active measures
89 89
 not just the measurement associated with the decremented color.  
90 90
 
91 91
 
92
+### Section Numbering
93
+
94
+Rectangles around a number indicate sections numbers.
95
+Sections are used to aggregate measurements and to 
96
+indicate where particular transforms will be applied in the electronic score.
97
+
98
+
92 99
 Preparing the Music XML File
93 100
 ----------------------------
94 101
 
95
-*xscore_gen* is know to work with the MusicXML files produced by
102
+*xscore_gen* is known to work with the MusicXML files produced by
96 103
 the [Dolet 6 Sibelius plug-in]<https://www.musicxml.com/>
97 104
 
98 105
 After generating the file it is necessary to do some
@@ -100,12 +107,30 @@ minor pre-processing before submitting it to *xscore_gen*
100 107
 
101 108
 iconv -f UTF-16 -t UTF-8 -o score-utf16.xml score-utf8.xml
102 109
 
110
+On the first line of score-utf8.xml change:
111
+
112
+```
113
+<?xml version='1.0' encoding='UTF-16' standalone='no'?>
114
+```
115
+
116
+to 
117
+
118
+```
119
+<?xml version='1.0' encoding='UTF-8' standalone='no'?>
120
+```
121
+
122
+Note that naively opening `score-utf8.xml` with emacs will
123
+crash emacs because the stated XML file encoding `encoding='UTF-16'`
124
+will not match the actual file encoding (UTF-8).  Work around
125
+this problem by editing the first line with `vi`.
126
+
127
+
103 128
 
104 129
 Create the decoration file
105 130
 --------------------------
106 131
 
107 132
 ```
108
-cmtools --score_gen -x myscore.xml -d mydec.txt
133
+cmtools --score_gen -x myscore.xml -d mydec.txt {--damper}
109 134
 ```
110 135
 
111 136
 Here's a snippet of a typical 'decoration' file.

+ 9
- 20
src/cmtools/cmtools.c View File

@@ -103,13 +103,13 @@ bool verify_non_null_filename( cmCtx_t* ctx, const cmChar_t* fn, const cmChar_t*
103 103
   return kOkCtRC;
104 104
 }
105 105
 
106
-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 )
106
+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 )
107 107
 {
108 108
   cmRC_t rc;
109 109
   if((rc = verify_file_exists(ctx,xmlFn,"XML file")) != kOkCtRC )
110 110
     return rc;
111 111
   
112
-  if( cmXScoreTest( ctx, xmlFn, decFn, csvOutFn, midiOutFn, svgOutFn, reportFl, begMeasNumb, begTempoBPM, svgStandAloneFl, svgPanZoomFl ) != kOkXsRC )
112
+  if( cmXScoreTest( ctx, xmlFn, decFn, csvOutFn, midiOutFn, svgOutFn, reportFl, begMeasNumb, begTempoBPM, svgStandAloneFl, svgPanZoomFl, damperRptFl ) != kOkXsRC )
113 113
     return cmErrMsg(&ctx->err,kScoreGenFailedCtRC,"score_gen failed.");
114 114
     
115 115
   return kOkCtRC;
@@ -206,16 +206,6 @@ cmRC_t audio_file_report( cmCtx_t* ctx, const cmChar_t* audioFn, const cmChar_t*
206 206
   return rc;
207 207
 }
208 208
 
209
-cmRC_t  midi_trim(cmCtx_t* ctx, const cmChar_t* midiInFn, unsigned begMidiUId, unsigned endMidiUId, const cmChar_t* midiOutFn)
210
-{
211
-  cmRC_t rc;
212
-  
213
-  if((rc = verify_file_exists(ctx,midiInFn,"MIDI file")) != kOkCtRC )
214
-    return rc;
215
-  // kNoteTerminateFl | kPedalTerminateFl
216
-  return cmMidiFileTrimFn(ctx,  midiInFn, begMidiUId, endMidiUId, 0, midiOutFn );
217
-}
218
-
219 209
 
220 210
 int main( int argc, char* argv[] )
221 211
 {
@@ -240,6 +230,7 @@ int main( int argc, char* argv[] )
240 230
    kSvgPanZoomFlPoId,
241 231
    kBegMeasPoId,
242 232
    kBegBpmPoId,
233
+   kDamperRptPoId,
243 234
    kBegMidiUidPoId,
244 235
    kEndMidiUidPoId
245 236
   };
@@ -252,8 +243,7 @@ int main( int argc, char* argv[] )
252 243
         kScoreReportSelId,
253 244
         kMidiReportSelId,
254 245
         kTimelineReportSelId,
255
-        kAudioReportSelId,
256
-        kMidiTrimSelId
246
+        kAudioReportSelId
257 247
   };
258 248
     
259 249
   
@@ -281,6 +271,7 @@ int main( int argc, char* argv[] )
281 271
   unsigned        svgPanZoomFl    = 1;
282 272
   int             begMeasNumb     = 0;
283 273
   int             begTempoBPM     = 60;
274
+  unsigned        damperRptFl     = 0;
284 275
   unsigned        begMidiUId      = cmInvalidId;
285 276
   unsigned        endMidiUId      = cmInvalidId;
286 277
   unsigned        actionSelId     = kNoSelId;
@@ -316,8 +307,6 @@ int main( int argc, char* argv[] )
316 307
   cmPgmOptInstallEnum( poH, kActionPoId, 'A', "audio_report",    0, kAudioReportSelId, kNoSelId,  &actionSelId, 1,
317 308
     "Generate an audio file report.",NULL);
318 309
 
319
-  cmPgmOptInstallEnum( poH, kActionPoId, 'T', "midi_trim",       0, kMidiTrimSelId, kNoSelId,  &actionSelId, 1,
320
-    "Trim a MIDI file to create a shortened version.",NULL);
321 310
   
322 311
   cmPgmOptInstallStr( poH, kXmlFileNamePoId,      'x', "muisic_xml_fn",0,    NULL,         &xmlFn,        1, 
323 312
     "Name of the input MusicXML file.");
@@ -361,6 +350,9 @@ int main( int argc, char* argv[] )
361 350
   cmPgmOptInstallInt( poH, kBegBpmPoId,           'e', "beg_bpm",      0,       0,          &begTempoBPM,  1,
362 351
     "Set to 0 to use the tempo from the score otherwise set to use the tempo at begMeasNumb." );
363 352
 
353
+  cmPgmOptInstallFlag( poH, kDamperRptPoId,        'p', "damper",       0,      1,          &damperRptFl,  1,
354
+    "Print the pedal events during 'score_gen' processing.");
355
+
364 356
   cmPgmOptInstallFlag( poH, kSvgStandAloneFlPoId,  'n', "svg_stand_alone_fl",0, 1,          &svgStandAloneFl, 1,
365 357
     "Write the SVG file as a stand alone HTML file. Enabled by default." );
366 358
 
@@ -384,7 +376,7 @@ int main( int argc, char* argv[] )
384 376
     switch( actionSelId )
385 377
     {
386 378
       case kScoreGenSelId:
387
-        rc = score_gen( &ctx, xmlFn, decFn, csvScoreFn, midiOutFn, svgOutFn, reportFl, begMeasNumb, begTempoBPM, svgStandAloneFl, svgPanZoomFl );
379
+        rc = score_gen( &ctx, xmlFn, decFn, csvScoreFn, midiOutFn, svgOutFn, reportFl, begMeasNumb, begTempoBPM, svgStandAloneFl, svgPanZoomFl, damperRptFl );
388 380
         break;
389 381
 
390 382
       case kScoreFollowSelId:
@@ -411,9 +403,6 @@ int main( int argc, char* argv[] )
411 403
         rc = audio_file_report(&ctx, audioFn, rptFn );
412 404
         break;
413 405
 
414
-      case kMidiTrimSelId:
415
-        rc = midi_trim(&ctx, midiInFn, begMidiUId, endMidiUId, midiOutFn);
416
-        break;
417 406
         
418 407
       default:
419 408
         rc = cmErrMsg(&ctx.err, kNoActionIdSelectedCtRC,"No action selector was selected.");

Loading…
Cancel
Save