lilypond-user
[Top][All Lists]
Advanced

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

Selected pieces in a book


From: Pierre Perol-Schneider
Subject: Selected pieces in a book
Date: Sat, 10 Oct 2015 19:41:56 +0200

Hi LilyPonders,

I'm trying to automagically select pieces within a library.
My first intention was to use 'tags' but it does not seem to work a that level.
So here's the idea: let say I include a full library in one file and I want to get a book with some pre-selected pieces only, e.g.:

\version "2.19.28"

my-first-piece = {
  \tag level-one {
    \relative c' {
      \mark "Level 1"
      c1 d e f g a b c
    }
  }
}

my-second-piece = {
  \tag level-one {
   \relative c' {
     \mark "Level 1"
     c2 d e f g a b c
   }
  }
}

my-third-piece = {
  \tag level-two {
    \relative c' {
      \mark "Level 2"
      c4 d e f g a b c
    }
  }
}

my-fourth-piece = {
  \tag level-two {
    \relative c' {
      \mark "Level 2"
      c8 d e f g a b c
    }
  }
}

%% Full library included:
my-library = \book {
  \score { \my-first-piece }
  \score { \my-second-piece }
  \score { \my-third-piece }
  \score { \my-fourth-piece }
}

%% Select pieces by level:
\book {
  \bookpart {
    %% Select only 'level 1 pieces':
    %\keepWithTag #'level-one {
      \my-library
    %}
    \header {
      title = "Level I"
    }
  }
  \bookpart {
    %% Select only 'level 2 pieces':
    %\keepWithTag #'level-two {
      \my-library
    %}
    \header {
      title = "Level II"
    }
  }
}

 

Any idea how to achieve that ?

Cheers,
~Pierre

reply via email to

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