2025.02.07

This commit is contained in:
sshlien
2025-02-07 11:46:14 -05:00
parent ad766b0096
commit 835b91dc6f
4 changed files with 99 additions and 36 deletions

View File

@@ -1 +1 @@
February 02 2025
February 07 2025

View File

@@ -9,7 +9,7 @@ midi2abc \-f \fIinfile\fP [\-xa] [\-ga]
[\-k \fIkey\fP] [\-c \fIchannel\fP] [\-obpl] [\-bpl \fibars\fP] [\-bps \fPbars\fP]
[\-o \fIfilename\fP] [\-s] [\-sr \fiunits\fP] [\-sum] [\-nb] [\-nt]
[\-splitvoices] [\-midigram] [\-mftext] [-mftextpulses] [\-nogr] [\-title \fistring\fP]
[\-origin \fistring\fP][\-midinotes][\-midinotes-brief]
[\-origin \fistring\fP][\-midinotes]
@@ -174,17 +174,25 @@ the given string.
Adds an O: field with the given string.
.TP
.B -midinotes
Like -mftext, this option outputs the notes present in the
midi file; however, the output is more consise (note-on and
noteoff are combined) in order to make it easier to compare
one or more midi files using dif, diffuse, or winmerge.
The time as beat number, track number, channel number, pitch,
and pitch bend are presented.
Like -mftext, this option outputs the midi pitches present in the
midi file, where middle C is 60, the deviation of the note from
the equal tempered scale in units of cents, and the pitch value
in cents of the note relative to C. If the pitchbend is used,
then its value follows cents in parentheses. There are 100 cents in
the semitone interval. Thus a pitch half way between C and C# would
have a cent value of 50. There are 1200 cents in an octave,
so the pitch value of D natural would be 200. The pitch value of
B natural is 1100. These values are useful for verifying the
pitch values in an equaltempered scale divided into more than
12 tones. The pitch values are determined from the
pitchbend value in the midi file, which is normally 8192.
However, for some midi players the pitch can also be altered
using sysex (System Exclusive) messages. In particular, Jef
Moine's abc2svg uses the latter rather than pitchbends which act
on all the notes in a channel.
.TP
.B -midinotes-brief
Similar to -midinotes except only the pitch and pitch bend
values are presented.

View File

@@ -1,6 +1,6 @@
abcMIDI : abc <-> MIDI conversion utilities
midi2abc version 3.61 January 22 2025
midi2abc version 3.62 February 06 2025
abc2midi version 5.00 February 12 2025
abc2abc version 2.22 April 30 2024
yaps version 1.94 April 30 2024

View File

