]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-1.3.144
authorfred <fred>
Wed, 27 Mar 2002 00:59:19 +0000 (00:59 +0000)
committerfred <fred>
Wed, 27 Mar 2002 00:59:19 +0000 (00:59 +0000)
17 files changed:
input/test/nested-groups.ly [new file with mode: 0644]
input/test/test-german-chords.ly
input/tricks/drums.ly [new file with mode: 0644]
input/tricks/follow-thread.ly
lily/audio-staff.cc
lily/include/audio-staff.hh
lily/include/music.hh
lily/midi-item.cc
lily/midi-walker.cc
lily/music.cc
lily/performance.cc
lily/staff-performer.cc
lily/system-start-delimiter-engraver.cc
ly/drumpitch.ly [new file with mode: 0644]
ly/params.ly
scm/drums.scm [new file with mode: 0644]
scm/lily.scm

diff --git a/input/test/nested-groups.ly b/input/test/nested-groups.ly
new file mode 100644 (file)
index 0000000..07858bb
--- /dev/null
@@ -0,0 +1,46 @@
+\header{
+texidoc="
+In InnerStaffGroup and InnerChoirStaff, the brackets should be shiftet leftwards.
+";
+filename =      "nested-groups.ly";
+description =   "Test of nested staff groups and choirstaffs";
+enteredby =     "RZ";
+copyright =     "public domain";
+Tested =        "Nested StaffGroups";
+}
+
+\version "1.3.140" % rz1
+
+\score { \notes
+<
+  \context StaffGroup = ga < 
+  \context Staff = sb {c' d' e' f'}
+  \context InnerStaffGroup = isga <
+   \context Staff = sd {c' d' e' f'}
+   \context GrandStaff=gs <
+     \context Staff = sgsa {c' d' e' f'}
+     \context Staff = sgsb {c' d' e' f'}
+   >
+  \context Staff = sc {c' d' e' f'}
+  >
+  \context ChoirStaff = csa <
+   \context Staff = sd {c' d' e' f'}
+    \context InnerStaffGroup=gc <
+     \context Staff = sq {c' d' e' f'}
+    >
+   \context Staff = se {c' d' e' f'}
+  >
+  >
+  \context ChoirStaff = csb < 
+   \context Staff = sg {c' d' e' f'}
+   \context InnerStaffGroup = isgb <
+    \context Staff = sh {c' d' e' f'}
+    \context Staff = si {c' d' e' f'}
+   >
+   \context Staff = sj {c' d' e' f'}
+  >
+
+>
+
+ \paper { linewidth = -1; }
+}
index 0df2a1a39db713bbf1bdaac23d89836de809ed69..62fba8edb10901ecc0bb2116c68e17489e1f6e9b 100644 (file)
@@ -1,13 +1,13 @@
 \include "german-chords.ly"
+
 % #(set! german-Bb #t)
 
 ch = \chords { beses1/+beses bes/+bes b/+b bis/+bis ases/+ases as/+as a/+a ais/+ais fisis/+fisis}
 
-
 \score {
    <
-   \context ChordNames=ch {\ch}
-   \context Staff=st \chords {\ch}
+   \context ChordNames=chn {\ch}
+   \context Staff=stf \chords {\ch}
    >
    \paper {}
 }
diff --git a/input/tricks/drums.ly b/input/tricks/drums.ly
new file mode 100644 (file)
index 0000000..ae4ac81
--- /dev/null
@@ -0,0 +1,59 @@
+% tests drum notation and midi-drums.
+% see ly/drumpitch.ly for list of instruments and paper-kits.
+%     scm/midi.scm for list of midi-drumkits.
+
+\include "drumpitch.ly";
+
+\version "1.3.142"
+
+drh = \notes { cymc4.^"crash" hhc16^"h.h." hh \repeat "unfold" 5 {hhc8 hho hhc8 hh16 hh} hhc4 r4 r2 }
+drl = \notes {\repeat "unfold" 3 {bd4 sn8 bd bd4 <bd ss>} bd8 tommh tommh bd toml toml bd tomfh16 tomfh }
+timb = \notes \repeat "unfold" 2 {timh4 ssh timl8 ssh r timh r4 ssh8 timl r4 cb8 cb}
+
+\score { \repeat "volta" 2
+ <
+  \context TwoLineStaff=timbst \notes <
+    \property Staff.instrument="timbales"
+    \clef "percussion";
+    \apply #(drums->paper 'timbales) \timb
+  >
+  \context Staff=drumst \notes <
+    \property Staff.instrument="drums"
+    \clef "percussion";
+    \apply #(drums->paper 'drums) <
+      \context Voice=voa {\stemUp \drh }
+      \context Voice=vob {\stemDown \drl }
+    >
+  >
+ >
+ \paper {
+   \translator {
+      \StaffContext
+      \consists Instrument_name_engraver;
+      Script \override #'padding = #0.5
+   }
+   \translator {
+      \StaffContext
+      \name TwoLineStaff;
+      \alias Staff;
+      \consists Instrument_name_engraver;
+      StaffSymbol \override #'line-count = #2;
+      BarLine \override #'bar-size = #2;
+   }
+   \translator {
+      \ScoreContext
+      \accepts TwoLineStaff;
+   }
+ }
+}
+
+\score { \repeat "unfold" 2
+  \context Staff \notes <
+    \property Staff.instrument="drums"
+    \timb
+    \drh
+    \drl
+  >
+  \midi{ \tempo 4=120; }
+}
+
index c09efe20756b2a460b640c3480f0c6996cc1ea0a..2771cb871b310aeb826525fca90f882de4d3e264 100644 (file)
@@ -5,11 +5,14 @@ Theads can be traced automagically when they switch staffs by setting
 property @code{followVoice}.
 ";
 }
