2023.12.17

This commit is contained in:
sshlien
2023-12-17 08:46:38 -05:00
parent 69c1f850cb
commit 0dd1e063ae
5 changed files with 96 additions and 4 deletions

View File

@@ -1,2 +1,2 @@
November 26 2023
December 17 2023

View File

@@ -15136,3 +15136,18 @@ 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.
December 17 2023
midicopy: The midi program number is not set properly for a few the
midi files where the channel program numbers are set in a separate
track. Midicopy processes and copies the tracks sequentially, and
by the time it sees the channel program numbers in the separate
track it is already too late. It would be necessary to rewrite
midicopy so that it stores the entire midi file in memory prior to
copying it to disk.
midistats: Introducing a new option -nseqfor n where is a channel
number. See drums.txt for a description.

View File

@@ -83,4 +83,25 @@ first two lines. In the next line the number of occurrences of
each value in the -ppat listing is given. The number in parentheses
splits the two 4-bit values with a period. Thus 33 = (2*16 + 1).
-nseqfor -n
Note sequence for channel n. This option produces a string for bytes
indicating the presence of a note in a time unit corresponding to
an eigth note. Thus each quarter note beat is represented by two
bytes. The pitch class is represented by the line number on the
staff, where 0 is C. Thus the notes on a scale are represented
by 7 numbers, and sharps and flats are ignored. The line number is
then converted to a bit position in the byte, so that the pitch
classes are represented by the numbers 1,2,4,8, and etc. A chord
of consisting of two note onsets would set two of the corresponding
bits. If we were to represent the full chromatic scale consisting
of 12 pitches, then we would require two-byte integers or
twice of much memory.
Though the pitch resolution is not sufficient to distinguish
major or minor chords, it should be sufficient to be identify some
repeating patterns.

View File

@@ -6,7 +6,7 @@ abc2abc version 2.20 February 07 2023
yaps version 1.92 January 06 2023
abcmatch version 1.82 June 14 2022
midicopy version 1.39 November 08 2022
midistats version 0.81 November 26 2023
midistats version 0.82 December 17 2023
24th January 2002
Copyright James Allwright

View File

@@ -18,7 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#define VERSION "0.81 November 26 2023 midistats"
#define VERSION "0.82 December 17 2023 midistats"
#include <limits.h>
/* Microsoft Visual C++ Version 6.0 or higher */
@@ -81,6 +81,7 @@ int percpattern;
int percpatternfor;
int percpatternhist;
int pitchclassanalysis;
int nseqfor;
int corestats;
int chordthreshold; /* number of maximum number of pulses separating note */
int beatsPerBar = 4; /* 4/4 time */
@@ -110,6 +111,7 @@ int percpattern = 0;
int percpatternfor = 0;
int percpatternhist = 0;
int pitchclassanalysis = 0;
int nseqfor = 0;
int corestats = 0;
@@ -125,7 +127,9 @@ int channel_used_in_track[17]; /* for dealing with quietTime [SS] 2023-09-06 */
int histogram[256];
unsigned char drumpat[8000];
unsigned char pseq[8000];
int percnum;
int nseqchn;
@@ -1135,6 +1139,44 @@ for (i = 0; i <lastEvent; i++) {
}
}
static int pitch2noteseq[] = {
0, 0, 1, 1, 2, 3, 3, 4,
4, 5, 5, 6};
void noteseqmap(int chn) {
int i;
int half;
int channel;
int pitchclass;
int onset;
int index;
int remainder;
int noteNum;
int part;
printf("noteseqmap %d\n",chn);
half = division/2;
for (i = 0; i<8000; i++) pseq[i] = 0;
for (i = 0; i <lastEvent; i++) {
channel = midievents[i].channel;
if (channel != chn) continue;
pitchclass = midievents[i].pitch % 12;
noteNum = pitch2noteseq[pitchclass];
onset = midievents[i].onsetTime;
index = onset/half;
if (index >= 8000) {printf("index too large in drumpattern\n");
break;
}
pseq[index] = pseq[index] |= 1 << noteNum;
/*printf("pitchclass = %d noteNum =%d index = %d pseq[index] %d \n",pitchclass, noteNum, index, pseq[index]); */
}
printf("lastBeat = %d\n",lastBeat);
for (i=0;i<(lastBeat+1)*2;i++) {
printf("%d ",pseq[i]);
if (i >= 8000) break;
}
printf("\n");
}
void dualDrumPattern (int perc1, int perc2) {
int i;
int channel;
@@ -1403,6 +1445,16 @@ int argc;
}
}
arg = getarg("-nseqfor",argc,argv);
if (arg != -1) {
nseqfor = 1;
stats = 0;
if (arg != -1 && arg <argc) {
nseqchn = readnum(argv[arg]);
printf("nseqch = %d\n",nseqchn);
}
}
arg = getarg("-ppathist",argc,argv);
if (arg != -1) {
percpatternhist = 1;
@@ -1443,6 +1495,7 @@ int argc;
printf(" -ppatfor\n");
printf(" -ppathist\n");
printf(" -pitchclass\n");
printf(" -nseqfor\n");
printf(" -ver version number\n");
printf(" -d <number> debug parameter\n");
printf(" The input filename is assumed to be any string not\n");
@@ -1494,6 +1547,9 @@ if (percpatternhist) {
percsummary();
drumPatternHistogram();
}
if (nseqfor) {
noteseqmap(nseqchn);
}
if (corestats) corestatsOutput();
if (pitchclassanalysis) {
pitchClassAnalysis();
@@ -1514,6 +1570,6 @@ int argc;
if(stats == 1) midistats(argc,argv);
if(pulseanalysis || corestats || percanalysis ||\
percpatternfor || percpattern || percpatternhist ||\
pitchclassanalysis) loadEvents();
pitchclassanalysis || nseqfor) loadEvents();
return 0;
}