Browse Source

Misc. updates in preparation for publishing.

master
kevin 3 years ago
parent
commit
c69e0cee63
6 changed files with 108 additions and 25 deletions
  1. 2
    1
      Makefile.am
  2. 28
    3
      README.md
  3. 6
    6
      build/linux/debug/build.sh
  4. 9
    2
      configure.ac
  5. 4
    0
      doc/xscore_gen.md
  6. 59
    13
      src/cmtools/cmtools.c

+ 2
- 1
Makefile.am View File

5
 
5
 
6
 ACLOCAL_AMFLAGS = -I m4 # use custom macro's in ./m4 
6
 ACLOCAL_AMFLAGS = -I m4 # use custom macro's in ./m4 
7
 
7
 
8
+
8
 # if we are building and linking to a nested copy of libcm
9
 # if we are building and linking to a nested copy of libcm
9
 if BUILD_LIBCM
10
 if BUILD_LIBCM
10
-  SUBDIRS      = src/libcm  # causes recursive make into given sub-directories
11
+#  SUBDIRS      = src/libcm  # causes recursive make into given sub-directories
11
   AM_CPPFLAGS += -I$(srcdir)/src/libcm/src  -I$(srcdir)/src/libcm/src/dsp  -I$(srcdir)/src/libcm/src/vop  -I$(srcdir)/src/libcm/src/app
12
   AM_CPPFLAGS += -I$(srcdir)/src/libcm/src  -I$(srcdir)/src/libcm/src/dsp  -I$(srcdir)/src/libcm/src/vop  -I$(srcdir)/src/libcm/src/app
12
   AM_LDFLAGS  += -Lsrc/libcm/src
13
   AM_LDFLAGS  += -Lsrc/libcm/src
13
 endif
14
 endif

+ 28
- 3
README.md View File

219
 
219
 
220
 ```
220
 ```
221
 
221
 
222
+Score Merge
223
+===========
224
+
225
+Copy the manual edits from 'frag.txt' to the correct location, beginning with measure 284, in the blank edit file 'edit0.txt'.
226
+
227
+```
228
+cmootls  --merge_edit -d edit0.txt  -b 284 -k frag.txt -o temp.txt
229
+```
230
+
231
+All the events in 'frag.txt' may not be able to be located in 'edit0.txt'. Warning messages will be generated for
232
+each of these events.
233
+
234
+```
235
+XScore warning: Sync error: meas:301 18 index:7 8 A#4 (midi:70) edit:!mp+ (RC:14)
236
+XScore warning: Sync error: meas:322 39 index:32 33 C2 (midi:36) edit:!!PPP (RC:14)
237
+XScore warning: Sync error: meas:335 52 index:15 16 D4 (midi:62) edit:!ppp (RC:14)
238
+XScore warning: Sync error: meas:343 60 index:18 19 E5 (midi:76) edit:%%a !mf (RC:14)
239
+XScore warning: Sync error: meas:343 60 index:18 20 D4 (midi:62) edit:!fff (RC:14)
240
+XScore warning: Sync error: meas:343 60 index:18 21 F#4 (midi:66) edit:!fff (RC:14)
241
+XScore warning: Sync error: meas:343 60 index:18 22 G1 (midi:31) edit:!mp (RC:14)
242
+XScore warning: Sync error: meas:343 60 index:18 23 B1 (midi:35) edit:!ff (RC:14)
243
+XScore warning: Sync error: meas:350 67 index:51 54 F4 (midi:65) edit:!mf+ (RC:14)
244
+XScore warning: Sync error: meas:350 67 index:50 55 A#5 (midi:82) edit:!mf+ (RC:14)
245
+```
246
+
247
+
222
 MIDI File Reports
248
 MIDI File Reports
223
 =================
249
 =================
224
 
250
 
240
 Score Follow Report
266
 Score Follow Report
241
 ===================
267
 ===================
242
 
268
 
243
-```
244
-cmtool  --score_follow -c round2.csv -i new_round2.mid -r report.txt -s report_svg.html
245
- ```
269
+    cmtool  --score_follow -c round2.csv -i new_round2.mid -r report.txt -s report_svg.html
270
+ 
246
  
