mirror of
https://github.com/sshlien/abcmidi.git
synced 2025-12-06 06:55:06 +00:00
2023.11.08
This commit is contained in:
29
doc/CHANGES
29
doc/CHANGES
@@ -15107,3 +15107,32 @@ October 25 2023
|
|||||||
|
|
||||||
Midistats returns track activity (note on/off) for every track.
|
Midistats returns track activity (note on/off) for every track.
|
||||||
|
|
||||||
|
|
||||||
|
November 1 2023
|
||||||
|
|
||||||
|
Midistats returns the control volume settings for every track,
|
||||||
|
identifies midi files whose note timings are not quantized.
|
||||||
|
|
||||||
|
|
||||||
|
November 2 2023
|
||||||
|
|
||||||
|
abc2midi bug: In the following example, not all notes are
|
||||||
|
tied correctly.
|
||||||
|
|
||||||
|
X:1
|
||||||
|
T: tied note
|
||||||
|
M: 2/4
|
||||||
|
L: 1/4
|
||||||
|
K: C
|
||||||
|
D2-|:D2 |[1CD-:|[2CD|
|
||||||
|
|
||||||
|
No fix is available.
|
||||||
|
|
||||||
|
|
||||||
|
November 8 2023
|
||||||
|
|
||||||
|
midistats: extended the size of arrays (midievents and pulsecounter) to
|
||||||
|
handle certain midi files. The function stats_interpret_pulseCounter()
|
||||||
|
can detect midi files containing triplets and nonquantized notes.
|
||||||
|
|
||||||
|
midicopy: extended to handle midi files with up to 150 tracks.
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ abc2midi version 4.84 January 06 2023
|
|||||||
abc2abc version 2.20 February 07 2023
|
abc2abc version 2.20 February 07 2023
|
||||||
yaps version 1.92 January 06 2023
|
yaps version 1.92 January 06 2023
|
||||||
abcmatch version 1.82 June 14 2022
|
abcmatch version 1.82 June 14 2022
|
||||||
midicopy version 1.38 May 06 2022
|
midicopy version 1.39 November 08 2022
|
||||||
midistats version 0.78 November 01 2023
|
midistats version 0.79 November 08 2023
|
||||||
|
|
||||||
24th January 2002
|
24th January 2002
|
||||||
Copyright James Allwright
|
Copyright James Allwright
|
||||||
|
|||||||
11
midicopy.c
11
midicopy.c
@@ -52,7 +52,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define VERSION "1.38 May 05 2022 midicopy"
|
#define VERSION "1.39 November 07 2023 midicopy"
|
||||||
#include "midicopy.h"
|
#include "midicopy.h"
|
||||||
#define NULLFUNC 0
|
#define NULLFUNC 0
|
||||||
#define NULL 0
|
#define NULL 0
|
||||||
@@ -96,8 +96,9 @@ long max_currtime = 0;
|
|||||||
long Mf_currcopytime = 0L; /* time of last copied event */
|
long Mf_currcopytime = 0L; /* time of last copied event */
|
||||||
char *trackdata = NULL;
|
char *trackdata = NULL;
|
||||||
long trackdata_length, trackdata_size;
|
long trackdata_length, trackdata_size;
|
||||||
char *trackstr[64]; /* [SS] 2017-10-20 2019-07-05*/
|
/* char *trackstr[64]; [SS] 2017-10-20 2019-07-05*/
|
||||||
int trackstr_length[64]; /* [SS] 2017-10-20 2019-07-05*/
|
char *trackstr[150]; /* [SS] 2023-11-07 */
|
||||||
|
int trackstr_length[150]; /* [SS] 2017-10-20 2019-07-05* 2023-11-07*/
|
||||||
int trkid = 0;
|
int trkid = 0;
|
||||||
int activetrack;
|
int activetrack;
|
||||||
int nochanmsg = 1;
|
int nochanmsg = 1;
|
||||||
@@ -1290,7 +1291,7 @@ build_new_midi_file (format, ntracks, division, fp)
|
|||||||
|
|
||||||
get_tempo_info_from_track_1 ();
|
get_tempo_info_from_track_1 ();
|
||||||
|
|
||||||
if (ntracks > 63) {printf("too many tracks\n"); exit(1); }
|
if (ntracks > 149) {printf("too many tracks\n"); exit(1); }
|
||||||
|
|
||||||
/* The rest of the file is a series of tracks */
|
/* The rest of the file is a series of tracks */
|
||||||
for (i = 0; i < ntracks; i++)
|
for (i = 0; i < ntracks; i++)
|
||||||
@@ -1836,7 +1837,7 @@ main (int argc, char *argv[])
|
|||||||
printf ("-ver version information\n");
|
printf ("-ver version information\n");
|
||||||
printf ("-trks n1,n2,..(starting from 1)\n");
|
printf ("-trks n1,n2,..(starting from 1)\n");
|
||||||
printf ("-xtrks n1,n2,.. (tracks to exclude)\n"); /* [SS] 2013-10-27 */
|
printf ("-xtrks n1,n2,.. (tracks to exclude)\n"); /* [SS] 2013-10-27 */
|
||||||
printf ("-xchns n1,n2,.. (tracks to exclude)\n"); /* [SS] 2017-12-06 */
|
printf ("-xchns n1,n2,.. (channels to exclude)\n"); /* [SS] 2022-11-12 */
|
||||||
printf ("-chns n1,n2,..(starting from 1)\n");
|
printf ("-chns n1,n2,..(starting from 1)\n");
|
||||||
printf ("-from n (in midi ticks)\n");
|
printf ("-from n (in midi ticks)\n");
|
||||||
printf ("-to n (in midi ticks)\n");
|
printf ("-to n (in midi ticks)\n");
|
||||||
|
|||||||
42
midistats.c
42
midistats.c
@@ -18,7 +18,7 @@
|
|||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define VERSION "0.78 October 30 2023 midistats"
|
#define VERSION "0.79 November 08 2023 midistats"
|
||||||
|
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
/* Microsoft Visual C++ Version 6.0 or higher */
|
/* Microsoft Visual C++ Version 6.0 or higher */
|
||||||
@@ -94,7 +94,7 @@ struct eventstruc {int onsetTime;
|
|||||||
unsigned char channel;
|
unsigned char channel;
|
||||||
unsigned char pitch;
|
unsigned char pitch;
|
||||||
unsigned char velocity;
|
unsigned char velocity;
|
||||||
;} midievents[40000];
|
;} midievents[50000];
|
||||||
|
|
||||||
int lastEvent = 0;
|
int lastEvent = 0;
|
||||||
|
|
||||||
@@ -200,7 +200,7 @@ static int progmapper[] = {
|
|||||||
16, 16, 16, 16, 16, 16, 16, 16
|
16, 16, 16, 16, 16, 16, 16, 16
|
||||||
};
|
};
|
||||||
|
|
||||||
int pulseCounter[480];
|
int pulseCounter[1024];
|
||||||
int pulseDistribution[24];
|
int pulseDistribution[24];
|
||||||
|
|
||||||
struct barPattern {
|
struct barPattern {
|
||||||
@@ -474,9 +474,14 @@ int i;
|
|||||||
|
|
||||||
/* [SS] 2023-10-30 */
|
/* [SS] 2023-10-30 */
|
||||||
void stats_interpret_pulseCounter () {
|
void stats_interpret_pulseCounter () {
|
||||||
int i;
|
int i,j;
|
||||||
int maxcount,ncounts;
|
int maxcount,ncounts;
|
||||||
int maxloc;
|
int maxloc;
|
||||||
|
float threshold,peak;
|
||||||
|
int decimate;
|
||||||
|
float tripletsCriterion;
|
||||||
|
int resolution = 12;
|
||||||
|
threshold = 10.0/(float) division;
|
||||||
maxcount = 0;
|
maxcount = 0;
|
||||||
ncounts = 0;
|
ncounts = 0;
|
||||||
for (i=0;i<division;i++) {
|
for (i=0;i<division;i++) {
|
||||||
@@ -486,9 +491,19 @@ for (i=0;i<division;i++) {
|
|||||||
maxcount = pulseCounter[i];
|
maxcount = pulseCounter[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//printf("maxpulse = %f at %d\n",(float) maxcount/(float) ncounts, maxloc);
|
for (i = 0; i < resolution; i++) pulseDistribution[i] = 0;
|
||||||
if ((float) maxcount/(float) ncounts < 0.05) printf("unquantized\n");
|
decimate = division/resolution;
|
||||||
|
for (i = 0; i < division; i++) {
|
||||||
|
j = i/decimate;
|
||||||
|
pulseDistribution[j] += pulseCounter[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
peak = (float) maxcount/ (float) ncounts;
|
||||||
|
/*printf("maxcount = %d ncounts = %d peak = %f threshold = %f\n",maxcount,ncounts,peak,threshold); */
|
||||||
|
if (peak < threshold) printf("unquantized\n");
|
||||||
|
tripletsCriterion = (float) pulseDistribution[8]/ (float) ncounts;
|
||||||
|
/*printf("tripletsCriterion = %f\n",tripletsCriterion);*/
|
||||||
|
if (tripletsCriterion > 0.15) printf("triplets\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void stats_finish()
|
void stats_finish()
|
||||||
@@ -704,7 +719,7 @@ int chan, pitch, vol;
|
|||||||
}
|
}
|
||||||
pulsePosition = Mf_currtime % division;
|
pulsePosition = Mf_currtime % division;
|
||||||
pulseCounter[pulsePosition]++;
|
pulseCounter[pulsePosition]++;
|
||||||
if (pulsePosition >= 480) {printf("pulsePosition = %d too large\n",pulsePosition);
|
if (pulsePosition >= 1023) {printf("pulsePosition = %d too large\n",pulsePosition);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
trkdata.notemeanpitch[chan+1] += pitch;
|
trkdata.notemeanpitch[chan+1] += pitch;
|
||||||
@@ -909,7 +924,7 @@ midievents[lastEvent].channel = chan;
|
|||||||
midievents[lastEvent].pitch = pitch;
|
midievents[lastEvent].pitch = pitch;
|
||||||
midievents[lastEvent].velocity = vol;
|
midievents[lastEvent].velocity = vol;
|
||||||
lastEvent++;
|
lastEvent++;
|
||||||
if (lastEvent > 39999) {printf("ran out of space in midievents structure\n");
|
if (lastEvent > 49999) {printf("ran out of space in midievents structure\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -934,6 +949,7 @@ int int_compare_events(const void *a, const void *b) {
|
|||||||
void load_header (int format, int ntrks, int ldivision)
|
void load_header (int format, int ntrks, int ldivision)
|
||||||
{
|
{
|
||||||
division = ldivision;
|
division = ldivision;
|
||||||
|
lasttrack = ntrks;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -962,7 +978,7 @@ void initfunc_for_stats()
|
|||||||
Mf_seqspecific = no_op3;
|
Mf_seqspecific = no_op3;
|
||||||
Mf_text = stats_metatext;
|
Mf_text = stats_metatext;
|
||||||
Mf_arbitrary = no_op2;
|
Mf_arbitrary = no_op2;
|
||||||
for (i = 0; i< 480; i++) pulseCounter[i] = 0;
|
for (i = 0; i< 1023; i++) pulseCounter[i] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1014,16 +1030,16 @@ int pulsePosition;
|
|||||||
int decimate;
|
int decimate;
|
||||||
float fraction;
|
float fraction;
|
||||||
int resolution = 12;
|
int resolution = 12;
|
||||||
for (i = 0; i< 480; i++) pulseCounter[i] = 0;
|
for (i = 0; i< 1023; i++) pulseCounter[i] = 0;
|
||||||
for (i = 0; i < lastEvent; i++) {
|
for (i = 0; i < lastEvent; i++) {
|
||||||
pulsePosition = midievents[i].onsetTime % division;
|
pulsePosition = midievents[i].onsetTime % division;
|
||||||
pulseCounter[pulsePosition]++;
|
pulseCounter[pulsePosition]++;
|
||||||
if (pulsePosition >= 480) {printf("pulsePosition = %d too large\n",pulsePosition);
|
if (pulsePosition >= 1023) {printf("pulsePosition = %d too large\n",pulsePosition);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (i = 0; i < resolution; i++) pulseDistribution[i] = 0;
|
for (i = 0; i < resolution; i++) pulseDistribution[i] = 0;
|
||||||
/*for (i = 0; i < 480; i++) printf(" %d",pulseCounter[i]);
|
/*for (i = 0; i < 1023; i++) printf(" %d",pulseCounter[i]);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
*/
|
*/
|
||||||
decimate = division/resolution;
|
decimate = division/resolution;
|
||||||
@@ -1205,7 +1221,7 @@ printf("\n");
|
|||||||
|
|
||||||
|
|
||||||
void corestatsOutput() {
|
void corestatsOutput() {
|
||||||
printf("%d\t%d\t%d\n", division,lastEvent,lastBeat);
|
printf("%d\t%d\t%d\t%d\n",lasttrack, division,lastEvent,lastBeat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user