-% followThread: connect note heads with line when thread switches staff 
+
+\version "1.3.139"
+% followVoice: connect note heads with line when thread switches staff 
 
 fragment = \notes {
   \context PianoStaff <
     \property PianoStaff.followVoice = ##t
+    \property Voice.VoiceFollower \set #'type = #'dashed-line
     \context Staff \context Voice {
       c'1
       \translator Staff=two
index 4a89b66555eadfb241af778393d38be03246df7e..791287ab25474c1c2533bde313642b4017fc8570 100644 (file)
@@ -24,6 +24,7 @@ Audio_staff::output (Midi_stream& midi_stream_r, int track_i)
 {
   Midi_track midi_track;
   midi_track.number_i_ =  track_i;
+  midi_track.channel_i_ =  channel_i_;
   for (Midi_walker i (this, &midi_track); i.ok (); i++)
     i.process ();
   midi_stream_r << midi_track;
index 2bda2aff9f97db68dc96c2a4a13c1a7cca84840c..23aa6e4b571df4af3d41e4252793c2e04102f7ba 100644 (file)
@@ -16,6 +16,7 @@ struct Audio_staff : public Audio_element {
   void output (Midi_stream& midi_stream_r, int track_i);
 
   Link_array<Audio_item> audio_item_l_arr_;
+  int channel_i_;
 };
 
 #endif // AUDIO_STAFF_HH
index 2b11f459c166b8bad89e1b04d1a41f9c1cc32806..2c67ebdd90e00bd35743dffe7cc4b4f8871984c7 100644 (file)
@@ -58,6 +58,7 @@ public:
   /// Scale the music in time by #factor#.
   virtual void compress (Moment factor);
   VIRTUAL_COPY_CONS (Music);
+  Music ();
   Music (Music const &m);
   Music (SCM);
 protected:
index fc0cf8c8a2b2082c6f9eb28abd218d94287f704e..fb3d1eb5e6d429940e126d63aba334f95e1f0f9a 100644 (file)
@@ -118,177 +118,6 @@ Midi_header::Midi_header (int format_i, int tracks_i, int clocks_per_4_i)
   set ("MThd", str, "");
 }
 
-
-/* why doesn't this start at 0 ?
-
-   TODO: -> IN GUILE!
- */
-char const* const instrument_name_sz_a_[ ] = {
-  /* default is usually piano */
-  /* 0 "piano", */
-
-  /* (1-8 piano) */
-  /* 1 */ "acoustic grand",
-         /* 2 */ "bright acoustic",
-         /* 3 */ "electric grand",
-         /* 4 */ "honky-tonk",
-         /* 5 */ "electric piano 1",
-         /* 6 */ "electric piano 2",
-         /* 7 */ "harpsichord",
-         /* 8 */ "clav",
-
-         /* (9-16 chrom percussion) */
-         /* 9 */ "celesta",
-         /* 10 */ "glockenspiel",
-         /* 11 */ "music box",
-         /* 12 */ "vibraphone",
-         /* 13 */ "marimba",
-         /* 14 */ "xylophone",
-         /* 15 */ "tubular bells",
-         /* 16 */ "dulcimer",
-
-         /* (17-24 organ) */
-         /* 17 */ "drawbar organ",
-         /* 18 */ "percussive organ",
-         /* 19 */ "rock organ",
-         /* 20 */ "church organ",
-         /* 21 */ "reed organ",
-         /* 22 */ "accordion",
-         /* 23 */ "harmonica",
-         /* 24 */ "concertina",
-
-         /* (25-32 guitar) */
-         /* 25 */ "acoustic guitar (nylon)",
-         /* 26 */ "acoustic guitar (steel)",
-         /* 27 */ "electric guitar (jazz)",
-         /* 28 */ "electric guitar (clean)",
-         /* 29 */ "electric guitar (muted)",
-         /* 30 */ "overdriven guitar",
-         /* 31 */ "distorted guitar",
-         /* 32 */ "guitar harmonics",
-
-         /* (33-40 bass) */
-         /* 33 */ "acoustic bass",
-         /* 34 */ "electric bass (finger)",
-         /* 35 */ "electric bass (pick)",
-         /* 36 */ "fretless bass",
-         /* 37 */ "slap bass 1",
-         /* 38 */ "slap bass 2",
-         /* 39 */ "synth bass 1",
-         /* 40 */ "synth bass 2",
-
-         /* (41-48 strings) */
-         /* 41 */ "violin",
-         /* 42 */ "viola",
-         /* 43 */ "cello",
-         /* 44 */ "contrabass",
-         /* 45 */ "tremolo strings",
-         /* 46 */ "pizzicato strings",
-         /* 47 */ "orchestral strings",
-         /* 48 */ "timpani",
-
-         /* (49-56 ensemble) */
-         /* 49 */ "string ensemble 1",
-         /* 50 */ "string ensemble 2",
-         /* 51 */ "synthstrings 1",
-         /* 52 */ "synthstrings 2",
-         /* 53 */ "choir aahs",
-         /* 54 */ "voice oohs",
-         /* 55 */ "synth voice",
-         /* 56 */ "orchestra hit",
-
-         /* (57-64 brass) */
-         /* 57 */ "trumpet",
-         /* 58 */ "trombone",
-         /* 59 */ "tuba",
-         /* 60 */ "muted trumpet",
-         /* 61 */ "french horn",
-         /* 62 */ "brass section",
-         /* 63 */ "synthbrass 1",
-         /* 64 */ "synthbrass 2",
-
-         /* (65-72 reed) */
-         /* 65 */ "soprano sax",
-         /* 66 */ "alto sax",
-         /* 67 */ "tenor sax",
-         /* 68 */ "baritone sax",
-         /* 69 */ "oboe",
-         /* 70 */ "english horn",
-         /* 71 */ "bassoon",
-         /* 72 */ "clarinet",
-
-         /* (73-80 pipe) */
-         /* 73 */ "piccolo",
-         /* 74 */ "flute",
-         /* 75 */ "recorder",
-         /* 76 */ "pan flute",
-         /* 77 */ "blown bottle",
-         /* 78 */ "skakuhachi",
-         /* 79 */ "whistle",
-         /* 80 */ "ocarina",
-
-         /* (81-88 synth lead) */
-         /* 81 */ "lead 1 (square)",
-         /* 82 */ "lead 2 (sawtooth)",
-         /* 83 */ "lead 3 (calliope)",
-         /* 84 */ "lead 4 (chiff)",
-         /* 85 */ "lead 5 (charang)",
-         /* 86 */ "lead 6 (voice)",
-         /* 87 */ "lead 7 (fifths)",
-         /* 88 */ "lead 8 (bass+lead)",
-
-         /* (89-96 synth pad) */
-         /* 89 */ "pad 1 (new age)",
-         /* 90 */ "pad 2 (warm)",
-         /* 91 */ "pad 3 (polysynth)",
-         /* 92 */ "pad 4 (choir)",
-         /* 93 */ "pad 5 (bowed)",
-         /* 94 */ "pad 6 (metallic)",
-         /* 95 */ "pad 7 (halo)",
-         /* 96 */ "pad 8 (sweep)",
-
-         /* (97-104 synth effects) */
-         /* 97 */ "fx 1 (rain)",
-         /* 98 */ "fx 2 (soundtrack)",
-         /* 99 */ "fx 3 (crystal)",
-         /* 100 */ "fx 4 (atmosphere)",
-         /* 101 */ "fx 5 (brightness)",
-         /* 102 */ "fx 6 (goblins)",
-         /* 103 */ "fx 7 (echoes)",
-         /* 104 */ "fx 8 (sci-fi)",
-
-         /* (105-112 ethnic) */
-         /* 105 */ "sitar",
-         /* 106 */ "banjo",
-         /* 107 */ "shamisen",
-         /* 108 */ "koto",
-         /* 109 */ "kalimba",
-         /* 110 */ "bagpipe",
-         /* 111 */ "fiddle",
-         /* 112 */ "shanai",
-
-         /* (113-120 percussive) */
-         /* 113 */ "tinkle bell",
-         /* 114 */ "agogo",
-         /* 115 */ "steel drums",
-         /* 116 */ "woodblock",
-         /* 117 */ "taiko drum",
-         /* 118 */ "melodic tom",
-         /* 119 */ "synth drum",
-         /* 120 */ "reverse cymbal",
-
-         /* (121-128 sound effects) */
-         /* 121 */ "guitar fret noise",
-         /* 122 */ "breath noise",
-         /* 123 */ "seashore",
-         /* 124 */ "bird tweet",
-         /* 125 */ "telephone ring",
-         /* 126 */ "helicopter",
-         /* 127 */ "applause",
-         /* 128 */ "gunshot",
-         0
-}; 
-
 Midi_instrument::Midi_instrument (Audio_instrument* a)
 {
   audio_l_ = a;
@@ -296,23 +125,19 @@ Midi_instrument::Midi_instrument (Audio_instrument* a)
 }
 
 String
-Midi_instrument::str () const
+Midi_instrument::str() const
 {
   Byte program_byte = 0;
   bool found = false;
-  for (int i = 0; !found && instrument_name_sz_a_[i]; i++)
-    if (audio_l_->str_ == String (instrument_name_sz_a_[ i ])) 
-      {
-       program_byte = (Byte)i;
-       found = true;
-      }
-
-  if (!found)
-    {
+  SCM proc = scm_eval2 (ly_symbol2scm ("midi-program"), SCM_EOL); 
+  SCM program = gh_call1 (proc, ly_symbol2scm (audio_l_->str_.ch_C()));
+  found = (program != SCM_BOOL_F);
+  if (found)
+    program_byte = gh_scm2int(program);
+  else
       warning (_f ("no such instrument: `%s'", audio_l_->str_.ch_C ()));
-    }
-  
-  String str = to_str ((char) (0xc0 + channel_i_));
+
+  String str = to_str ((char) (0xc0 + channel_i_)); //YIKES! FIXME: Should be track. -rz
   str += to_str ((char)program_byte);
   return str;
 }
@@ -587,7 +412,6 @@ String
 Midi_track::data_str () const
 {
   String str = Midi_chunk::data_str ();
-  
   if (midi_debug_global_b)
     str += "\n";
   for (Cons<Midi_event> *i=event_p_list_.head_; i; i = i->next_) 
index 8be7056b36738bb54bdf81c4520b4c7773c5f85d..d9637672fbfca8b2c95cc207a1c126ea6458b5ad 100644 (file)
@@ -132,7 +132,8 @@ Midi_walker::process ()
  */
   if (Midi_item* midi_p = Midi_item::midi_p (audio_p))
     {
-      midi_p->channel_i_ = track_l_->number_i_;
+      midi_p->channel_i_ = track_l_->channel_i_;
+      //midi_p->channel_i_ = track_l_->number_i_;
       if (Midi_note* note_p = dynamic_cast<Midi_note*> (midi_p))
        {
          if (note_p->length_mom ())
index 2718004d2b84c57896b19d6f0b4e74358f241bdd..917e14021b4e75d8c2b535526ab42d195e61a922 100644 (file)
@@ -31,6 +31,13 @@ ly_deep_mus_copy (SCM m)
 }
 
 
+Music::Music ()
+{
+  immutable_property_alist_ = SCM_EOL;
+  mutable_property_alist_ = SCM_EOL;
+  smobify_self ();
+}
+
 Music::Music (Music const &m)
 {
   immutable_property_alist_ = m.immutable_property_alist_;
@@ -50,6 +57,7 @@ Music::Music (SCM l)
   smobify_self ();
 }
 
+
 SCM
 Music::mark_smob (SCM m)
 {
@@ -298,3 +306,4 @@ init_functions ()
   scm_make_gsubr ("ly-music-name", 1, 0, 0, (Scheme_function_unknown)ly_music_name);    
 }
 ADD_SCM_INIT_FUNC (musicscm,init_functions);
+ADD_MUSIC(Music);
index 436224bde8ae3c95417bb64f6d8f3dfa48f11df4..be168b2de052d6ff57c7a35a3d5363a431c93f46 100644 (file)
@@ -49,7 +49,7 @@ Performance::output (Midi_stream& midi_stream)
   output_header_track (midi_stream);
   progress_indication ("\n");
   progress_indication (_ ("Track ... "));
-  int channel = 1;
+  int channel = 0;
   for (int i =0; i < audio_staff_l_arr_.size (); i++)
     {
       Audio_staff *s = audio_staff_l_arr_[i];
@@ -62,7 +62,9 @@ Performance::output (Midi_stream& midi_stream)
        channel 10, the percussion channel by default.
        */
       if (channel == 9)
-       channel++;
+        channel++;
+      if (s->channel_i_ < 0)
+        s->channel_i_ = channel;
       s->output (midi_stream, channel++);
       if (verbose_global_b)
        progress_indication ("]");
@@ -74,6 +76,8 @@ Performance::output_header_track (Midi_stream& midi_stream)
 {
   Midi_track midi_track;
 
+  midi_track.channel_i_ = 9;
+
   // perhaps multiple text events?
   String id_str;
   String str = String (_ ("Creator: "));
index 41e7d1cf9252c8bc9b63741cf40b48a7afffc45f..f79bf760f28a37576cd4dec5b9c6a9e31040dbef 100644 (file)
@@ -91,6 +91,9 @@ Staff_performer::create_audio_elements ()
 void
 Staff_performer::stop_translation_timestep ()
 {
+  SCM proc = scm_eval2 (ly_symbol2scm ("percussion-p"), SCM_EOL); 
+  SCM drums_p = gh_call1 (proc, ly_symbol2scm (instrument_str_.ch_C()));
+  audio_staff_p_->channel_i_ = (drums_p == SCM_BOOL_T ? 9 : -1 );
   if (name_p_)
     {
       play_element (name_p_);
index 27ee99dc86b22375148e2f4431a1cae7b99432bd..cc017cbb2e7dca757573cfcdb9bd4bf06733ad4b 100644 (file)
@@ -52,17 +52,16 @@ System_start_delimiter_engraver::acknowledge_grob (Grob_info inf)
        */
       if (gh_symbol_p (gl) && gl  == ly_symbol2scm ("brace")
          && gh_symbol_p (my_gl) && my_gl == ly_symbol2scm ("bracket"))
-       inf.elem_l_->translate_axis (-1.0, X_AXIS); // ugh
+       inf.elem_l_->translate_axis (-0.8, X_AXIS); // ugh
       else if (gh_symbol_p (gl) && gl  == ly_symbol2scm ("bracket")
-              && gh_symbol_p (my_gl) && my_gl == ly_symbol2scm ("bracket"))
-       {
-         inf.elem_l_->translate_axis ( -0.8, X_AXIS); // ugh
-          inf.elem_l_->set_grob_property ("arch-height",
-         gh_double2scm(gh_scm2double(inf.elem_l_->get_grob_property
-                                     ("arch-height"))+0.5));
-        }
+              && gh_symbol_p (my_gl) && my_gl == ly_symbol2scm ("bracket"))
+       {
+         inf.elem_l_->translate_axis ( -0.8, X_AXIS); // ugh
+         inf.elem_l_->set_grob_property ("arch-height",
+           gh_double2scm(gh_scm2double(inf.elem_l_->get_grob_property
+                                       ("arch-height"))+0.5));
+       }
     }
-
 }
 
 System_start_delimiter_engraver::System_start_delimiter_engraver ()
diff --git a/ly/drumpitch.ly b/ly/drumpitch.ly
new file mode 100644 (file)
index 0000000..928512c
--- /dev/null
@@ -0,0 +1,154 @@
+% GM drum pitches.
+% I use different accidentals to distinguish drums at the same GM pitch.
+% Always accidental 0 (white keys) or 1 (black keys) to get the "correct" gm name.
+% i.e. fis, for closed highat ; ges, for highat.
+
+% 2001/03/25 Rune Zedeler <rune@zedeler.dk>
+
+
+#(define drum-pitch-names `(
+       (acousticbassdrum bda   ,(make-pitch -3 6 0 ))
+       (bassdrum         bd    ,(make-pitch -2 0 0 ))
+       (hisidestick      ssh   ,(make-pitch -3 6 2))
+       (sidestick        ss    ,(make-pitch -2 0 1))
+       (losidestick      ssl   ,(make-pitch -2 1 -1))
+       (acousticsnare    sna   ,(make-pitch -2 1 0))
+       (snare            sn    ,(make-pitch -2 2 -2))
+       (handclap         hc    ,(make-pitch -2 1 1))
+       (electricsnare    sne   ,(make-pitch -2 2 0))
+       (lowfloortom      tomfl ,(make-pitch -2 3 0))
+       (closedhihat      hhc   ,(make-pitch -2 3 1))
+       (hihat            hh    ,(make-pitch -2 4 -1))
+       (highfloortom     tomfh ,(make-pitch -2 4 0))
+       (pedalhihat       hhp   ,(make-pitch -2 4 1))
+       (lowtom           toml  ,(make-pitch -2 5 0))
+       (openhihat        hho   ,(make-pitch -2 5 1))
+       (halfopenhihat    hhho  ,(make-pitch -2 5 1))
+       (lowmidtom        tomml ,(make-pitch -2 6 0))
+       (himidtom         tommh ,(make-pitch -1 0 0))
+       (crashcymbala     cymca ,(make-pitch -1 0 1))
+       (crashcymbal      cymc  ,(make-pitch -1 1 -1))
+       (hightom          tomh  ,(make-pitch -1 1 0))
+       (ridecymbala      cymra ,(make-pitch -1 1 1))
+       (ridecymbal       cymr  ,(make-pitch -1 2 -1))
+       (chinesecymbal    cymch ,(make-pitch -1 2 0))
+       (ridebell         rb    ,(make-pitch -1 3 0))
+       (tambourine       tamb  ,(make-pitch -1 3 1))
+       (splashcymbal     cyms  ,(make-pitch -1 4 0))
+       (cowbell          cb    ,(make-pitch -1 4 1))
+       (crashcymbalb     cymcb ,(make-pitch -1 5 0))
+       (vibraslap        vibs  ,(make-pitch -1 5 1))
+       (ridecymbalb      cymrb ,(make-pitch -1 6 0))
+       (hibongo          boh   ,(make-pitch 0 0 0))
+       (lobongo          bol   ,(make-pitch 0 0 1))
+       (mutehiconga      cghm  ,(make-pitch 0 1 0))
+       (openhiconga      cgho  ,(make-pitch 0 1 1))
+       (hiconga          cgh   ,(make-pitch 0 2 -1))
+       (loconga          cgl   ,(make-pitch 0 2 0))
+       (hitimbale        timh  ,(make-pitch 0 3 0))
+       (lotimbale        timl  ,(make-pitch 0 3 1))
+       (hiagogo          agh   ,(make-pitch 0 4 0))
+       (loagogo          agl   ,(make-pitch 0 4 1))
+       (cabasa           cab   ,(make-pitch 0 5 0))
+       (maracas          mar   ,(make-pitch 0 5 1))
+       (shortwhistle     whs   ,(make-pitch 0 6 0))
+       (longwhistle      whl   ,(make-pitch 1 0 0))
+       (shortguiro       guis  ,(make-pitch 1 0 1))
+       (longguiro        guil  ,(make-pitch 1 1 0))
+       (guiro            gui   ,(make-pitch 1 0 2))
+       (claves           cl    ,(make-pitch 1 1 1))
+       (hiwoodblock      wbh   ,(make-pitch 1 2 0))
+       (lowoodblock      wbl   ,(make-pitch 1 3 0))
+       (mutecuica        cuim  ,(make-pitch 1 3 1))
+       (opencuica        cuio  ,(make-pitch 1 4 0))
+       (mutetriangle     trim  ,(make-pitch 1 4 1))
+       (triangle         tri   ,(make-pitch 1 4 2))
+       (opentriangle     trio  ,(make-pitch 1 5 0))
+       ; "transposing" pitches:
+       (oneup            ua    ,(make-pitch 0 1 0))
+       (twoup            ub    ,(make-pitch 0 2 0))
+       (threeup          uc    ,(make-pitch 0 3 0))
+       (fourup           ud    ,(make-pitch 0 4 0))
+       (fiveup           ue    ,(make-pitch 0 5 0))
+       (onedown          da    ,(make-pitch -1 6 0))
+       (twodown          db    ,(make-pitch -1 5 0))
+       (threedown        dc    ,(make-pitch -1 4 0))
+       (fourdown         dd    ,(make-pitch -1 3 0))
+       (fivedown         de    ,(make-pitch -1 2 0))
+))
+
+#(define drums `(
+       (acousticbassdrum default       ,#f       ,(make-pitch -1 4 0))
+       (bassdrum         default       ,#f       ,(make-pitch -1 4 0))
+       (sidestick        cross         ,#f       ,(make-pitch 0 1 0))
+       (acousticsnare    default       ,#f       ,(make-pitch 0 1 0))
+       (snare            default       ,#f       ,(make-pitch 0 1 0))
+       (handclap         triangle      ,#f       ,(make-pitch 0 1 0))
+       (electricsnare    default       ,#f       ,(make-pitch 0 1 0))
+       (lowfloortom      default       ,#f       ,(make-pitch -1 3 0))
+       (closedhihat      cross         "stopped" ,(make-pitch 0 3 0))
+       (hihat            cross         ,#f       ,(make-pitch 0 3 0))
+       (highfloortom     default       ,#f       ,(make-pitch -1 5 0))
+       (pedalhihat       cross         ,#f       ,(make-pitch -1 2 0))
+       (lowtom           default       ,#f       ,(make-pitch 0 0 0))
+       (openhihat        cross         "open"    ,(make-pitch 0 3 0))
+       (halfopenhihat    xcircle       ,#f       ,(make-pitch 0 3 0))
+       (lowmidtom        default       ,#f       ,(make-pitch 0 1 0))
+       (himidtom         default       ,#f       ,(make-pitch 0 2 0))
+       (crashcymbala     xcircle       ,#f       ,(make-pitch 0 5 0))
+       (crashcymbal      xcircle       ,#f       ,(make-pitch 0 5 0))
+       (hightom          default       ,#f       ,(make-pitch 0 4 0))
+       (ridecymbala      cross         ,#f       ,(make-pitch 0 5 0))
+       (ridecymbal       cross         ,#f       ,(make-pitch 0 5 0))
+       (chinesecymbal    mensural      ,#f       ,(make-pitch 0 5 0))
+       (ridebell         default       ,#f       ,(make-pitch 0 5 0))
+       (splashcymbal     diamond       ,#f       ,(make-pitch 0 5 0))
+       (cowbell          triangle      ,#f       ,(make-pitch 0 5 0))
+       (crashcymbalb     cross         ,#f       ,(make-pitch 0 5 0))
+       (vibraslap        diamond       ,#f       ,(make-pitch 0 4 0))
+       (ridecymbalb      cross         ,#f       ,(make-pitch 0 5 0))
+ ))
+
+#(define timbales `(
+       (losidestick      cross         ,#f       ,(make-pitch -1 6 0))
+       (lotimbale        default       ,#f       ,(make-pitch -1 6 0))
+       (cowbell          triangle      ,#f       ,(make-pitch 0 0 0))
+       (hisidestick      cross         ,#f       ,(make-pitch 0 1 0))
+       (hitimbale        default       ,#f       ,(make-pitch 0 1 0))
+ ))
+
+#(define congas `(
+       (losidestick      cross         ,#f       ,(make-pitch -1 6 0))
+       (loconga          default       ,#f       ,(make-pitch -1 6 0))
+       (hisidestick      cross         ,#f       ,(make-pitch 0 1 0))
+       (hiconga          default       ,#f       ,(make-pitch 0 1 0))
+       (openhiconga      default       open"     ,(make-pitch 0 1 0))
+       (mutehiconga      default       stopped"  ,(make-pitch 0 1 0))
+ ))
+
+#(define bongos `(
+       (lobongo          default       ,#f       ,(make-pitch -1 6 0))
+       (hibongo          default       ,#f       ,(make-pitch 0 1 0))
+ ))
+
+#(define guiro `(
+       (shortguiro       default       "staccato",(make-pitch 0 0 0))
+       (longguiro        default       "tenuto"  ,(make-pitch 0 0 0))
+       (guiro            default       ,#f       ,(make-pitch 0 0 0))
+ ))
+
+#(define triangle `(
+       (opentriangle     cross         "open"    ,(make-pitch 0 0 0))
+       (mutetriangle     cross         "stopped" ,(make-pitch 0 0 0))
+       (triangle         cross         ,#f       ,(make-pitch 0 0 0))
+ ))
+
+
+
+\pitchnames
+#(append (map (lambda (x) (cons (car x) (caddr x))) drum-pitch-names)
+        (map (lambda (x) (cons (cadr x) (caddr x))) drum-pitch-names)
+ )
+
+
+\version "1.3.142";
index 4b9a7a93095a7ea1dfd2bcc12ecdb8a35c5df16e..684fe2850ea9a349098a1906dfc0a296a6a005e6 100644 (file)
@@ -14,11 +14,13 @@ outputscale = \staffheight / 4.0;
 \translator { \NoteNamesContext }
 \translator { \ScoreContext }
 \translator { \ChoirStaffContext}
+\translator { \InnerChoirStaffContext}
 \translator { \GraceContext}
 \translator { \RhythmicStaffContext}
 \translator { \StaffContext }
 \translator { \VoiceContext}
 \translator { \StaffGroupContext }
+\translator { \InnerStaffGroupContext }
 \translator { \ChordNamesContext }
 \translator { \GrandStaffContext}
 \translator { \LyricsContext }
diff --git a/scm/drums.scm b/scm/drums.scm
new file mode 100644 (file)
index 0000000..b1eff86
--- /dev/null
@@ -0,0 +1,159 @@
+; drum-"hack". See input/tricks/drums.ly and ly/drumpitch.ly
+; 2001/03/25 Rune Zedeler <rune@zedeler.dk>
+
+(define (seq-music-list elts)
+   (let* ( (ml (ly-make-music "Sequential_music")) )
+   (ly-set-mus-property ml 'elements elts)
+   ml 
+))
+
+(define (make-art-script x) 
+     (let* (  (m (ly-make-music "Articulation_req"))
+           )
+     (ly-set-mus-property m 'articulation-type x)
+     m
+     )
+ )
+
+;; adds the articulation script x to m if x is not #f.
+(define (add-art-script m x)
+  (if x
+   (if (and x (equal? (ly-music-name m) "Request_chord"))
+     (ly-set-mus-property m 'elements
+       (cons (make-art-script x) (ly-get-mus-property m 'elements))
+     )
+     (let* ( (es (ly-get-mus-property m 'elements))
+            (e (ly-get-mus-property m 'element)) )
+       (map (lambda (y) (add-art-script y x)) es)
+       (if (music? e)
+         (add-art-script e x))
+     )
+   )
+  )
+  m
+ )
+
+(define (make-head-type-elem t)
+   (let* ( (m (ly-make-music "Music"))
+         )
+     (ly-set-mus-property m 'iterator-ctor Push_property_iterator::constructor)
+     (ly-set-mus-property m 'symbols 'NoteHead)
+     (ly-set-mus-property m 'grob-property 'style)
+     (ly-set-mus-property m 'grob-value t)
+     m
+   )
+ )
+
+(define (make-head-type t)
+   (let* ( (m (ly-make-music "Context_specced_music"))
+           (e (make-head-type-elem t))
+         )
+     (ly-set-mus-property m 'element e)
+     (ly-set-mus-property m 'context-type "Thread")
+     m
+   )
+ )
+
+(define (make-thread-context thread-name element)
+   (let* ( (m (ly-make-music "Context_specced_music")))
+     (ly-set-mus-property m 'element element)
+     (ly-set-mus-property m 'context-type "Thread")
+     (ly-set-mus-property m 'context-id (symbol->string thread-name))
+     m
+   )
+ )
+
+;; makes a sequential-music of thread-context, head-change and note
+(define (make-drum-head kit req-ch )
+  (let ((es (ly-get-mus-property req-ch 'elements)))
+   (if (equal? es '())
+    req-ch
+    (let* ((fe (car es))
+           (oldp (ly-get-mus-property fe 'pitch))
+         )
+      (if (not (pitch? oldp))
+       req-ch
+       (let* ((pap ((pitch->paper kit) oldp ))
+             (style (car pap))
+             (script (cadr pap))
+             (pitch (caddr pap))
+             (ht (make-head-type style))
+             (seq (seq-music-list (list ht req-ch)))
+             )
+         (add-art-script req-ch script)
+         (ly-set-mus-property fe 'pitch pitch)
+         (set! req-ch (make-thread-context style seq))
+        req-ch
+       )
+      )
+    )
+   )
+  )
+ )
+
+;; whoa, hadn't head of "assoc" when I made this :)
+(define ((pitch->paper kit) p)
+   (let p2p ((pitches drum-pitch-names))
+     (cond ((eq? pitches '())     
+             (begin
+              (display p) ;; UGH. FIXME. pitch->string ???
+              (ly-warn " unknown drumpitch.")
+              (cdar (eval kit))
+          ))
+         ((eq? p (caddr (car pitches))) ((name->paper kit) (caar pitches)) )
+        (else                          (p2p (cdr pitches) ) )
+     )
+   )
+ )
+(define ((name->paper kit) n)
+   (let n2p ((pitches (eval kit)))
+     (cond ((eq? pitches '())
+             (begin
+              (ly-warn (string-append "Kit `" (symbol->string kit) "' doesn't contain drum `" n
+                                      "'\nSee lily/drumpitch.ly for supported drums."))
+              (cdar (eval kit))
+            ))
+           ((eq? n (caar pitches))  (cdar pitches) )
+          (else                    (n2p (cdr pitches) ) )
+     )
+   )
+ )
+
+
+;; converts a midi-pitched (ly/drumpitch.ly) file to paper output.
+(define ((drums->paper kit) music)
+  (begin
+   (if (equal? (ly-music-name music) "Request_chord")
+    (set! music (make-drum-head kit music))
+    (let* ((es (ly-get-mus-property music 'elements))
+           (e (ly-get-mus-property music 'element))
+           (p (ly-get-mus-property music 'pitch))
+           (body (ly-get-mus-property music 'body))
+           (alts (ly-get-mus-property music 'alternatives)))
+
+      (if (pair? es)
+       (ly-set-mus-property music 'elements (map (drums->paper kit) es) )
+      )
+
+      (if (music? alts)
+        (ly-set-mus-property
+         music 'alternatives
+         ((drums->paper kit) alts)))
+
+      (if (music? body)
+        (ly-set-mus-property
+         music 'body
+         ((drums->paper kit) body)))
+
+      (if (music? e)
+        (begin
+          (ly-set-mus-property
+           music 'element
+           ((drums->paper kit) e))
+        )
+      )
+    )
+   )
+   music
+  )
+ )
index f2b11acc7318889482a4bb8e65dbf958a7d705cf..1e6fab4f69b6eba5cd49b2331cfd3e5606cfe43a 100644 (file)
@@ -98,6 +98,7 @@
           "chord-name.scm"
           "grob-description.scm"
           "script.scm"
+          "drums.scm"
           "midi.scm"
           )))