Re: Harmonica tablature notation

2009-10-31 Thread Gilles THIBAULT

how to code a tail-recursive version of this.

#(define (draw hole nbends)
 (define bend-glyphs )
 (while
   ( nbends 0)
   (set! bend-glyphs (markup #:flat bend-glyphs))
   (set! nbends (1- nbends)))
 (markup bend-glyphs #:circle hole))


Perhaps something like that ? :

#(define (draw hole nbends)
 (let loop ((bend-glyphs )
(n nbends))
 (if ( n 0)
   (loop (markup #:flat bend-glyphs)
(1- n))
   (markup bend-glyphs #:circle hole


thanks for your example showing how to use
\applyMusic - it helped me with a similar problem.


Well, for me, I don't really undersand the difference between :
\context Voice = melody
   \applyMusic #(lambda (x) (music-map add-harmonica x)) \notes
and
\context Voice = melody  \musicMap #add-harmonica \notes  ?

It seems to have the same result.

Gilles




___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Harmonica tablature notation

2009-10-30 Thread Trevor Daniels


bradford powell wrote Sunday, October 25, 2009 2:32 AM

I would appreciate any comments. One area in particular that I 
have
questions about is cleaning up the case statement that converts 
pitch
to markup-- specifically in that I am weirdly interspersing 
lilypond

syntax (with the '(markup #:flat #:flat #:circle 2)'-type
statements). I would prefer to have a function like for blow and 
for
draw that can incorporate parameters for the hole and the number 
of

bends. I've tried:

#(define draw hole bends) (markup (make-list-markup (append (list
#:simple) (make-list bends #:flat) (list hole)

This doesn't work, any suggestions?


This is not very elegant and not very Scheme-like,
but I think it works.  I'm sure someone can show us
how to code a tail-recursive version of this.

#(define (draw hole nbends)
 (define bend-glyphs )
 (while
   ( nbends 0)
   (set! bend-glyphs (markup #:flat bend-glyphs))
   (set! nbends (1- nbends)))
 (markup bend-glyphs #:circle hole))

Call with ((1) (draw 4 1 )) etc in your
case statement.

BTW, thanks for your example showing how to use
\applyMusic - it helped me with a similar problem.

Trevor



___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Harmonica tablature notation

2009-10-27 Thread bradford powell
On Mon, Oct 26, 2009 at 4:12 PM, Robin Bannister r...@dataway.ch wrote:
 #(define* (draw hole #:optional (bends 0))  (markup (make-line-markup
 (make-list bends #:flat )) #:circle hole))

  The make-list result is not itself a markup; for that, it must be passed to
 something like #:line.    And then the restriction at the end of NR 6.4.1
 applies.
 http://lilypond.org/doc/v2.12/Documentation/user/lilypond/Markup-construction-in-Scheme


When I try that (with something like (draw 4 1)), I still get:
 error: make-line-markup: Invalid argument in position 1.  Expect:
list of markups, found: (#:flat)

I guess I could just hard-code the different degrees of bending, but
it seems like there should be a way to do this.

-- Bradford


___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Harmonica tablature notation

2009-10-27 Thread Carl Sorensen
bradford powell bradford.powell at gmail.com writes:

 
 My first thought was to write an engraver (since that is what guitar
 tablature seems to do). 

Writing an engraver is not as difficult as it seems, as long as you have good
models to follow.  But it *is* an involved process, and isn't the easiest way
for a new developer to get started.


 After looking into the source a bit, and
 deciding to try to avoid needing to recompile,

Recompiling is virtually impossible on windows, but it's doable on Linux and
OS/X.  If you really want to do some developing (and you're not on Windows),
it's probably worth learning to compile LilyPond.

 I have tried two other
 approaches. The first is based on adding markup to notes similar to
 the commented-out 'add-staccato' function in 'ly/gregorian.ly'. The
 second approach (which I think I prefer) is to create lyrics using
 similar markup.

I prefer the markup to notes, rather than the lyrics approach.  But this
tablature is new to me; I learned to play harmonica with arrows 
indicating blow or draw and numbers indicating holes.

If you want to get the lyrics-based approach integrated into LilyPond, you'll
probably want a HarmonicaTab context and harmonica_tab_engraver.
You can copy this functionality from the FretBoards context and 
Fretboard_engraver.  These are pretty simple, and could form a template
for your work if you're interested.

 
 I would appreciate any comments. One area in particular that I have
 questions about is cleaning up the case statement that converts pitch
 to markup-- specifically in that I am weirdly interspersing lilypond
 syntax (with the '(markup #:flat #:flat #:circle 2)'-type
 statements). I would prefer to have a function like for blow and for
 draw that can incorporate parameters for the hole and the number of
 bends. I've tried:
 
 #(define draw hole bends) (markup (make-list-markup (append (list
 #:simple) (make-list bends #:flat) (list hole)
 

If you can write the code that will return the list of arguments that you
would like to have passed to the markup function, then you can do
something like this:

(append '(markup) (function-that-returns-argument-list))

to get the scheme function you want.

HTH,

Carl



___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Harmonica tablature notation

2009-10-26 Thread Robin Bannister
bradford powell wrote:   

 This doesn't work, any suggestions?



#(define* (draw hole #:optional (bends 0)) 
 (markup (make-line-markup (make-list bends #:flat )) #:circle hole))


 
The make-list result is not itself a markup; 
for that, it must be passed to something like #:line.
And then the restriction at the end of NR 6.4.1 applies.   
http://lilypond.org/doc/v2.12/Documentation/user/lilypond/Markup-construction-in-Scheme


Note that setting up markup for individual bend cases 
would let you use doubleflat, etc.  



Cheers,
Robin


___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


Harmonica tablature notation

2009-10-24 Thread bradford powell
Hello--

I have been trying to write something to produce tablature-like
notation for the harmonica. Googling revealed a post from several
years ago which involved preprocessing a lilypond file. Not only
out-of-date with regard to lilypond syntax, but I also prefer
something that would act from within lilypond.

For background, a diatonic harmonica (using the standard Richter
tuning) has ten holes. Each hole has two reeds which play two
different primary notes, one during exhalation (the blow notes) and
one during the inhalation (the draw notes). Some of these notes can
be bent to a varying degree to provide some chromatic notes by
flattening pitches. The site overblow.com gives a fairly complete
tuning chart. One way that I have seen beginner notation for this is
to have the hole numbers for blow notes and in circles for draw notes
(sometimes with arrows or some other notation for bends).

My first thought was to write an engraver (since that is what guitar
tablature seems to do). After looking into the source a bit, and
deciding to try to avoid needing to recompile, I have tried two other
approaches. The first is based on adding markup to notes similar to
the commented-out 'add-staccato' function in 'ly/gregorian.ly'. The
second approach (which I think I prefer) is to create lyrics using
similar markup.

So, the markup-based approach can be seen at
http://grove.ufl.edu/~bpow/lilypond-harmonica/harmonica-markup.ly and
http://grove.ufl.edu/~bpow/lilypond-harmonica/harmonica-markup.pdf

The lyric-based approch is at
http://grove.ufl.edu/~bpow/lilypond-harmonica/harmonica-as-lyrics.ly and
http://grove.ufl.edu/~bpow/lilypond-harmonica/harmonica-as-lyrics.pdf

I would appreciate any comments. One area in particular that I have
questions about is cleaning up the case statement that converts pitch
to markup-- specifically in that I am weirdly interspersing lilypond
syntax (with the '(markup #:flat #:flat #:circle 2)'-type
statements). I would prefer to have a function like for blow and for
draw that can incorporate parameters for the hole and the number of
bends. I've tried:

#(define draw hole bends) (markup (make-list-markup (append (list
#:simple) (make-list bends #:flat) (list hole)

This doesn't work, any suggestions?

-- Bradford


___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user