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
 not just the measurement associated with the decremented color.  
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
 Preparing the Music XML File
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
 the [Dolet 6 Sibelius plug-in]<https://www.musicxml.com/>
103
 the [Dolet 6 Sibelius plug-in]<https://www.musicxml.com/>
97
 
104
 
98
 After generating the file it is necessary to do some
105
 After generating the file it is necessary to do some
100
 
107
 
101
 iconv -f UTF-16 -t UTF-8 -o score-utf16.xml score-utf8.xml
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
 Create the decoration file
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
 Here's a snippet of a typical 'decoration' file.
136
 Here's a snippet of a typical 'decoration' file.

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

103
   return kOkCtRC;
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
   cmRC_t rc;
108
   cmRC_t rc;
109
   if((rc = verify_file_exists(ctx,xmlFn,"XML file")) != kOkCtRC )
109
   if((rc = verify_file_exists(ctx,xmlFn,"XML file")) != kOkCtRC )
110
     return rc;
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
     return cmErrMsg(&ctx->err,kScoreGenFailedCtRC,"score_gen failed.");
113
     return cmErrMsg(&ctx->err,kScoreGenFailedCtRC,"score_gen failed.");
114
     
114
     
115
   return kOkCtRC;
115
   return kOkCtRC;
206
   return rc;
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
 int main( int argc, char* argv[] )
210
 int main( int argc, char* argv[] )
221
 {
211
 {
240
    kSvgPanZoomFlPoId,
230
    kSvgPanZoomFlPoId,
241
    kBegMeasPoId,
231
    kBegMeasPoId,
242
    kBegBpmPoId,
232
    kBegBpmPoId,
233
+   kDamperRptPoId,
243
    kBegMidiUidPoId,
234
    kBegMidiUidPoId,
244
    kEndMidiUidPoId
235
    kEndMidiUidPoId
245
   };
236
   };
252
         kScoreReportSelId,
243
         kScoreReportSelId,
253
         kMidiReportSelId,
244
         kMidiReportSelId,
254
         kTimelineReportSelId,
245
         kTimelineReportSelId,
255
-        kAudioReportSelId,
256
-        kMidiTrimSelId
246
+        kAudioReportSelId
257
   };
247
   };
258
     
248
     
259
   
249
   
281
   unsigned        svgPanZoomFl    = 1;
271
   unsigned        svgPanZoomFl    = 1;
282
   int             begMeasNumb     = 0;
272
   int             begMeasNumb     = 0;
283
   int             begTempoBPM     = 60;
273
   int             begTempoBPM     = 60;
274
+  unsigned        damperRptFl     = 0;
284
   unsigned        begMidiUId      = cmInvalidId;
275
   unsigned        begMidiUId      = cmInvalidId;
285
   unsigned        endMidiUId      = cmInvalidId;
276
   unsigned        endMidiUId      = cmInvalidId;
286
   unsigned        actionSelId     = kNoSelId;
277
   unsigned        actionSelId     = kNoSelId;
316
   cmPgmOptInstallEnum( poH, kActionPoId, 'A', "audio_report",    0, kAudioReportSelId, kNoSelId,  &actionSelId, 1,
307
   cmPgmOptInstallEnum( poH, kActionPoId, 'A', "audio_report",    0, kAudioReportSelId, kNoSelId,  &actionSelId, 1,
317
     "Generate an audio file report.",NULL);
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
   cmPgmOptInstallStr( poH, kXmlFileNamePoId,      'x', "muisic_xml_fn",0,    NULL,         &xmlFn,        1, 
311
   cmPgmOptInstallStr( poH, kXmlFileNamePoId,      'x', "muisic_xml_fn",0,    NULL,         &xmlFn,        1, 
323
     "Name of the input MusicXML file.");
312
     "Name of the input MusicXML file.");
361
   cmPgmOptInstallInt( poH, kBegBpmPoId,           'e', "beg_bpm",      0,       0,          &begTempoBPM,  1,
350
   cmPgmOptInstallInt( poH, kBegBpmPoId,           'e', "beg_bpm",      0,       0,          &begTempoBPM,  1,
362
     "Set to 0 to use the tempo from the score otherwise set to use the tempo at begMeasNumb." );
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
   cmPgmOptInstallFlag( poH, kSvgStandAloneFlPoId,  'n', "svg_stand_alone_fl",0, 1,          &svgStandAloneFl, 1,
356
   cmPgmOptInstallFlag( poH, kSvgStandAloneFlPoId,  'n', "svg_stand_alone_fl",0, 1,          &svgStandAloneFl, 1,
365
     "Write the SVG file as a stand alone HTML file. Enabled by default." );
357
     "Write the SVG file as a stand alone HTML file. Enabled by default." );
366
 
358
 
384
     switch( actionSelId )
376
     switch( actionSelId )
385
     {
377
     {
386
       case kScoreGenSelId:
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
         break;
380
         break;
389
 
381
 
390
       case kScoreFollowSelId:
382
       case kScoreFollowSelId:
411
         rc = audio_file_report(&ctx, audioFn, rptFn );
403
         rc = audio_file_report(&ctx, audioFn, rptFn );
412
         break;
404
         break;
413
 
405
 
414
-      case kMidiTrimSelId:
415
-        rc = midi_trim(&ctx, midiInFn, begMidiUId, endMidiUId, midiOutFn);
416
-        break;
417
         
406
         
418
       default:
407
       default:
419
         rc = cmErrMsg(&ctx.err, kNoActionIdSelectedCtRC,"No action selector was selected.");
408
         rc = cmErrMsg(&ctx.err, kNoActionIdSelectedCtRC,"No action selector was selected.");

Loading…
Cancel
Save