bugDenemo - Bugs: bug #29399, Timesignature query in scheme

 
 

bug #29399: Timesignature query in scheme

Submitter:  None
Submitted:  Thu 01 Apr 2010 12:41:23 AM UTC
   
 
Category:  Feature request Severity:  3 - Normal
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  None
Originator Name:  Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Sat 24 Apr 2010 10:35:53 AM UTC, comment #11: 

I have updated the Arbitrary Tuplet script to use the built-ins as they seem to be ok.

Richard Shann <rshann>
Group administrator
Fri 23 Apr 2010 08:35:55 PM UTC, comment #10: 

I just noticed some orphan code in C to set arbitrary values for tuplets. I have created a d-SetTuplet command that mimics what this would have done if it had worked. That is it sets numerator and denominator to the values passed.

so for example

(d-SetTuplet "5/7")

edits the TUPOPEN object at the cursor so that in LilyPond it issues a \times 5/7
or whatever the exact syntax is.

I have done this in case it is useful: I don't use this stuff myself, and I don't know what the implications are, either for the Denemo display or the .pdf output.
But if it helps, there it is...

Richard Shann <rshann>
Group administrator
Fri 23 Apr 2010 07:10:36 PM UTC, comment #9: 

It should be fine that TUPCLOSE doesn't have any info associated with it.  I'll just store the tuplet factors in a list or stack and get the most recent one instead of trying to query TUPCLOSE.  Probably 90% of the time even that will be overkill, nested tuplets not being too common as far as most people are concerned, I'd imagine, in which case a single variable will suffice.

I think the rebar script will do fine for finding over- or underlength measures once the tuplet, timesig and grace note stuff is in and working.  I can modify it so that it just stops at the first incorrect measure if you pass a certain parameter.
-Dan

Anonymous
Fri 23 Apr 2010 05:10:08 PM UTC, comment #8: 

d-GetTuplet is now in git

Richard Shann <rshann>
Group administrator
Fri 23 Apr 2010 04:57:20 PM UTC, comment #7: 

To pick up on just one point: TUPCLOSE objects don't have any other information stored with them. To know what (if anything) is being closed a search would have to be made.
Querying the TUPOPEN can be done quite easily - I change the status for that.
The non-built-ins will need to be done by finding the directives of the right tag and so on, unless a fairy godmother arrives to start hacking the C code for them.
Finding an overlength/underlength measure is a high priority for me - I would like a script that can be run before printing to check for this. I don't think it needs any more C support, just someone with scheme and some time.

Richard Shann <rshann>
Group administrator
Fri 23 Apr 2010 03:29:56 PM UTC, comment #6: 

Richard,
Thanks for the work on the grace note query stuff.  The grace query looks like it should be perfect.
The reason I didn't just go with GetDurationInTicks originally is that as far as it's concerned, everything must be a divisor of 1536 =the number of ticks of a whole note (at least assuming as I did that it always returns an integer).  This is fine for quarters, eighths, and so on, as well as triplets, but since 1536=512*3, this won't work for most higher tuplets such as quintuplets and so forth.  So I used fractions as the durations in the rebar script to allow for arbitrary tuplets.
Now, if my assumption about GetDurationInTicks always returning a whole number is wrong, then all of that is moot, and that would probably be a much easier way to implement rebar.  I actually never did try to check what it returns on say a quintuplet.
For now, I'm going to stick with fractions since, for all I know, the 1536 is an arbitrary number possibly subject to change, although that too could be worked-around.

As far as how to deal with tuplets in denemo, this is how I've been picturing it:
Right now there are two ways to set a tuplet in denemo--the built-ins (giving type TUPOPEN &c.), and the standalone lilydirectives made from the arbitrary tuplet script that denemo mostly ignores last I knew, but which affect the lilypond.  I think either of these ways would be simple enough to work into the rebar script, and possibly right now I could even update rebar to work with the lilydirectives ones now that I think of it. 
I think it would suffice if there was a way to query the TUPOPEN objects as well as the TUPCLOSE ones, and get what type of tuplet they are, ideally as a string which when converted via string->number gives a fraction equal to the duration scale factor, if you see what I mean.  So an ordinary triplet would return "2/3", quintuplets "4/5", and so on.  It would be important to have the TUPCLOSE return the same string as well, since there can be nested tuplets and I plan on something like this:
if gettype returns TUPOPEN, TupletScaleFactor *= (query the tuplet and convert its string to a fraction)
if gettype returns TUPCLOSE, TupletScaleFactor /= (query for the string, convert to frac)