271
  
247
 SVG Description
272
 SVG Description
248
 ---------------
273
 ---------------

+ 6
- 6
build/linux/debug/build.sh View File

12
 # 2) Run the program. ./foo
12
 # 2) Run the program. ./foo
13
 # 3) Run gprof /libtool --mode=execute gprof ./foo
13
 # 3) Run gprof /libtool --mode=execute gprof ./foo
14
 
14
 
15
+# --enable-build_libcm - build libcm from local tree
16
+
15
 ../../../configure --prefix=${curdir} \
17
 ../../../configure --prefix=${curdir} \
16
-		   --enable-debug --enable-build_libcm \
18
+		   --enable-debug \
17
 		   CFLAGS="-g -Wall" \
19
 		   CFLAGS="-g -Wall" \
18
 		   CXXFLAGS="-g -Wall" \
20
 		   CXXFLAGS="-g -Wall" \
19
-		   LIBS=
20
-
21
-#		   CPPFLAGS="-I/home/kevin/src/libcm/build/linux/debug/include " \
22
-#		   LDFLAGS="-L/home/kevin/src/libcm/build/linux/debug/lib" \
23
-
21
+		   CPPFLAGS="-I/home/kevin/src/libcm/build/linux/debug/include " \
22
+		   LDFLAGS="-L/home/kevin/src/libcm/build/linux/debug/lib" 
23
+                   LIBS=
24
 #make
24
 #make
25
 #make install
25
 #make install

+ 9
- 2
configure.ac View File

44
 AC_FUNC_STRTOD
44
 AC_FUNC_STRTOD
45
 AC_CHECK_FUNCS([clock_gettime floor memmove memset mkdir pow rint select socket sqrt strcasecmp strchr strcspn strerror strspn strstr strtol])
45
 AC_CHECK_FUNCS([clock_gettime floor memmove memset mkdir pow rint select socket sqrt strcasecmp strchr strcspn strerror strspn strstr strtol])
46
 
46
 
47
+# check for he prerequisite libraries
48
+AC_CHECK_LIB([fftw3],[fftw_malloc],[AC_MSG_RESULT([The 'FFTW' library was found.])],[AC_MSG_ERROR([The 'FFTW' library was not found.])])
49
+AC_CHECK_LIB([asound],[snd_asoundlib_version],[AC_MSG_RESULT([The 'ALSA' library was found.])],[AC_MSG_ERROR([The 'ALSA' library was not found.])])
47
 
50
 
48
 # The following is a custom macro in ./m4/os_type.m4
51
 # The following is a custom macro in ./m4/os_type.m4
49
 # be sure to also set "ACLOCAL_AMFLAGS = -I m4" in ./Makefile.am
52
 # be sure to also set "ACLOCAL_AMFLAGS = -I m4" in ./Makefile.am
69
        *) AC_MSG_ERROR([bad value ${enableval} for --enable-build_libcm]) ;;
72
        *) AC_MSG_ERROR([bad value ${enableval} for --enable-build_libcm]) ;;
70
      esac],[build_libcm=false])
73
      esac],[build_libcm=false])
71
      
74
      
72
-echo "build_libcm=${build_libcm}"
73
 
75
 
74
 # check if a nested copy of libcm exists in /src/libcm
76
 # check if a nested copy of libcm exists in /src/libcm
75
 AC_CHECK_FILE([${srcdir}/src/libcm/src/cmGlobal.h],[local_libcm=true],[local_libcm=false])
77
 AC_CHECK_FILE([${srcdir}/src/libcm/src/cmGlobal.h],[local_libcm=true],[local_libcm=false])
76
 echo "local_libcm=${local_libcm}"
78
 echo "local_libcm=${local_libcm}"
79
+echo "build_libcm=${build_libcm}"
77
 
80
 
78
 # set BUILD_LIBCM if a libcm build request was set and a nested copy of libcm exists
81
 # set BUILD_LIBCM if a libcm build request was set and a nested copy of libcm exists
79
 AM_CONDITIONAL([BUILD_LIBCM], [test x$build_libcm = xtrue -a x$local_libcm = xtrue ])
