Jump to content

ABC - Problem with Q: field


Recommended Posts

I am using EasyABC on a HP machine running Windoze 10.

 

I have a problem with correct representation of numeric values in the Q: field. 

 

Briefly, any value above 127 produces an incorrect value both in the display, and in the generated PDF file.
Here's an example:

 

X:1
T:Newcastle
M:4/4
L:1/8
Q:1/4=150
K:G
|: A2 | "G" B2 d2 "D7" G2 A2 | "G" G3 A G2 D2 | "G" B2 d2 G2 d2 | "C" e2 g4 fe | 
 "G" d2 B2 A2 G2 | "C" E2 e4 dc | "G" d2 B2 "D7" A3 G |1 "G" G4 G2 :|2 "G" G6 |] 
|: ef | "G" gfed g3 B | "Am" A2 g4 A2 | "Em" G3 A "Bm" B2 F2 | "Em" E2 e4 f2 | 
 "G" gfed g3 B | "Am" A2 A2 c3 d | "C" e2 B2 "D7" A3 G | "G" G6 :|

 

I've attached the PDF generated by this ABC code - the metronome marking which should be 150 is
shown as -106.

 

A value of 127 works fine; a value of 128, yields -128; a value of 129 yields -127; and so on... (*)

I'm baffled by this - particularly as on my other W10 machine, it all works fine. 

 

Any ideas?

 

Thank you. (I thought I had already asked this question, but I can't find any trace...)

 

Roger

(*) It hasn't escaped my attention that 127=(2**7)-1, and that the value produced is a discontinuous function of the input Q: value:
        f(x)1:127=x; 
        f(x)128:256=x-256
       which just shows that I'm a right smarty-knickers, but which doesn't get me much forrader...
 ?

 

Newcastle.pdf

Edited by lachenal74693
Link to comment
Share on other sites

1 hour ago, lachenal74693 said:

(*) It hasn't escaped my attention that 127=(2**7)-1, and that the value produced is a discontinuous function of the input Q: value:
        f(x)1:127=x; 
        f(x)128:256=x-256
       which just shows that I'm a right smarty-knickers, but which doesn't get me much forrader...
 ?

 

 

You're on the right track. Whatever program EasyABC is using to render the ABC (abc2ps?) is storing the Q value in an unsigned 8 bit variable, without correctly validating that the number will fit in a variable of that size.

Link to comment
Share on other sites

Looking at this header file, tempo is defined as a short, which is usually 16 bits, not 8. Perhaps the compiler that was used for the DOS version of abcm2ps is treating short as 8 bits? Or maybe it's an older version that is using char instead of short? The parser function is reading the value into an int, then blindly copying it into a short (not good practice). I would be inclined to just change the type in the header file to an int.

Link to comment
Share on other sites

I just tried abcm2ps on MacOS (installed via Macports) and it correctly processes Q: values higher than 127, which suggests an issue with the DOS version included with EasyABC for Windows. Just for kicks, I tried giving it a tempo of 32768, and as expected it printed -32768 in the output (showing that it's storing the number in a signed 16 bit short variable).

Link to comment
Share on other sites

I have EasyABC version 1.3.5, running on Windows 10 home.

I pasted the ABC text above into a file and exported a PDF without changing anything.

The score displayed correctly with Q=150.    Newcastle.pdf

I can offer no explanation of why your program produced a different result.

You could try entering Q:150instead of Q:1/4=150. It may not make a difference but anything is worth trying.

Link to comment
Share on other sites

10 hours ago, David Barnert said:

I think so, too. It sounds familiar, from a long time ago.

 

You don’t really dance Newcastle at 150, do you?

 

Heh, heh, no - I just set it to 150 as an example which was >128...

 

Problem solved - I have version 1.3.7.7 installed, but the problem was with abcm2ps in version 1.3.7.6

(https://sourceforge.net/p/easyabc/tickets/12/), and I had foolishly got the 1.3.7.7 file settings pointing to

the old 1.3.6.6 copies of abcm2ps, etc. Correcting the file settings fixed the problem. What a dolt ? - I'm

normally a bit more careful than that!

 

Thank you for the responses folks.

 

Roger

Edited by lachenal74693
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...