Multiple TimeSignature Events in a Single Measure

Discussion in 'comp.music.midi' started by Murray Roberts, Jul 2, 2003.

  1. On Wed, 02 Jul 2003 23:17:23 +1000, Peter Zegelin
    <peter@fracturedsoftware.com> wrote:

    >Hi,
    > I am making a Midi viewing application and am wondering how to handle
    >the possibility of multiple timeSignature events within a bar. My
    >understanding is that a measure can only have a single timeSignature,
    >but of course within a midi file timeSignature events could happen
    >anywhere, so it would be quite possible to have several timeSignature
    >events within the one measure.
    > Of course the measures here have to be reconstructed from the timing
    >info so it is semi artificial but the following example will show what I
    >mean:
    >
    >ppqn = 100
    >no time signature at the beginning so assume 4/4
    >therefore each measure is 100 * 4 'wide'
    >
    > What happens though if a 3/4 timeSignature event occurs at say 390 -
    >just before the end of the first measure?
    >
    >
    > My inclination is to use the first time signature event that occurs
    >within a measure and ignore the rest. So in the above example if the
    >timeSignature arrived at 600 - halfway into the second measure - then
    >that second measure would be converted to 3/4 time and would be only 300
    >units long. I would make it that the second measure could be 'converted'
    >to another time by any timeSig event that occured upto 799.
    > Is this a resonable way to go about it? The only problem is that two
    >sequencers that Ive looked at dont appear to handle it this way! They
    >both handle it the same but I just cant figure it out.
    >
    > Any suggestions would be very helpful,
    >
    >thanks!
    >
    >Peter



    No sequencer will allow this because a measure must be allowed to run
    its course otherwise your 4/4 will not be 4/4 but some other hybrid
    26/32 or 5/16 or something.

    I'd suggest you insert a note at the point where you want your time
    change within that 4/4 measure and adjust your 4/4 measure (at the
    start of measure) till that note is at a new barline. You could very
    well end up with a hybrid timing...... but this is midi.

    Can you have adjust to higher resolution of ppqn, it may help.

    Mur
  2. Hi,
    I am making a Midi viewing application and am wondering how to handle
    the possibility of multiple timeSignature events within a bar. My
    understanding is that a measure can only have a single timeSignature,
    but of course within a midi file timeSignature events could happen
    anywhere, so it would be quite possible to have several timeSignature
    events within the one measure.
    Of course the measures here have to be reconstructed from the timing
    info so it is semi artificial but the following example will show what I
    mean:

    ppqn = 100
    no time signature at the beginning so assume 4/4
    therefore each measure is 100 * 4 'wide'

    What happens though if a 3/4 timeSignature event occurs at say 390 -
    just before the end of the first measure?


    My inclination is to use the first time signature event that occurs
    within a measure and ignore the rest. So in the above example if the
    timeSignature arrived at 600 - halfway into the second measure - then
    that second measure would be converted to 3/4 time and would be only 300
    units long. I would make it that the second measure could be 'converted'
    to another time by any timeSig event that occured upto 799.
    Is this a resonable way to go about it? The only problem is that two
    sequencers that Ive looked at dont appear to handle it this way! They
    both handle it the same but I just cant figure it out.

    Any suggestions would be very helpful,

    thanks!

    Peter
  3. I might suggest:

    When playing the song file or track sequence, you simply need to adapt your
    timing engine live. your timing mechanism monitors what is to happen and
    when, this should give you all the info you need no?

    001:01:001 TIMESIG=4/4
    ....
    001:01:360 TIMESIG=3/4

    it all depends on your PPQN resolution if it's 480 then whatever occurs in
    between each tick is what must be considered. So if you have 3 time
    signatures within a tick, chances are you made 2 mistakes and corrected it
    in the last time signature event.

    When the player receives a time signature event (whether within a single bar
    or not, you still need to do the same thing, and that is change your number
    of intervals to the nominator of the time signature. the rest of the
    playing of sogn should simply adjust itself accordingly.
    --
    Stéphane Richard
    Senior Software and Technology Supervisor
    http://www.totalweb-inc.com
    For all your hosting and related needs
    "Peter Zegelin" <peter@fracturedsoftware.com> wrote in message
    news:peter-59EEB1.23172202072003@iridium.webone.com.au...
    > Hi,
    > I am making a Midi viewing application and am wondering how to handle
    > the possibility of multiple timeSignature events within a bar. My
    > understanding is that a measure can only have a single timeSignature,
    > but of course within a midi file timeSignature events could happen
    > anywhere, so it would be quite possible to have several timeSignature
    > events within the one measure.
    > Of course the measures here have to be reconstructed from the timing
    > info so it is semi artificial but the following example will show what I
    > mean:
    >
    > ppqn = 100
    > no time signature at the beginning so assume 4/4
    > therefore each measure is 100 * 4 'wide'
    >
    > What happens though if a 3/4 timeSignature event occurs at say 390 -
    > just before the end of the first measure?
    >
    >
    > My inclination is to use the first time signature event that occurs
    > within a measure and ignore the rest. So in the above example if the
    > timeSignature arrived at 600 - halfway into the second measure - then
    > that second measure would be converted to 3/4 time and would be only 300
    > units long. I would make it that the second measure could be 'converted'
    > to another time by any timeSig event that occured upto 799.
    > Is this a resonable way to go about it? The only problem is that two
    > sequencers that Ive looked at dont appear to handle it this way! They
    > both handle it the same but I just cant figure it out.
    >
    > Any suggestions would be very helpful,
    >
    > thanks!
    >
    > Peter
  4. Jeff Glatt

    Jeff Glatt Guest

    >Peter Zegelin
    >I am making a Midi viewing application and am wondering how to handle
    >the possibility of multiple timeSignature events within a bar.


    Um, you can't have "multiple time signatures within a bar" because the presense
    of a time signature itself marks the start of a new bar. Doing something like
    putting a 4/4 time signature at the start of a bar, and then after 3 quarter
    notes, putting a 3/4 time signature would make any trained musician scratch his
    head in total bewilderment.

    >ppqn = 100
    >no time signature at the beginning so assume 4/4
    >therefore each measure is 100 * 4 'wide'


    >What happens though if a 3/4 timeSignature event occurs at say 390 -
    >just before the end of the first measure?


    What happens is that the customer who purchased the software should write the
    manufacturer and say "Your software has a bug in it. Please fix it". Better
    yet, he should avail himself of other software.
  5. > I am making a Midi viewing application and am wondering how to handle
    >the possibility of multiple timeSignature events within a bar. My
    >understanding is that a measure can only have a single timeSignature,
    >but of course within a midi file timeSignature events could happen
    >anywhere, so it would be quite possible to have several timeSignature
    >events within the one measure.
    > Of course the measures here have to be reconstructed from the timing
    >info so it is semi artificial but the following example will show what I
    >mean:


    Can you construct a midi file with this included and see how it's
    treated by whatever commercial sequencers you have available? Or make
    it available on a web page and point us to it? Would be interesting
    to see how Cubase etc. deal with it - whether they throw away one of
    the timesig events or just treat it as a corrupt file.


    CubaseFAQ page www.laurencepayne.co.uk/CubaseFAQ.htm
  6. It is easy to destroy correct bar info of a midi file by adding or
    deleting pauses at wrong positions or wrong length.
    For midi playing this isn't important, for score editing or printing the
    wrong bar info produces problems. The software should handle this as
    good as possible e.g. ignore bar info totally and assume 4/4. It would
    be too bad if a software doesn't accept files that contain minor bugs.

    It is clear that the problem is inside the MIDI file and there exists no
    correct handling of this authoring problem. The software should warn
    about the wrong info in the midi file and ignore the wrong bar positions
    (but not loose the notes of these bars).

    Or try demos of existing products and see how they handle midi files
    with wrong bar positions.

    Jeff Glatt wrote:
    > >Peter Zegelin
    > >I am making a Midi viewing application and am wondering how to handle
    > >the possibility of multiple timeSignature events within a bar.
    > >What happens though if a 3/4 timeSignature event occurs at say 390 -
    > >just before the end of the first measure?

    >
    > What happens is that the customer who purchased the software should write the
    > manufacturer and say "Your software has a bug in it. Please fix it". Better
    > yet, he should avail himself of other software.
  7. Jeff Glatt

    Jeff Glatt Guest

    >Laurence Payne
    >Would be interesting
    >to see how Cubase etc. deal with it - whether they throw away one of
    >the timesig events or just treat it as a corrupt file.


    Hopefully, all software will treat it like a corrupt file. Such behavior would
    in turn hopefully inspire the software programmer who wrote the software that
    created that musical aberration to learn something about music and fix the
    obvious bug in his software
  8. Jeff Glatt

    Jeff Glatt Guest

    >Günter Nagler <gnagler@iicm.tu-graz.ac.at>
    >It is easy to destroy correct bar info of a midi file by adding or
    >deleting pauses at wrong positions or wrong length.


    It's only easy to do so when using software that incorrectly inserts/deletes
    musical data. ie, The software obviously has no concept whatsoever of musical
    bars, or has the incorrect concept, and therefore has no business whatsoever
    allowing the time signature to be changed at all nor dealing with data that
    contains time signatures. Such software has a bug in it, or was not designed to
    be used as it is used. In either case, the results are invalid and endusers
    should eschew using such software for music editing, or expect to lose musical
    information (at the very least, lose all of the time signatures at and after
    the offending one. And that could be real nightmare all by itself).

    In my own case of writing music software, I've tried to respect time signatures
    and use them properly. I do not think that it is an unreasonable expectation
    for other software to do likewise. We would not have any problems if all music
    software did so. When problems arise, I very much believe that the blame should
    be placed where it really exists -- with the software that caused an invalid
    time signature to exist.

    >Try demos of existing products and see how they handle midi files
    >with wrong bar positions.


    Personally, I don't think that it's a good idea to evaluate a software's
    quality based upon how well it handles totally invalid data. After all, such a
    program may be the one that is creating the invalid data to begin with. (You
    definitely don't want to use that program). A better test is to try various
    things with time signatures and cutting/pasting data, and see how well the
    software deals with that situation, and whether it can create a totally valid
    MIDI file.
  9. In article <3F0413EE.4066AD44@iicm.tu-graz.ac.at>,
    Gunter Nagler <gnagler@iicm.tu-graz.ac.at> wrote:

    > It is easy to destroy correct bar info of a midi file by adding or
    > deleting pauses at wrong positions or wrong length.
    > For midi playing this isn't important, for score editing or printing the
    > wrong bar info produces problems. The software should handle this as
    > good as possible e.g. ignore bar info totally and assume 4/4. It would
    > be too bad if a software doesn't accept files that contain minor bugs.
    >
    > It is clear that the problem is inside the MIDI file and there exists no
    > correct handling of this authoring problem. The software should warn
    > about the wrong info in the midi file and ignore the wrong bar positions
    > (but not loose the notes of these bars).
    >
    > Or try demos of existing products and see how they handle midi files
    > with wrong bar positions.
    >
    > Jeff Glatt wrote:
    > > >Peter Zegelin
    > > >I am making a Midi viewing application and am wondering how to handle
    > > >the possibility of multiple timeSignature events within a bar.
    > > >What happens though if a 3/4 timeSignature event occurs at say 390 -
    > > >just before the end of the first measure?

    > >
    > > What happens is that the customer who purchased the software should write
    > > the
    > > manufacturer and say "Your software has a bug in it. Please fix it". Better
    > > yet, he should avail himself of other software.



    Thanks Gunter and Jeff!
    Its good to confirm what I suspected as I'm neither a musician or
    expert on the midi format. I will have to think of a good way to handle
    this although my original way (ignoring 'extra' timing events in a
    measure) is probably as good as any and easy to program correctly.

    Fortunately I've never actually come across this (I think!) in a real
    file. I was writing a timing test file with some other software and soon
    found that it was quite possible to enter several timing events within
    the same bar, with strange results. What threw me was that another piece
    of software displayed this file the same way, so I thought I must have
    missed some inside knowledge on how to handle the situation.

    My software works fine even with this bad info so I will just display
    a warning and continue if I find this in a file. My software will only
    be able to view at first but I am hoping to add editing capabilities
    later on and will definitely endeavor to avoid (or at least warn about)
    this situation.

    thanks again,

    Peter

Share This Page