82
 AM_CONDITIONAL([BUILD_LIBCM], [test x$build_libcm = xtrue -a x$local_libcm = xtrue ])
80
 
83
 
84
+# enable debug
81
 AC_ARG_ENABLE([debug],
85
 AC_ARG_ENABLE([debug],
82
      [  --enable-debug    Turn on debugging],
86
      [  --enable-debug    Turn on debugging],
83
      [case "${enableval}" in
87
      [case "${enableval}" in
94
 AC_DEFINE([NDEBUG], 1,[Debugging off.])
98
 AC_DEFINE([NDEBUG], 1,[Debugging off.])
95
 fi
99
 fi
96
 
100
 
101
+# enable the use of Atlas library
97
 AC_ARG_ENABLE([vectop],
102
 AC_ARG_ENABLE([vectop],
98
      [  --enable-vectop    Turn on use of Lapack and Atlas vector/matrix operations. ],
103
      [  --enable-vectop    Turn on use of Lapack and Atlas vector/matrix operations. ],
99
      [case "${enableval}" in
104
      [case "${enableval}" in
110
 fi
115
 fi
111
 
116
 
112
 
117
 
118
+# enable memory alignment
113
 AC_ARG_ENABLE([memalign],
119
 AC_ARG_ENABLE([memalign],
114
      [  --enable-memalign    Turn on memory alignment on dynamic memory allocations. ],
120
      [  --enable-memalign    Turn on memory alignment on dynamic memory allocations. ],
115
      [case "${enableval}" in
121
      [case "${enableval}" in
125
 AC_DEFINE([CM_MEMALIGN], 1,[Turn on dynamic memory alignment.])
131
 AC_DEFINE([CM_MEMALIGN], 1,[Turn on dynamic memory alignment.])
126
 fi
132
 fi
127
 
133
 
134
+# enable sonic arts code inclusion
128
 AC_ARG_ENABLE([sonicart],
135
 AC_ARG_ENABLE([sonicart],
129
      [  --enable-sonicart    Enable use of Sonic Arts proprietary code. ],
136
      [  --enable-sonicart    Enable use of Sonic Arts proprietary code. ],
130
      [case "${enableval}" in
137
      [case "${enableval}" in
146
 
153
 
147
 # if local nested libcm then do recursive configure into subdirs
154
 # if local nested libcm then do recursive configure into subdirs
148
 if test x$build_libcm = xtrue -a x$local_libcm = xtrue; then
155
 if test x$build_libcm = xtrue -a x$local_libcm = xtrue; then
149
-AC_CONFIG_SUBDIRS([src/libcm])
156
+   AC_CONFIG_SUBDIRS([src/libcm])
150
 fi
157
 fi
151
 
158
 
152
 AC_OUTPUT
159
 AC_OUTPUT

+ 4
- 0
doc/xscore_gen.md View File

45
 - MIDI file suitable for audio rendering
45
 - MIDI file suitable for audio rendering
46
 - SVG piano roll file
46
 - SVG piano roll file
47
 
47
 
48
+```
49
+cmtools --score_gen -x GUTIM_20200803_utf8.xml -d edit0.txt -c score.csv -m score.mid -s score_svg.html -r report.txt
50
+```
51
+
48
 As with step 2 this step may need to be iterated several times
52
 As with step 2 this step may need to be iterated several times
49
 to clear syntactic errors in the decoration data.
53
 to clear syntactic errors in the decoration data.
50
 
54
 

+ 59
- 13
src/cmtools/cmtools.c View File

33
  kNoActionIdSelectedCtRC,
33
  kNoActionIdSelectedCtRC,
34
  kMissingRequiredFileNameCtRC,
34
  kMissingRequiredFileNameCtRC,
35
  kScoreGenFailedCtRC,
35
  kScoreGenFailedCtRC,
36
+ kScoreEditMergeFailedCtRC,
36
  kScoreFollowFailedCtRC,
37
  kScoreFollowFailedCtRC,
37
  kMidiFileRptFailedCtRC,
38
  kMidiFileRptFailedCtRC,
38
  kTimeLineRptFailedCtRC,
39
  kTimeLineRptFailedCtRC,
46
   "\n"
47
   "\n"
47
   "USAGE:\n"
48
   "USAGE:\n"
48
   "\n"
49
   "\n"
49
-  "Parse an XML score file and decoration file to produce a score file in CSV format.\n"
50
+  "Parse an XML score file and 'edit' file to produce a score file in CSV format.\n"
50
   "\n"
51
   "\n"
51
-  "cmtool --score_gen -x <xml_file> -d <dec_fn> {-c <csvScoreOutFn} {-m <midiOutFn>} {-s <svgOutFn>} {-r report} {-b begMeasNumb} {t begTempoBPM}\n"
52
+  "cmtool --score_gen -x <xml_file> -d <edit_fn> {-c <csvScoreOutFn} {-m <midiOutFn>} {-s <svgOutFn>} {-r report} {-b begMeasNumb} {t begTempoBPM}\n"
52
   "\n"
53
   "\n"
53
   "Notes:\n"
54
   "Notes:\n"
54
-  "1.  If <dec_fn> does not exist then a decoration template file will be generated based on the MusicXML file. \n"
55
-  "2.  Along with the CSV score file MIDI and HTML/SVG files will also be produced based on the contents of the MusicXML and decoration file.\n"
56
-  "3. See README.md for a detailed description of the how to edit the decoration file.\n"
55
+  "1.  If <edit_fn> does not exist then a edit template file will be generated based on the MusicXML file. \n"
56
+  "2.  Along with the CSV score file MIDI and HTML/SVG files will also be produced based on the contents of the MusicXML and edit file.\n"
57
+  "3. See README.md for a detailed description of the how to edit the edit file.\n"
57
   "\n"
58
   "\n"
58
   "\n"
59
   "\n"
59
   "Use the score follower to generate a timeline configuration file.\n"
60
   "Use the score follower to generate a timeline configuration file.\n"
103
   return kOkCtRC;
104
   return kOkCtRC;
104
 }
105
 }
105
 
106
 
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
+cmRC_t score_gen( cmCtx_t* ctx, const cmChar_t* xmlFn, const cmChar_t* editFn, 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
 {
108
 {
108
   cmRC_t rc;
109
   cmRC_t rc;
109
   if((rc = verify_file_exists(ctx,xmlFn,"XML file")) != kOkCtRC )
110
   if((rc = verify_file_exists(ctx,xmlFn,"XML file")) != kOkCtRC )
110
     return rc;
111
     return rc;
111
   
112
   
112
-  if( cmXScoreTest( ctx, xmlFn, decFn, csvOutFn, midiOutFn, svgOutFn, reportFl, begMeasNumb, begTempoBPM, svgStandAloneFl, svgPanZoomFl, damperRptFl ) != kOkXsRC )
113
+  if( cmXScoreTest( ctx, xmlFn, editFn, csvOutFn, midiOutFn, svgOutFn, reportFl, begMeasNumb, begTempoBPM, svgStandAloneFl, svgPanZoomFl, damperRptFl ) != kOkXsRC )
113
     return cmErrMsg(&ctx->err,kScoreGenFailedCtRC,"score_gen failed.");
114
     return cmErrMsg(&ctx->err,kScoreGenFailedCtRC,"score_gen failed.");
114
     
115
     
115
   return kOkCtRC;
116
   return kOkCtRC;
116
 }
117
 }
117
 
118
 
119
+cmRC_t score_edit_merge( cmCtx_t* ctx, const cmChar_t* xmlFn, const cmChar_t* editFn, unsigned begMeasNumb, const cmChar_t* keyEditFn, unsigned keyMeasNumb, const cmChar_t* outFn )
120
+{
121
+  cmRC_t rc;
122
+  
123
+  if((rc = verify_file_exists(ctx,xmlFn,"XML file")) != kOkCtRC )
124
+    return rc;
125
+  
126
+  if((rc = verify_file_exists(ctx,editFn,"reference edit file")) != kOkCtRC )
127
+    return rc;
128
+
129
+  if((rc = verify_file_exists(ctx,editFn,"key edit file")) != kOkCtRC )
130
+    return rc;
131
+
132
+  if( cmXScoreMergeEditFiles( ctx, xmlFn, editFn, begMeasNumb, keyEditFn, keyMeasNumb, outFn ) != kOkXsRC )
133
+    return cmErrMsg(&ctx->err,kScoreEditMergeFailedCtRC,"Score merge failed failed.");
134
+    
135
+  return kOkCtRC;      
136
+}
137
+
138
+
139
+
118
 cmRC_t score_follow( cmCtx_t* ctx, const cmChar_t* csvScoreFn, const cmChar_t* midiInFn, const cmChar_t* matchRptOutFn, const cmChar_t* matchSvgOutFn,  const cmChar_t* midiOutFn, const cmChar_t* timelineFn )
140
 cmRC_t score_follow( cmCtx_t* ctx, const cmChar_t* csvScoreFn, const cmChar_t* midiInFn, const cmChar_t* matchRptOutFn, const cmChar_t* matchSvgOutFn,  const cmChar_t* midiOutFn, const cmChar_t* timelineFn )
119
 {
141
 {
120
   cmRC_t rc;
142
   cmRC_t rc;
215
    kInvalidPoId = kBasePoId,
237
    kInvalidPoId = kBasePoId,
216
    kActionPoId,
238
    kActionPoId,
217
    kXmlFileNamePoId,
239
    kXmlFileNamePoId,
218
-   kDecorateFileNamePoId,
240
+   kEditFileNamePoId,
241
+   kKeyEditFileNamePoId,
242
+   kKeyMeasNumbPoId,
243
+   kOutEditFileNamePoId,
219
    kCsvOutFileNamePoId,
244
    kCsvOutFileNamePoId,
220
    kPgmRsrcFileNamePoId,
245
    kPgmRsrcFileNamePoId,
221
    kMidiOutFileNamePoId,
246
    kMidiOutFileNamePoId,
238
   enum {
263
   enum {
239
         kNoSelId,
264
         kNoSelId,
240
         kScoreGenSelId,
265
         kScoreGenSelId,
266
+        kScoreEditMergeSelId,
241
         kScoreFollowSelId,
267
         kScoreFollowSelId,
242
         kMeasGenSelId,
268
         kMeasGenSelId,
243
         kScoreReportSelId,
269
         kScoreReportSelId,
256
   const cmChar_t* appTitle        = "cmtools";
282
   const cmChar_t* appTitle        = "cmtools";
257
   cmCtx_t         ctx;
283
   cmCtx_t         ctx;
258
   const cmChar_t* xmlFn           = NULL;
284
   const cmChar_t* xmlFn           = NULL;
259
-  const cmChar_t* decFn           = NULL;
285
+  const cmChar_t* editFn          = NULL;
286
+  const cmChar_t* keyEditFn       = NULL;
287
+  const cmChar_t* outEditFn       = NULL;
260
   const cmChar_t* pgmRsrcFn       = NULL;
288
   const cmChar_t* pgmRsrcFn       = NULL;
261
   const cmChar_t* csvScoreFn      = NULL;
289
   const cmChar_t* csvScoreFn      = NULL;
262
   const cmChar_t* midiOutFn       = NULL;
290
   const cmChar_t* midiOutFn       = NULL;
270
   unsigned        svgStandAloneFl = 1;
298
   unsigned        svgStandAloneFl = 1;
271
   unsigned        svgPanZoomFl    = 1;
299
   unsigned        svgPanZoomFl    = 1;
272
   int             begMeasNumb     = 0;
300
   int             begMeasNumb     = 0;
301
+  int             keyMeasNumb     = 0;
273
   int             begTempoBPM     = 60;
302
   int             begTempoBPM     = 60;
274
   unsigned        damperRptFl     = 0;
303
   unsigned        damperRptFl     = 0;
275
   unsigned        begMidiUId      = cmInvalidId;
304
   unsigned        begMidiUId      = cmInvalidId;
288
 
317
 
289
   cmPgmOptInstallEnum( poH, kActionPoId, 'S', "score_gen",    0, kScoreGenSelId,    kNoSelId,  &actionSelId, 1,
318
   cmPgmOptInstallEnum( poH, kActionPoId, 'S', "score_gen",    0, kScoreGenSelId,    kNoSelId,  &actionSelId, 1,
290
     "Run the score generation tool.","Action selector");
319
     "Run the score generation tool.","Action selector");
320
+  
321
+  cmPgmOptInstallEnum( poH, kActionPoId, 'D', "merge_edit",    0, kScoreEditMergeSelId,    kNoSelId,  &actionSelId, 1,
322
+    "Synchronize and copy the edit information from one edit file into another.","Action selector");
291
 
323
 
292
   cmPgmOptInstallEnum( poH, kActionPoId, 'F', "score_follow", 0, kScoreFollowSelId, kNoSelId,  &actionSelId, 1,
324
   cmPgmOptInstallEnum( poH, kActionPoId, 'F', "score_follow", 0, kScoreFollowSelId, kNoSelId,  &actionSelId, 1,
293
     "Run the time line marker generation tool.",NULL);
325
     "Run the time line marker generation tool.",NULL);
308
     "Generate an audio file report.",NULL);
340
     "Generate an audio file report.",NULL);
309
 
341
 
310
   
342
   
311
-  cmPgmOptInstallStr( poH, kXmlFileNamePoId,      'x', "muisic_xml_fn",0,    NULL,         &xmlFn,        1, 
343
+  cmPgmOptInstallStr( poH, kXmlFileNamePoId,      'x', "music_xml_fn",0,    NULL,         &xmlFn,        1, 
312
     "Name of the input MusicXML file.");
344
     "Name of the input MusicXML file.");
313
 
345
 
314
-  cmPgmOptInstallStr( poH, kDecorateFileNamePoId, 'd', "dec_fn",       0,    NULL,         &decFn,        1, 
315
-    "Name of a score decoration file.");
346
+  cmPgmOptInstallStr( poH, kEditFileNamePoId,      'd', "edit_fn",    0,    NULL,         &editFn,        1, 
347
+    "Name of a score edit file.");
348
+
349
+  cmPgmOptInstallStr( poH, kKeyEditFileNamePoId,   'k', "key_edit_fn", 0,    NULL,      &keyEditFn,     1, 
350
+    "Name of a score edit key file.");
316
 
351
 
352
+  cmPgmOptInstallInt( poH, kKeyMeasNumbPoId,       'q', "key_meas",     0,       1,         &keyMeasNumb,   1,
353
+    "Number of the first measure number to merge in the edit key filke (see --key_edit_fn)." );
354
+  
355
+
356
+  cmPgmOptInstallStr( poH, kOutEditFileNamePoId,   'o', "out_edit_fn", 0,    NULL,      &outEditFn,     1, 
357
+    "Name of a score edit merge file.");
358
+  
317
   cmPgmOptInstallStr( poH, kCsvOutFileNamePoId,   'c', "score_csv_fn",0,    NULL,         &csvScoreFn,    1, 
359
   cmPgmOptInstallStr( poH, kCsvOutFileNamePoId,   'c', "score_csv_fn",0,    NULL,         &csvScoreFn,    1, 
318
     "Name of a CSV score file.");
360
     "Name of a CSV score file.");
319
 
361
 
376
     switch( actionSelId )
418
     switch( actionSelId )
377
     {
419
     {
378
       case kScoreGenSelId:
420
       case kScoreGenSelId:
379
-        rc = score_gen( &ctx, xmlFn, decFn, csvScoreFn, midiOutFn, svgOutFn, reportFl, begMeasNumb, begTempoBPM, svgStandAloneFl, svgPanZoomFl, damperRptFl );
421
+        rc = score_gen( &ctx, xmlFn, editFn, csvScoreFn, midiOutFn, svgOutFn, reportFl, begMeasNumb, begTempoBPM, svgStandAloneFl, svgPanZoomFl, damperRptFl );
422
+        break;
423
+
424
+      case kScoreEditMergeSelId:
425
+        rc = score_edit_merge( &ctx, xmlFn, editFn, begMeasNumb, keyEditFn, keyMeasNumb, outEditFn );
380
         break;
426
         break;
381
 
427
 
382
       case kScoreFollowSelId:
428
       case kScoreFollowSelId:

Loading…
Cancel
Save