[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Denemo-devel] New Education script::Counting half steps
From: |
Richard Shann |
Subject: |
Re: [Denemo-devel] New Education script::Counting half steps |
Date: |
Fri, 20 Feb 2015 17:24:53 +0000 |
(this is just another instalment ... I can't write for long)
You have code that looks like this:
(display "You have chosen ")
(display CountHalfSteps::userinput)
(display " half steps")
(newline)
(display "The answer was ")
(display CountHalfSteps::interval)
(newline)
You can replace this with the use of Denemo's (disp ...) procedure which
can take any number of arguments so it would look like
(disp "You have chosen " CountHalfSteps::userinput " half steps\nThe
answer was " CountHalfSteps::interval "\n")
Another simplification - I assume none of the variables are used outside
of the script, so there is no need to create all those global variables
starting CountHalfSteps::
instead can avoid the long-winded names like CountHalfSteps::userinput
by enclosing the entire script in a (let ....) like this
(let ((userinput #f) (...) (...))
the current script with CountHalfSteps::userinput replaced by userinput
and the (define CountHalfSteps::userinput 0) replaced with (set!
userinput #t) ...
)
Here the let is followed by a list of pairs, the name of the variable
and the initial value. This variable name is then local to the script.
The (display ...) feedback is only for debug I guess? You can use those
ticks and crosses for visible feedback to the user - I think you have
used them before? if not let me know and I can look them out.
Richard
On Wed, 2015-02-18 at 10:16 -0600, Jeremiah Benham wrote:
> I wrote a new script to drill the counting of half steps. It is still
> a work in progress because if a note has an accidental already in a
> measure then the second note inserted may be inaccurate because it
> can't tell if the current accidental list (in that measure) contains
> the note to be inserted. I was wondering how to remedy this. I could
> create an array defining accidentals to be something like -2 0 0 0 0 0
> 0 meaning that "A" has a double flat. I tried making the note inserted
> a whole note so that the accidental list is reset with each insert
> because the whole note takes up the entire measure. The problem I had
> was that occasionally denemo tried to put two whole notes in one
> measure. The only happened about 30% of the time. I guess it would be
> possible maybe desirable to write something in c that inserts lilypond
> note with the prevailing duration. At the moment we have the ability
> to place cursor at lilypond note. This is what I am currently using
> followed by a (d-1) to insert a half note.
>
>
> With a little modification the script can also drill half and whole
> step counting. This leads the student into spelling scales and chords.
> I hope to make some scripts for that also.
>
>
> Jeremiah
>
>
>
> _______________________________________________
> Denemo-devel mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/denemo-devel