bug-lilypond
[Top][All Lists]
Advanced

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

Re: unfoldrepeats makes midi tracks follow one another


From: Mats Bengtsson
Subject: Re: unfoldrepeats makes midi tracks follow one another
Date: Mon, 10 Jan 2005 12:27:36 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20040913

The problem is how you apply \unfoldrepeats. Actually, apart from
unfolding the repeats, what you actually do is to say

\score {
 <<
  {
   \new DrumStaff { \drumContents }
   \context Staff = trombone \trombone
  }
 >>

Since you have an {...} directly inside the <<...>>, the
<<...>> will only contain a sequence of drum notes followed by
the trombone notes.

I haven't tried, but I'm sure that the following should work
as you expect.
\score {
 \unfoldrepeats <<
   \new DrumStaff { \drumContents }
   \context Staff = trombone \trombone
 >>


  /Mats

John Comeau wrote:
I'm probably doing something wrong, but have tried several
permutations of wrapping things inside one another with the same
result: the tracks follow one another in the MIDI output though the
graphical representation is correct. Googling and searching archives
for unfoldrepeats turns up nothing of value that I could see.

downtown_sandiego.ly:

tromboneNotes = \relative c {
 c16 c c8-. r c16 c d d d8-. r d16 d e e e8-. r e16 e f f f8-. r f16 f
 e16 e e8-. r e16 e d d d8-. r d16 d e e e8-. d16 d d8-. e16 e e8-. d16 d d8-.
}
trombone = {
 \time 4/4
 \set Staff.instrument = #"Trombone"
 \set Staff.midiInstrument = "trombone"
 \clef bass
 \repeat volta 2 {
  \context Staff <<
   \tromboneNotes
  >>
 }
}
drumNotes = \drummode {
 hh8 sn hh sn hh sn hh sn hh8 sn hh sn hh sn hh sn
 hh8 sn hh sn hh sn hh sn hh8 sn hh sn hh sn hh sn
}
drumContents = {
 \set DrumStaff.instrument = #"Drums"
 \repeat volta 2 {
  \time 4/4 <<
   \new DrumVoice { \voiceOne \drumNotes }
  >>
 }
}
\score {
 <<
  \context Staff = trombone \trombone
  \new DrumStaff { \drumContents }
 >>
 \layout { }
}
\score {
 <<
  \unfoldrepeats {
   \new DrumStaff { \drumContents }
   \context Staff = trombone \trombone
  }
 >>
 \midi { \tempo 4=120 }
}

Dump of downtown_sandiego.midi (http://jcomeau.com/src/midi/midi.py,
symlink to mididump)

[ # midi file dump
[ # dump midi header
'MThd',
6, # chunk length
1, # MIDI file format
3, # Tracks
0x180, # Time Division
], # end of midi header dump
[ # midi track 1
'MTrk',
248, # chunk length
[0, 0xff, 0x1, 39, 'Creator: GNU LilyPond 2.4.2            '],
[0, 0xff, 0x1, 58, 'Generated automatically by: GNU LilyPond 2.4.2            ']
,
[0, 0xff, 0x1, 60, 'at Sun Jan  9 16:22:19 2005
'],
[0, 0xff, 0x1, 60, 'at Sun Jan  9 16:22:19 2005
'],
[0, 0xff, 0x3, 7, 'Track 0'],
[0, 0xff, 0x2f, 0, ''],
], # end midi track
[ # midi track 2
'MTrk',
625, # chunk length
[0, 0xc9, 0], # change instrument for channel 9 to Acoustic Grand Piano
[0, 0xff, 0x4, 5, 'drums'],
[0, 0x99, 0x2a, 0x7f], # Note On, "gf,", channel 9, velocity 127
[0, 0xff, 0x58, 4, '\x04\x02\x12\x08'],
[0, 0xff, 0x3, 14, 'uniqueContext2'],
[0, 0xff, 0x51, 3, '\x07\xa1 '],
[192, 0x89, 0x2a, 0x40], # Note Off, "gf,", channel 9, velocity 64
[0, 0x99, 0x26, 0x7f], # Note On, "d,", channel 9, velocity 127
[192, 0x89, 0x26, 0x40], # Note Off, "d,", channel 9, velocity 64
[0, 0x99, 0x2a, 0x7f], # Note On, "gf,", channel 9, velocity 127
[192, 0x89, 0x2a, 0x40], # Note Off, "gf,", channel 9, velocity 64
[0, 0x99, 0x26, 0x7f], # Note On, "d,", channel 9, velocity 127
[192, 0x89, 0x26, 0x40], # Note Off, "d,", channel 9, velocity 64
...[snip]
[0, 0xff, 0x2f, 0, ''],
], # end midi track
[ # midi track 3
'MTrk',
751, # chunk length
#
# *** NOTE DELTA OF NEXT EVENT -- trombone follows drums! ***
#
[12288, 0xc1, 57], # change instrument for channel 1 to Trombone
[0, 0xff, 0x4, 8, 'trombone'],
[0, 0x91, 0x30, 0x7f], # Note On, "c", channel 1, velocity 127
[0, 0xff, 0x58, 4, '\x04\x02\x12\x08'],
[0, 0xff, 0x3, 8, 'trombone'],
[0, 0xff, 0x51, 3, '\x07\xa1 '],
[96, 0x81, 0x30, 0x40], # Note Off, "c", channel 1, velocity 64
[0, 0x91, 0x30, 0x7f], # Note On, "c", channel 1, velocity 127
[96, 0x81, 0x30, 0x40], # Note Off, "c", channel 1, velocity 64
[0, 0x91, 0x30, 0x7f], # Note On, "c", channel 1, velocity 127
[192, 0x81, 0x30, 0x40], # Note Off, "c", channel 1, velocity 64
[192, 0x91, 0x30, 0x7f], # Note On, "c", channel 1, velocity 127
[96, 0x81, 0x30, 0x40], # Note Off, "c", channel 1, velocity 64
...[snip]
[0, 0xff, 0x2f, 0, ''],
], # end midi track
] # end midi file


_______________________________________________
bug-lilypond mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/bug-lilypond

--
=============================================
        Mats Bengtsson
        Signal Processing
        Signals, Sensors and Systems
        Royal Institute of Technology
        SE-100 44  STOCKHOLM
        Sweden
        Phone: (+46) 8 790 8463                         
        Fax:   (+46) 8 790 7260
        Email: address@hidden
        WWW: http://www.s3.kth.se/~mabe
=============================================




reply via email to

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