This would allow for nested tuplets.
Does this seem feasible and in keeping with whatever plans you have for tuplets?  In my view the ideal situation would be to (eventually) make denemo aware of the directive-type tuplet commands, or else integrate all the various built-ins into one command that can handle an arbitrary fraction.  If people want individual commands like triplet, bind it to the script (d-InsertTuplet "2/3"), or something similar.  I'm aware that this might not be a priority.

Actually I'm not sure that the rebar should try to fix a measure with tuplets not adding up; probably should just alert user's attention to that measure if the excess ends up being something like 2 septuplets. 
As a final comment, is there a way to query denemo from scheme if a measure is full or too small or too big?  It would probably speed up the script, for what it's worth.
-Dan W.

Anonymous
Fri 23 Apr 2010 01:10:11 PM UTC, comment #5: 

d-GetDurationInTicks is now working for grace notes and triplets - can you use this???
Otherwise you have to test for being in a tuplet by scanning for objects of type TUPOPEN and TUPCLOSE (and I am not sure that enquiring of the TUPOPEN properties is ready to use...)
I have a feeling this is suggesting a different approach to ReBar, but it should be an easier one.

Richard Shann <rshann>
Group administrator
Fri 23 Apr 2010 10:30:03 AM UTC, comment #4: 

(d-ToggleGrace "query=") now returns boolean #f if not a grace note at cursor, it returns a string "grace" if there is a grace note at cursor. Sorry about the assymettry,
it might be better to enquire the duration - I think we have something for that (DurationInTicks???)

Richard Shann <rshann>
Group administrator
Tue 20 Apr 2010 08:31:39 PM UTC, comment #3: 

Hi,
   I don't think there's currently a way to query whether a note is a grace or not.
   Looking around in the c code, in scheme_cb.h it looks like there is code to check if the string passed with (d-ToggleGrace) begins with "query", and if so it sets a parameter to pass the "query..." string to set_grace_cb which I found in callbacks.h.  But that code seems to ignore the parameter, which would mean that there is no way to query right now.
   Just going to those two files and searching for set_grace_cb will show the spots where I was looking.
   Is that right?  That's how it looks with my limited knowledge of C and even less of the denemo code. 
   This will be needed in a final rebar version.
-Dan W.

Anonymous
Sun 18 Apr 2010 11:56:26 PM UTC, comment #2: 

OK, thanks for this information. 
1.I'll update the Rebar script to use this command--unless I should consider it deprecated and leave it til something better is written?  I.e., do you plan to remove this "query=timesigname" stuff?
2.I suppose I should see if I can find this by digging around in the C like you did, but... do you know if this is possible to get info on tuplets this way?
3.Same as 2, but for grace notes: can we get in scheme whether a note is a grace or not?  If there's an obvious way to do it I'm not aware of it.
With 2 and 3 come this caveat for the rebar:  As it stands now it will mess up your score if you run it and there are tuplets or grace notes, since it will read these as "face value" notes.
One final question:
4.What will be the "official" denemo way to do tuplets?  As I remember there currently are the built-ins, and the standalone directives that just tell lilypond that these are tuplets.  As far as I know the latter are unrecognized by denemo in any way other than as miscellaneous directives, but are more versatile due to being able to specify arbitrary factors such as \times 4/7.  So, a) do you expect the stand-alone tuplet directives will eventually have midi support and be counted properly by denemo?  b) Will the built-ins still be around or will they be phased out?  More to the point, which way should I write the rebar script to deal with tuplets?  Or is it too early to worry about?
Thanks,
Dan W.

Anonymous
Sat 17 Apr 2010 05:14:37 PM UTC, comment #1: 

Hmm, I seem to have coded these already, e.g.

(display (d-InsertTimeSig "query=timesigname"))

displays 4/4 in the terminal. This fact cannot be deduced from the documentation:( In fact, it took a bit of detective work looking at the C-code to find this out.
I think this scheme of invoking the denemo commands with "query=xxx" needs replacing with a nicely defined command set - see "complete set of orthogonal commands" in the todo list...

Richard Shann <rshann>
Group administrator
Thu 01 Apr 2010 12:41:23 AM UTC, original submission:  

Hi,
   Before anyone can write a proper redraw barlines function, we'll need a way to get the time signature-initial and changes-in scheme.  Ways to identify grace notes and tuplets would be necessary for the final version as well.
Dan W.

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by steele (Updated the item)
  • -email is unavailable- added by rshann (Posted a comment)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2010-12-04 steele Open/ClosedOpen Closed
    2010-08-10 rshann StatusIn Progress Fixed
    2010-04-23 rshann StatusFixed In Progress
    2010-04-17 rshann StatusNone Fixed

    Back to the top

    Powered by Savane 3.13-cf05.
    Corresponding source code