On Sat, 2018-04-07 at 22:55 -0400, Freeman Gilmore wrote: > > [...]
The example (see below) was: (let ((tag "makam")) (d-DirectivePut-note-postfix tag "k") (d-DirectivePut-note-override tag DENEMO_OVERRIDE_AFFIX) (d-DirectivePut-note-graphic tag "accidentals.sharp.slashslashslash.stem") (d-DirectivePut-note-gx tag -10) (d-SetSaved #f)) > > [...] > > This is *way* simpler than anything you would need an IDE for. The > > main > > work is deciding what LilyPond syntax you want to emit, and what > > you > > would like to see in the Denemo Display to correspond with it. If > > you > > can post up examples of the LilyPond syntax you would like then the > > rest is relatively easy... > > > > I hope the above gives you a flavor of what creating some new > > features > > would be like - it has been done by non-programmers before, so > > there is > > no cause to be daunted. I should note that the above script > > requires > > the latest version 2.2.7 which will be built tonight because > > testing it > > out revealed that placement of the "k" *before* the octave > > indicator > > was not being honored :( ... > > So if you download > > > > http://www.denemo.org/~jjbenham/mxe/denemo.zip > > > > tomorrow you can try it out. > > > > Richard > > > > > Richard: > > That gave me a good overview, thanks. You said "Well, as I say, you > wouldn't need to study the Scheme syntax to do this..."; but you did > not say what was a good source to study? A source to study the Scheme language? Well I have just worked from the Guile manual https://www.gnu.org/software/guile/manual/html_node/index.html but that would be very daunting. (I should explain that Guile is the Scheme interpreter we use inside Denemo). Scheme is an extremely minimal language however, you can get by just knowing that Scheme is based on lists, notated as ( .... ) So this is the start of a list (let ((tag "makam")) and the first item "let" tells the interpreter to expect a list of variable definitions next. In this case there is one variable definition in the list (tag "makam") which is defining a variable called "tag" to have the value the string "makam". This is just to save retyping the tag that will be used in the following lines to identify the Denemo Directive being attached to the note. All the rest of the list that (let ...) started are calls to Denemo's library of procedures which attach a Denemo Directive to the note at the cursor. (When generating the syntax for the note, Denemo looks at the attached Directives' prefix and postfix fields and adds-in whatever it is there to the syntax, so this is the way of changing the output LilyPond syntax for the note). The second item in the (let ...) list is this: (d-DirectivePut-note-postfix tag "k") The procedure in this case is d-DirectivePut-note-postfix which is the Denemo procedure to put a value into the "postfix" field of a Denemo directive attached to the note. The Directive is identified by the tag "makakm", as there may be more than one attached to the note (e.g. a note with a trill and a fermata). The Directive will be created if it does not already exist. The "postfix" field will be emitted into the LilyPond syntax after the syntax for the note. The rest of the list is similar procedures filling in other fields of the same Denemo Directive, and finally setting the flag to say that this score has been modified and will therefore need saving before the user quits. > > In the d- [procedures] is tag to get a input variable? No, tag is a Scheme variable defined inside the (let ....) block to have the value the string "makam". You could avoid it altogether, just writing (d-DirectivePut-note-postfix "makam" "k") but that would invite re-typing "makam" four times, with the danger of introducing a typo. > I.e. (d-DirectivePut-note-postfix tag > "k"), k is the input value of the variable? No "k" is a string, the second parameter to the procedure d-DirectivePut-note-postfix which is defined (inside Denemo) to be a procedure expecting two strings as parameters, namely the tag identifying the Directive and the string to be placed in the "postfix" field of the Denemo Directive (and hence to become part of the output LilyPond syntax for this note). So this will cause "k" to be placed in the output LilyPond syntax along with the note name, octave indication etc. which the note prescribes. > So does (d-DirectivePut-note-postfix tag "x") contain all the > glyphs? No, the glyphs are all contained in a font file somewhere in the system. Each glyph has a name (such as accidentals.sharp.slashslashslash.stem) which Denemo can use to display the glyph in the Denemo Display. The line (d-DirectivePut-note-graphic tag "accidentals.sharp.slashslashslash.stem") sets the "graphic" field of the Denemo Directive being attached to the note to the string "accidentals.sharp.slashslashslash.stem" which is the name of one of the glyphs. Denemo uses the graphic field to display that glyph at the position of the note, so that you can see in the Denemo Display that something is attached to the note. I'm writing this up with the hope that it might all be clearly documented one day - there is stuff in the Help manual about this but at the moment I suspect it is only the examples that you can see by right clicking on a command and choosing "Get Script into Scheme Window" that really help people get started. Many of those scripts are real programming - there is even one that loads Handel's figured bass exercises, picks up your harmonization an turns it into notation and then checks for consecutives in the result! But for such simple tasks as adding a bit of LilyPond syntax to a note just a few lines are needed. The real work is working out whether LilyPond is capable of generating the finished typeset you are hoping for. *DO* check this carefully first - people over the years have added various features to LilyPond but often they aren't as complete as they could be and may not serve you purpose. So, before putting a lot of effort in, make sure LilyPond is capable of giving you the typeset output you need. HTH Richard _______________________________________________ Denemo-devel mailing list [email protected] https://lists.gnu.org/mailman/listinfo/denemo-devel
