lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: LilyPond blog has new home!


From: Karl Hammar
Subject: Re: LilyPond blog has new home!
Date: Wed, 10 Jul 2013 11:07:36 +0200 (CEST)

David Kastrup:
> address@hidden (Karl Hammar) writes:
> 
> > If you look at:
> >
> >  http://downloads2.makemusic.com/blog/elementsv1-p221.pdf &
> >
> > from his "Binary Theory and Creation of the Fundamental Rhythm
> > Patterns", you'll see that the table is simply a 
> >
> >  pattern = 0x00E0; // where each bit '1' is 64th note, '0' 64 pause
> >
> >  while ( pattern < 0xFF ) {
> >   print_top7bits(pattern);
> >   print_byte(pattern);
> >   pattern++;
> >   print_byte(pattern);
> >   pattern++;
> >   next_line();
> >  }
> >
> >  make_box();
> >
> > How hard would that to do in lilypond ?
> 
> Well, obviously pretty easy once you have "print_byte" and their ilk.
> Without any such helper functions, something like

In the file attached to Davids mail:

\new RhythmicStaff \with { \omit TimeSignature }
{ \time 1/8
  #@(map (lambda (s) #{ <>[ address@hidden s64] | address@hidden r64 | 
address@hidden c'64 \break #})
         (map (lambda (pattern)
                (map (lambda (bit)
                       (if (logbit? bit pattern)
                           #{ c'64 #}
                           #{ r64 #}))
                     (iota 7 7 -1)))
              (iota 16 224 2)))
}


That was all too easy!!!!

Here is the next version (with barnumber used as exercise no.,
and maybe one should group beams four notes a time):

///////
\paper {
  indent = 0 \mm
}

#(set-global-staff-size 16) % for A4 at least

\new RhythmicStaff \with { \omit TimeSignature }
{
  \time 3/8
  \set Score.barNumberVisibility = #all-bar-numbers-visible
  \bar ""
  #@(map (lambda (s) #{ <>[ address@hidden s64] \bar "|" <>[ address@hidden 
r64] \bar "|" <>[ address@hidden c'64] \break #})
         (map (lambda (pattern)
                (map (lambda (bit)
                       (if (logbit? bit pattern)
                           #{ c'64 #}
                           #{ r64 #}))
                     (iota 7 7 -1)))
              (iota 16 224 2)))
}
///////

  Maybe I will find time to expand this multiple pages...

  It seems that

#(define (byteToPfx byte)
         (map (lambda (bit)
                      (if (logbit? bit byte) #{ c'64 #} #{ r64 #}))
              (iota 8 7 -1)))

#@(byteToPfx 34) c'64

  (Is lilypond-mode up to standard indenting thoose things?)
  is just producing side effects and to be able to return a music
  expression, I have to use define-music-function, is it so ?

#(define (showByte  byte) (display byte)(newline))
#(showByte 224)

  works as expected, but for byteToPfx I have to use #@, so is
  returning something, but what is it returning?

Regards,
/Karl Hammar

-----------------------------------------------------------------------
Aspö Data
Lilla Aspö 148
S-742 94 Östhammar
Sweden
+46 173 140 57





reply via email to

[Prev in Thread] Current Thread [Next in Thread]