Browse Source

Misc. updates in preparation for publishing.

master
kevin 4 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,9 +5,10 @@ AM_CFLAGS   =
5 5
 
6 6
 ACLOCAL_AMFLAGS = -I m4 # use custom macro's in ./m4 
7 7
 
8
+
8 9
 # if we are building and linking to a nested copy of libcm
9 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 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 13
   AM_LDFLAGS  += -Lsrc/libcm/src
13 14
 endif

+ 28
- 3
README.md View File

@@ -219,6 +219,32 @@ index line  loctn bar idx type  pitch ETD Dynamic
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 248
 MIDI File Reports
223 249
 =================
224 250
 
@@ -240,9 +266,8 @@ tlPrefix is the folder where data files for this timeline are stored.
240 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 272
 SVG Description
248 273
 ---------------

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

@@ -12,14 +12,14 @@ cd ${curdir}
12 12
 # 2) Run the program. ./foo
13 13
 # 3) Run gprof /libtool --mode=execute gprof ./foo
14 14
 
15
+# --enable-build_libcm - build libcm from local tree
16
+
15 17
 ../../../configure --prefix=${curdir} \
16
-		   --enable-debug --enable-build_libcm \
18
+		   --enable-debug \
17 19
 		   CFLAGS="-g -Wall" \
18 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 24
 #make
25 25
 #make install

+ 9
- 2
configure.ac View File

@@ -44,6 +44,9 @@ AC_FUNC_REALLOC
44 44
 AC_FUNC_STRTOD
45 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 51
 # The following is a custom macro in ./m4/os_type.m4
49 52
 # be sure to also set "ACLOCAL_AMFLAGS = -I m4" in ./Makefile.am
@@ -69,15 +72,16 @@ AC_ARG_ENABLE([build_libcm],
69 72
        *) AC_MSG_ERROR([bad value ${enableval} for --enable-build_libcm]) ;;
70 73
      esac],[build_libcm=false])
71 74
      
72
-echo "build_libcm=${build_libcm}"
73 75
 
74 76
 # check if a nested copy of libcm exists in /src/libcm
75 77
 AC_CHECK_FILE([${srcdir}/src/libcm/src/cmGlobal.h],[local_libcm=true],[local_libcm=false])
76 78
 echo "local_libcm=${local_libcm}"
79
+echo "build_libcm=${build_libcm}"
77 80
 
78 81
 # set BUILD_LIBCM if a libcm build request was set and a nested copy of libcm exists
79 82
 AM_CONDITIONAL([BUILD_LIBCM], [test x$build_libcm = xtrue -a x$local_libcm = xtrue ])
80 83
 
