From 0dd1e063aee2c6bf0005a61635d428455cc5c352 Mon Sep 17 00:00:00 2001 From: sshlien Date: Sun, 17 Dec 2023 08:46:38 -0500 Subject: [PATCH] 2023.12.17 --- VERSION | 2 +- doc/CHANGES | 15 +++++++++++++ doc/drums.txt | 21 ++++++++++++++++++ doc/readme.txt | 2 +- midistats.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++++-- 5 files changed, 96 insertions(+), 4 deletions(-) diff --git a/VERSION b/VERSION index 08dbd61..ca107bf 100644 --- a/VERSION +++ b/VERSION @@ -1,2 +1,2 @@ -November 26 2023 +December 17 2023 diff --git a/doc/CHANGES b/doc/CHANGES index 653df19..006c18f 100644 --- a/doc/CHANGES +++ b/doc/CHANGES @@ -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. + diff --git a/doc/drums.txt b/doc/drums.txt index ff8b8a1..c2c75b7 100755 --- a/doc/drums.txt +++ b/doc/drums.txt @@ -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. + + + diff --git a/doc/readme.txt b/doc/readme.txt index d4c0e41..04bed50 100644 --- a/doc/readme.txt +++ b/doc/readme.txt @@ -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 diff --git a/midistats.c b/midistats.c index 2a34a0f..f4ab995 100644 --- a/midistats.c +++ b/midistats.c @@ -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 /* 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 = 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 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; }