@@ -45,7 +45,7 @@
* based on public domain 'midifilelib' package.
*/
#define VERSION "3.61 January 22 2025 midi2abc"
#define VERSION "3.62 February 07 2025 midi2abc"
#include <limits.h>
/* Microsoft Visual C++ Version 6.0 or higher */
@@ -674,6 +674,55 @@ int chan, msb, lsb;
chanbend[chan+1] = pitchbend;
}
unsigned char sysexsnt[7] = {240, 127, 0, 8, 2, 0, 1};
float sysexBentPitches[128];
void zeroBentPitches () {
int i;
for (i=0; i<128; i++) sysexBentPitches[i]=0.0;
}
void txt_sysex_snt (leng,mess)
int leng;
unsigned char *mess;
{
int i;
int midipitch;
int newpitch;
int low,hi;
int hilo;
float ratio;
float modifiedPitch;
int cents;
if (leng == 12) {
for (i=0;i<7;i++) {
if(i == 2) continue; /* device id */
if(mess[i] != sysexsnt[i]) {
printf("mess(%d) not equal to sysexnt[%d]\n",i,i);
return;
}
}
midipitch = mess[7];
newpitch = mess[8];
low = mess[9];
hi = mess[10];
hilo = hi*128 + low;
ratio = (float) hilo/16384.0;
cents = (int) (0.5 + ratio*100.0);
modifiedPitch = (float) midipitch + ratio;
sysexBentPitches[newpitch] = modifiedPitch;
/*printf("%d %d %d %d %f %d\n",midipitch,newpitch,low,hi,ratio,cents);
printf("sysext: %d %d\n",newpitch,cents);
*/
return;
} else {
printf("leng was %d\n",leng);
return;
}
}
void txt_program(chan,program)
int chan, program;
{
@@ -951,22 +1000,32 @@ int chan, pitch, vol;
/* substitutes pitchbend for volume */
{
int start_time,initvol;
int cents,centvalue,pitchbend;
int newpitchint;
float newpitch;
start_time = close_note(chan, pitch, &initvol);
if (start_time >= 0)
/*
printf("%8.4f %8.4f %d %d %d %d\n",
(double) start_time/(double) division,
(double) Mf_currtime/(double) division,
trackno+1, chan+1, pitch,initvol);
*/
/* printf("%6.2f %6.2f %d %d %d %d\n",
(double) start_time/(double) division, (double) Mf_currtime/(double) division, trackno+1, chan +1, pitch,chanbend[chan+1]);
*/
if (midiprint == 3) printf("%6.2f %d %d %d %d\n",
(double) start_time/(double) division, trackno+1, chan +1, pitch,chanbend[chan+1]);
else printf("%d %d\n", pitch,chanbend[chan+1]);
if(Mf_currtime > last_tick[chan+1]) last_tick[chan+1] = Mf_currtime;
if (start_time <= 0) return;
if (sysexBentPitches[pitch] >0.0) {
newpitch = sysexBentPitches[pitch];
newpitchint = (int) newpitch;
cents = (newpitch -newpitchint)*100;
centvalue = (newpitchint % 12)*100 + cents;
printf("%f\t%d\t%d\n",sysexBentPitches[pitch],cents,centvalue);
}
else
{pitchbend = chanbend[chan+1];
cents = (pitchbend - 8192)/200;
if (cents < 0) {
pitch--;
cents +-100;
}
centvalue = cents + (pitch % 12)*100;
newpitch = (float) pitch + cents/100.0;
printf("%f\t%d (%d)\t%d\n",newpitch,cents,pitchbend,centvalue);
}
if(Mf_currtime > last_tick[chan+1]) last_tick[chan+1] = Mf_currtime;
}
/* In order to associate a channel note off message with its
@@ -1413,7 +1472,7 @@ void initfunc_for_midinotes()
Mf_pitchbend = txt_pitchbend;
Mf_program = print_txt_program;
Mf_chanpressure = no_op3;
Mf_sysex = no_op2;
Mf_sysex = txt_sysex_snt;
Mf_metamisc = no_op3;
Mf_seqnum = no_op1;
Mf_eot = no_op0;
@@ -3240,11 +3299,6 @@ int argc;
{
midiprint = 3;
}
arg = getarg("-midinotes-brief",argc,argv);
if (arg != -1)
{
midiprint = 4;
}
usesplits = 0;
@@ -3483,7 +3537,6 @@ int argc;
printf(" -origin <string> Adds O: field containing string\n");
printf(" -midigram Prints midigram \n");
printf(" -midinotes Prints pitches with bends\n");
printf(" -midinotes-brief Prints only pitches and bends\n");
printf(" -mftext mftext output in beats\n");
printf(" -mftextpulses mftext output in midi pulses\n");
printf(" -mftext mftext output in seconds\n");
@@ -3718,7 +3771,7 @@ verylasttick = 0;
for (i=0;i<17;i++) {
if(verylasttick < last_tick[i]) verylasttick = last_tick[i];
}
printf("%d\n",verylasttick);
/*printf("%d\n",verylasttick);*/
}
void mftext(argc,argv)
@@ -3744,6 +3797,8 @@ int argc;
FILE *efopen();
int arg;
zeroBentPitches ();
arg = process_command_line_arguments(argc,argv);
switch (midiprint) {
case 1: initfunc_for_midinotes();