84
+# enable debug
81 85
 AC_ARG_ENABLE([debug],
82 86
      [  --enable-debug    Turn on debugging],
83 87
      [case "${enableval}" in
@@ -94,6 +98,7 @@ if test x$debug = xfalse; then
94 98
 AC_DEFINE([NDEBUG], 1,[Debugging off.])
95 99
 fi
96 100
 
101
+# enable the use of Atlas library
97 102
 AC_ARG_ENABLE([vectop],
98 103
      [  --enable-vectop    Turn on use of Lapack and Atlas vector/matrix operations. ],
99 104
      [case "${enableval}" in
@@ -110,6 +115,7 @@ AC_DEFINE([CM_VECTOP], 1,[Use Lapack and Atlas.])
110 115
 fi
111 116
 
112 117
 
118
+# enable memory alignment
113 119
 AC_ARG_ENABLE([memalign],
114 120
      [  --enable-memalign    Turn on memory alignment on dynamic memory allocations. ],
115 121
      [case "${enableval}" in
@@ -125,6 +131,7 @@ if test x"$memalign" = xtrue; then
125 131
 AC_DEFINE([CM_MEMALIGN], 1,[Turn on dynamic memory alignment.])
126 132
 fi
127 133
 
134
+# enable sonic arts code inclusion
128 135
 AC_ARG_ENABLE([sonicart],
129 136
      [  --enable-sonicart    Enable use of Sonic Arts proprietary code. ],
130 137
      [case "${enableval}" in
@@ -146,7 +153,7 @@ AC_CONFIG_FILES([ Makefile ])
146 153
 
147 154
 # if local nested libcm then do recursive configure into subdirs
148 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 157
 fi
151 158
 
152 159
 AC_OUTPUT

+ 4
- 0
doc/xscore_gen.md View File

@@ -45,6 +45,10 @@ run again to generate three output files:
45 45
 - MIDI file suitable for audio rendering
46 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 52
 As with step 2 this step may need to be iterated several times
49 53
 to clear syntactic errors in the decoration data.
50 54
 

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

@@ -33,6 +33,7 @@ enum
33 33
  kNoActionIdSelectedCtRC,
34 34
  kMissingRequiredFileNameCtRC,
35 35
  kScoreGenFailedCtRC,
36
+ kScoreEditMergeFailedCtRC,
36 37
  kScoreFollowFailedCtRC,
37 38
  kMidiFileRptFailedCtRC,
38 39
  kTimeLineRptFailedCtRC,
@@ -46,14 +47,14 @@ const cmChar_t poBegHelpStr[] =
46 47
   "\n"
47 48
   "USAGE:\n"
48 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 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 53
   "\n"
53 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 58
   "\n"
58 59
   "\n"
59 60
   "Use the score follower to generate a timeline configuration file.\n"
@@ -103,18 +104,39 @@ bool verify_non_null_filename( cmCtx_t* ctx, const cmChar_t* fn, const cmChar_t*
103 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 109
   cmRC_t rc;
109 110
   if((rc = verify_file_exists(ctx,xmlFn,"XML file")) != kOkCtRC )
110 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 114
     return cmErrMsg(&ctx->err,kScoreGenFailedCtRC,"score_gen failed.");
114 115
     
115 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 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 142
   cmRC_t rc;
@@ -215,7 +237,10 @@ int main( int argc, char* argv[] )
215 237
    kInvalidPoId = kBasePoId,
216 238
    kActionPoId,
217 239
    kXmlFileNamePoId,
218
-   kDecorateFileNamePoId,
240
+   kEditFileNamePoId,
241
+   kKeyEditFileNamePoId,
242
+   kKeyMeasNumbPoId,
243
+   kOutEditFileNamePoId,
219 244
    kCsvOutFileNamePoId,
220 245
    kPgmRsrcFileNamePoId,
221 246
    kMidiOutFileNamePoId,
@@ -238,6 +263,7 @@ int main( int argc, char* argv[] )
238 263
   enum {
239 264
         kNoSelId,
240 265
         kScoreGenSelId,
266
+        kScoreEditMergeSelId,
241 267
         kScoreFollowSelId,
242 268
         kMeasGenSelId,
243 269
         kScoreReportSelId,
@@ -256,7 +282,9 @@ int main( int argc, char* argv[] )
256 282
   const cmChar_t* appTitle        = "cmtools";
257 283
   cmCtx_t         ctx;
258 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 288
   const cmChar_t* pgmRsrcFn       = NULL;
261 289
   const cmChar_t* csvScoreFn      = NULL;
262 290
   const cmChar_t* midiOutFn       = NULL;
@@ -270,6 +298,7 @@ int main( int argc, char* argv[] )
270 298
   unsigned        svgStandAloneFl = 1;
271 299
   unsigned        svgPanZoomFl    = 1;
272 300
   int             begMeasNumb     = 0;
301
+  int             keyMeasNumb     = 0;
273 302
   int             begTempoBPM     = 60;
274 303
   unsigned        damperRptFl     = 0;
275 304
   unsigned        begMidiUId      = cmInvalidId;
@@ -288,6 +317,9 @@ int main( int argc, char* argv[] )
288 317
 
289 318
   cmPgmOptInstallEnum( poH, kActionPoId, 'S', "score_gen",    0, kScoreGenSelId,    kNoSelId,  &actionSelId, 1,
290 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 324
   cmPgmOptInstallEnum( poH, kActionPoId, 'F', "score_follow", 0, kScoreFollowSelId, kNoSelId,  &actionSelId, 1,
293 325
     "Run the time line marker generation tool.",NULL);
@@ -308,12 +340,22 @@ int main( int argc, char* argv[] )
308 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 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 359
   cmPgmOptInstallStr( poH, kCsvOutFileNamePoId,   'c', "score_csv_fn",0,    NULL,         &csvScoreFn,    1, 
318 360
     "Name of a CSV score file.");
319 361
 
@@ -376,7 +418,11 @@ int main( int argc, char* argv[] )
376 418
     switch( actionSelId )
377 419
     {
378 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 426
         break;
381 427
 
382 428
       case kScoreFollowSelId:

Loading…
Cancel
Save